Skip to content

Commit 3abdbbe

Browse files
committed
metaplex demo script to create or update metadata of an spl-token
0 parents  commit 3abdbbe

File tree

6 files changed

+354
-0
lines changed

6 files changed

+354
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package-lock.json
2+
node_modules

LICENSE

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2022 Wormhole Project Contributors
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

README.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Metaplex Metadata Demo
2+
3+
A utility script for creating and managing SPL token metadata using the Metaplex SDK on Solana.
4+
5+
## Project Setup
6+
7+
1. Clone the Repository:
8+
9+
```bash
10+
git clone https://github.com/wormhole-foundation/demo-metaplex-metadata
11+
cd demo-metaplex-metadata
12+
```
13+
14+
2. Install Dependencies:
15+
16+
```bash
17+
npm install
18+
```
19+
20+
3. Setup environment variable:
21+
22+
```bash
23+
SOL_PRIVATE_KEY="INSERT_PRIVATE_KEY"
24+
```
25+
26+
## Usage:
27+
You can run the script to create or update metadata for an SPL token using the Metaplex SDK.
28+
29+
Creates the metadata for your SPL token:
30+
31+
```bash
32+
npm run create-metadata
33+
```
34+
35+
Updates the metadata:
36+
37+
```bash
38+
npm run update-metadata
39+
```
40+
41+
## Important Notes
42+
- Never commit your private key or sensitive information
43+
- Update the following TODOs in the token-metadata script:
44+
- Token mint account
45+
- metadata details

SECURITY.md

+194
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# Security
2+
3+
The following document describes various aspects of the Wormhole security program.
4+
5+
## Table of Contents
6+
- [3rd Party Security Audits](#3rd-Party-Security-Audits)
7+
- [Bug Bounty Program](#Bug-Bounty-Program)
8+
- [Trust Assumptions](#Trust-Assumptions)
9+
- [White Hat Hacking](#White-Hat-Hacking)
10+
- [Chain Integrators](#Chain-Integrators)
11+
- [Social Media Monitoring](#Social-Media-Monitoring)
12+
- [Incident Response](#Incident-Response)
13+
- [Emergency Shutdown](#Emergency-Shutdown)
14+
- [Security Monitoring](#Security-Monitoring)
15+
## 3rd Party Security Audits
16+
17+
The Wormhole project engages 3rd party firms to conduct independent security audits of Wormhole. At any given time, multiple audit streams are likely in progress.
18+
19+
As these 3rd party audits are completed and issues are sufficiently addressed, we make those audit reports public.
20+
21+
- **[January 2022 - Neodyme](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2022-01-10_neodyme.pdf)**: _Ethereum Contracts_
22+
- **[January 2022 - Neodyme](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2022-01-10_neodyme.pdf)**: _Solana Contracts_
23+
- **[January 2022 - Neodyme](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2022-01-10_neodyme.pdf)**: _Terra Contracts_
24+
- **[January 2022 - Neodyme](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2022-01-10_neodyme.pdf)**: _Guardian_
25+
- **[January 2022 - Neodyme](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2022-01-10_neodyme.pdf)**: _Solitaire_
26+
- **[July 2022 - Kudelski](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2022-07-01_kudelski.pdf)**: _Ethereum Contracts_
27+
- **[July 2022 - Kudelski](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2022-07-01_kudelski.pdf)**: _Solana Contracts_
28+
- **[July 2022 - Kudelski](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2022-07-01_kudelski.pdf)**: _Terra Contracts_
29+
- **[July 2022 - Kudelski](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2022-07-01_kudelski.pdf)**: _Guardian_
30+
- **[August 2022 - Kudelski](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2022-08-16_kudelski.pdf)**: _Algorand Contracts_
31+
- **[September 2022 - OtterSec](https://github.com/wormhole-foundation/wormhole-audits/blob/main/Wormhole_Near_OtterSec.pdf)**: _NEAR Contracts_
32+
- **[September 2022 - Trail of Bits](https://github.com/wormhole-foundation/wormhole-audits/blob/main/Wormhole_Audit_Report_TrailOfBits_2022-09.pdf)**: _Solana Contracts_
33+
- **[September 2022 - Trail of Bits](https://github.com/wormhole-foundation/wormhole-audits/blob/main/Wormhole_Audit_Report_TrailOfBits_2022-09.pdf)**: _CosmWasm Contracts_
34+
- **[October 2022 - OtterSec](https://github.com/wormhole-foundation/wormhole-audits/blob/main/Wormhole_OtterSec_Aptos_2022-10.pdf)**: _Aptos Contracts_
35+
- **[October 2022 - Hacken](https://github.com/wormhole-foundation/wormhole-audits/blob/main/Wormhole_dApp_NEAR_AuditReport_Hacken_2022-10-25.pdf)**: _NEAR Integration_
36+
- **[October 2022 - Coinspect](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2022-10_Coinspect_Wormhole_Algorand.pdf)**: _Algorand Contracts_
37+
- **[November 2022 - Zellic](https://github.com/wormhole-foundation/wormhole-audits/blob/main/Wormhole_Aptos_Audit_Report_Zellic_2022-11.pdf)**: _Aptos Integration_
38+
- **[February 2023 - OtterSec](https://github.com/wormhole-foundation/wormhole-audits/blob/main/Wormhole_OtterSec_Aptos_NFT_2023-02.pdf)**: _Aptos NFT Bridge_
39+
- **[March 2023 - CertiK](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2023-03-08_CertiK_Wormhole_EVM.pdf)**: _EVM Contracts_
40+
- **[April 2023 - Trail of Bits](https://github.com/wormhole-foundation/wormhole-audits/blob/main/Wormhole_Audit_Report_TrailOfBits_2023-04.pdf)**: _Guardian node: Governor and Watchers_
41+
- **[April 2023 - OtterSec](https://github.com/wormhole-foundation/wormhole-audits/blob/main/Wormhole_OtterSec_Sui_2023-04.pdf)**: _Sui Contracts_
42+
- **[May 2023 - Runtime Verification](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2023-05_Runtime_Verification_Wormhole_EVM.pdf)**: _Formal Verification of EVM contracts_
43+
- **[Jan 2024 - Cyfrin](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2024-01-10-cyfrin-thermae-v2.0.pdf)**: _Uniswap Liquidity Layer EVM Contracts_
44+
- **[Jan 2024 - OtterSec](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2024-01-ottersec-terra.pdf)**: _Terra Classic Contract Upgrades_
45+
- **[Feb 2024 - Cyfrin](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2024-04-09-cyfrin-wormhole-evm-cctp-v2-1.pdf)**: _CCTP EVM Contracts_
46+
- **[Mar 2024 - Cyfrin](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2024-04-11-cyfrin-wormhole-evm-ntt.pdf)**: _NTT EVM Contracts_
47+
- **[Mar 2024 - Cantina](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2024-04-cantina-wormhole-evm-ntt.pdf)**: _NTT EVM Contracts_
48+
- **[Mar 2024 - OtterSec](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2024-03-28-ottersec-solana-ntt.pdf)**: _NTT Solana Contracts_
49+
- **[Mar 2024 - Neodyme](https://github.com/wormhole-foundation/wormhole-audits/blob/main/2024-04-12-neodyme-solana-ntt.pdf)**: _NTT Solana Contracts_
50+
51+
## Bug Bounty Program
52+
53+
The Wormhole project operates a bug bounty program to financially incentivize independent researchers for finding and responsibly disclosing security issues.
54+
55+
- [Immunefi-Hosted Program](https://immunefi.com/bounty/wormhole/)
56+
- **Scopes**: Guardian and Smart Contracts
57+
- **Rewards**: Up to $2,500,000 USDC
58+
- **KYC**: Required
59+
60+
If you find a security issue in Wormhole, please report the issue immediately using the bug bounty program above.
61+
62+
If there is a duplicate report, either the same reporter or different reporters, the first of the two by timestamp will be accepted as the official bug report and will be subject to the specific terms of the program.
63+
64+
## Trust Assumptions
65+
66+
Consensus on Wormhole is achieved by two subset groups of Guardians (aka: validators) within the Guardian Set, which have the following abilities:
67+
68+
- **Super Majority** (any 2/3+ quorum of Guardians - 13 of 19)
69+
* Can pass messages
70+
- Core messaging
71+
- Token/NFT value movement
72+
* Can pass governance
73+
- Set fees
74+
- Upgrade Contracts
75+
- Upgrade Guardian Set
76+
- **Super Minority** (any 1/3+ quorum of Guardians - 7 of 19)
77+
* Can censor messages or governance
78+
- Refusing to sign observed message(s)
79+
- Refusing to observe the block chain
80+
- Refusing to run guardian software
81+
82+
There are 19 Guardians in the current Guardian Set, made up of some of the largest and most reputable staking providers in crypto. This level of operational security diversity is a useful property in preventing wholesale compromise of the Guardian Set due to operational failures of a single or small number of organizations.
83+
84+
The Guardian Set is expected to grow over time to further decentralize the Wormhole Guardian Set and the Wormhole network.
85+
## White Hat Hacking
86+
87+
The Wormhole project wants to lower the bar for White-hat hackers to find security bugs in Wormhole. Why? The easier this process, the more likely it will be for white-hats to find bugs in Wormhole and responsibly disclose them, helping to secure the network.
88+
89+
Here's a list of strategies that are helpful for getting started on Wormhole:
90+
91+
- Review the existing unit and integration testing (found in [CONTRIBUTING.md](https://github.com/wormhole-foundation/wormhole/blob/main/CONTRIBUTING.md)) and see what is already being testing for.
92+
- Check out places where there might be missing test coverage entirely. This could be a ripe spot to look for something we missed.
93+
- Check out places where there are unit/integration tests, but they lack sufficient [negative test](https://en.wikipedia.org/wiki/Negative_testing) coverage.
94+
- Review different smart contract implementations (eg. Solana, EVM, CosmWasm, Move) and attempt to understand how and why they are different.
95+
- Does one chain have a safety check that another chain doesn't?
96+
- Does one chain have a specific set of nuances / gotchas that that were missed on another chain?
97+
- Consider going beyond the source code
98+
- Review the deployed contracts on chain. Is something odd that may have been missed?
99+
100+
This section will continue iterating on white-hat bootstrap strategies as lessons are learned hacking on Wormhole and from community members.
101+
102+
It's important to remember this is an iterative process and to stay positive. If you spend the time coming up with a new test case, but didn't actually find a bug, please send a [pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request) with additional positive and negative test cases. This process has shown repeatedly to improve your ability to understand Wormhole, and will increase your odds of finding future bugs.
103+
104+
## Chain Integrators
105+
106+
As the list of chains connected to Wormhole increases, so does the risk that a given connection could introduce risks to the Wormhole network. As a result, Wormhole does have built-in safety features (e.g.: [Governor white-paper](https://github.com/wormhole-foundation/wormhole/blob/main/whitepapers/0007_governor.md)) to reduce the "blast radius" of such case. That said, a defense in depth strategy is required to do as much as possible to secure the network. As part of this methodology, the Wormhole project recommends that all connected chains current and future implement robust security programs of their own to do their part in managing chain compromise risk to the Wormhole network.
107+
108+
Here are a few ways in which connected chains can maintain high security standards:
109+
110+
For source code ensure relevant bits are:
111+
112+
- All open source (required)
113+
- Audited by an independent third party with public audit reports
114+
- Included in a public bug bounty program. The bounty rewards should be sufficiently large to incentivize white-hat mindshare in finding security bugs and responsibly disclosing them
115+
- Version control systems contain adequate access controls and mandatory code review (e.g.: In github, use of branch protection and a minimum of one independent reviewer to merge code)
116+
- Maintaining a [SECURITY.md](https://github.com/wormhole-foundation/wormhole/blob/main/SECURITY.md) in the root of the repository (like this one) to offer guidance and transparency on security relevant topics
117+
- Includes sufficient unit and integration test coverage (including negative tests), which are run on every commit via continuous integration. Ensure that the results of those test runs are visible to the public
118+
119+
Additionally, ensure:
120+
121+
- The Wormhole team has sufficient contact information and an associated call or page tree to reach you in the event of a security incident.
122+
- That Wormhole has the full upgrade authority on relevant bridge contracts to act quickly in the case of a security incident.
123+
- You have an established incident response program in place, with established patterns and playbooks to ensure deterministic outcomes for containment.
124+
- When security issues do occur, please make sure that the chain makes every attempt to inform affected parties and leads with transparency.
125+
126+
## Social Media Monitoring
127+
128+
The Wormhole project maintains a social media monitoring program to stay abreast of important ecosystem developments.
129+
130+
These developments include monitoring services like Twitter for key phrases and patterns such that the Wormhole project is informed of a compromise or vulnerability in a dependency that could negatively affect Wormhole, its users, or the chains that Wormhole is connected to.
131+
132+
In the case of a large ecosystem development that requires response, the Wormhole project will engage its security incident response program.
133+
134+
## Incident Response
135+
136+
The Wormhole project maintains an incident response program to respond to vulnerabilities or active threats to Wormhole, its users, or the ecosystems it's connected to. Wormhole can be made aware about a security event from a variety of different sources (eg. bug bounty program, audit finding, security monitoring, social media, etc.)
137+
138+
When a Wormhole project contributor becomes aware of a security event, that contributor immediately holds the role of [incident commander](https://en.wikipedia.org/wiki/Incident_commander) for the issue until they hand off to a more appropriate incident commander. A contributor does not need to be a "security person" or have any special privileges to hold the role of incident commander, they simply need to be responsible, communicate effectively, and maintain the following obligations to manage the incident to completion.
139+
140+
The role of the incident commander for Wormhole includes the following minimum obligations:
141+
142+
- Understand what is going on, the severity, and advance the state of the incident.
143+
- Identify and contact the relevant responders needed to address the issue.
144+
- Identify what actions are needed for containment (eg. security patch, contracts deployed, governance ceremony).
145+
- Establish a dedicated real-time communication channel for responders to coordinate (eg. Slack, Telegram, Signal, or Zoom).
146+
- Establish a private incident document, where the problem, timeline, actions, artifacts, lessons learned, etc. can be tracked and shared with responders.
147+
- When an incident is over, host a [retrospective](https://en.wikipedia.org/wiki/Retrospective) with key responders to understand how things could be handled better in the future (this is a no blame session, the goal is objectively about improving Wormhole's readiness and response capability in the future).
148+
- Create issues in relevant ticket trackers for actions based on lessons learned.
149+
150+
## Emergency Shutdown
151+
152+
The Wormhole project has evaluated the concept of having an safety feature, which could allow Wormhole smart contracts to be paused during a state of existential crisis without contract upgrades. However, after careful consideration the project has chosen to not introduce such a feature at this time.
153+
154+
The rationale for this decision included the following considerations:
155+
156+
- Introduces new trust assumptions for the protocol specific to shutdown events.
157+
- Adds additional engineering overhead to design, develop, and maintain shutdown capability for each supported run-time.
158+
- Adds attack surface to Wormhole related smart contracts, which could introduce new bugs.
159+
- Adds gas cost on every transaction for a feature that will be used maybe once a year.
160+
- Makes assumptions about where in the code existential crisis may surface.
161+
162+
As an alternative approach, Wormhole has evolved its emergency shutdown strategy to leverage the existing upgrade authority via governance to temporarily patch smart contracts for vulnerabilities when/if they occur (eg. temporarily disabling the affected function) and a long-term bug fix is not readily available.
163+
164+
The benefits of such an approach include the following:
165+
166+
- Maintain the same trust assumptions for existential events
167+
- Allow selective shutdown of only the affected code (while leaving everything else fully functional)
168+
- No additional attack surface (only less attack surface during existential crisis)
169+
- No additional gas cost paid by users of Wormhole
170+
- No additional process or keys to distribute or manage for Guardians
171+
- For known shutdown cases, a shutdown contract with disabled capabilities can be pre-deployed on chain, making the governance proposal easier to produce and approve.
172+
- For unknown shutdown cases, a temporary patch can be developed to disable only the affected functionality.
173+
174+
The caveats of such an approach include the following:
175+
176+
- Speed to shutdown is limited by speed to develop the temporary bug fix (only for the unknown cases, known cases won't require development)
177+
- Speed to shutdown is limited by speed at which governance can be passed to accept the temporary bug fix (slower for unknown cases and faster for known cases)
178+
- Restoring after a shutdown will require a secondary governance action to either repoint the proxy contract to a non-shutdown implementation (known cases) or to revert the temporary patch and apply the long term patch (unknown cases)
179+
180+
## Security Monitoring
181+
182+
The Wormhole project expects all Guardians develop and maintain their own security monitoring strategies. This expectation is based on the value of having heterogeneous monitoring strategies across the Guardian set as a function of Wormhole's defense in depth approach, increasing the likelihood of detecting fraudulent activity.
183+
184+
Wormhole Guardians should aim to capture all of the following domains with their monitoring strategies:
185+
186+
- Guardian Application, System, and Network Activity
187+
- Gossip Network Activity
188+
- Smart Contract Activity/State
189+
- Transaction/Usage Activity
190+
- Governor Activity
191+
192+
Guardians are encouraged to share monitoring lessons learned with each other to the extent that it increases the ability to detect fraudulent activity on the network. However, the end state for Wormhole network monitoring is not a homogeneous monitoring strategy, as levels of diversity within the Guardians is an essential property of the Wormhole network.
193+
194+
Lastly, if a Guardian detects a security event via their monitoring strategy they are empowered to engage the above mentioned incident response pattern.

package.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "metaplex3",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"create-metadata": "esrun src/token-metadata.ts create",
8+
"update-metadata": "esrun src/token-metadata.ts update"
9+
},
10+
"type": "module",
11+
"keywords": [],
12+
"author": "",
13+
"license": "ISC",
14+
"dependencies": {
15+
"@metaplex-foundation/mpl-token-metadata": "^2.13.0",
16+
"@solana-developers/helpers": "^2.5.6",
17+
"@solana/web3.js": "^1.98.0",
18+
"dotenv": "^16.4.7",
19+
"esrun": "^3.2.26"
20+
}
21+
}

0 commit comments

Comments
 (0)