A test that passes on one laptop proves the logic. A transaction on a public network proves it to everyone. This walkthrough takes two Token-2022 models from the Wen Open Lab out of a local test VM and onto Solana devnet, with a wallet that holds nothing of value. Every step prints a Solana Explorer link, so the result is something you open in a browser, not a screenshot you are asked to trust.
What you need
- Node.js 20 or newer and the Lab's example project (
lab/codein the public repository, Apache-2.0). - The Solana CLI (
solana,solana-keygen). - A new, empty wallet created only for devnet. Never point this script at a key that has ever held real funds.
Five commands
# 1. install the example project
npm install
# 2. create a throwaway devnet wallet (it never holds real money)
solana-keygen new -o devnet-wallet.json --no-bip39-passphrase
# 3. get free devnet SOL (use faucet.solana.com if the CLI is rate-limited)
solana airdrop 2 $(solana-keygen pubkey devnet-wallet.json) --url devnet
# 4. run the local checks first (41 checks in LiteSVM, no network)
npm test
# 5. run the public devnet demo
KEYPAIR=./devnet-wallet.json npm run devnet
Two guards before anything is sent
The script refuses to run anywhere except devnet, and stops if the wallet is short of test SOL:
const endpoint = connection.rpcEndpoint;
if (!/devnet/.test(endpoint)) throw new Error(`Refusing to run outside devnet: ${endpoint}`);
const balance = await connection.getBalance(wallet.publicKey);
if (balance < 0.2 * LAMPORTS_PER_SOL) throw new Error('Need at least 0.2 devnet SOL');

Every transaction goes through one helper that prints its Explorer link:
const link = (kind: 'tx' | 'address', id: string) =>
`https://explorer.solana.com/${kind}/${id}?cluster=devnet`;
async function send(label: string, ixs: TransactionInstruction[], signers: Keypair[]) {
const sig = await sendAndConfirmTransaction(connection, new Transaction().add(...ixs), signers);
console.log(` ${label}\n ${link('tx', sig)}`);
return sig;
}
Model 1: a soulbound receipt
A fresh "buyer" address gets a one-of-one Token-2022 NFT: zero decimals, the order hash, SKU and warranty date stored inside the mint (Metadata Pointer), the NonTransferable extension, and the mint authority removed. This is the same light-NFT layout the Wen New Standard (WNS) put on Token-2022.
Open the receipt mint in Explorer and check: supply is exactly 1, there is no mint authority, the Token Extensions list shows Non-Transferable and Token Metadata, and the extra fields carry order_hash, sku and warranty_until. No personal data is on-chain, only a SHA-256 hash.
Model 3: an invoice-only settlement token
The script then builds a settlement token with three Token-2022 extensions, no custom program:
| Rule | Extension |
|---|---|
| 0.25% fee, capped at 50 units | Transfer Fee Config |
| new accounts start frozen until the issuer approves them | Default Account State |
| the seller's account demands a memo before every incoming transfer | Memo Transfer (on the account) |
It opens a buyer and a seller account, approves both, funds the buyer with 10,000 test units and pays invoice INV-DEVNET-0001: 1,000 units with the memo in the same transaction.
Open the payment in Explorer and check: the memo instruction comes right before the transfer, the log shows the invoice number, and the fee is withheld by the token program itself: the seller receives 997.5 and 2.5 stays withheld (Token-2022 rounds the fee up, so the expected fee must use the same ceiling formula).
The payment that must fail
Last, the script tries to pay without an invoice number:
try {
await send('payment WITHOUT invoice number (must fail)', buildPayInvoice({ ..., invoiceId: null, amount: 1n * unit }), [wallet]);
console.log(' !! unexpected: payment without memo succeeded');
} catch {
console.log(' payment WITHOUT invoice number was rejected, as designed');
}
This one has no Explorer link, and that is the point: the network rejects it at simulation ("No memo in previous instruction"), so no transaction ever lands. One honest limit: the memo rule proves that a memo exists, not that the number is right. Reconcile payments against your own invoice list.
Safety rules
- Devnet coins have no value and cannot be sold. Anyone offering to "sell" devnet SOL is a scam.
- Keep
devnet-wallet.jsonout of every repository and never reuse it on mainnet. - Devnet is sometimes reset or slow. If a step fails, wait and run again: every run starts fresh.
- Example code, not audited. Not financial or legal advice.
Share your run
Independent runs are the best proof there is. Post your links with #100daysofsolana or send them to the community. The first public runs are collected on the Lab's devnet page, next to the script and the local test log: wen-watt.github.io/lab/devnet.html (also in Italian, Chinese and Korean).
Italiano
Da un portafoglio usa e getta ai link dell'Explorer: un'esecuzione su devnet che chiunque può ripetere
Un test superato su un portatile prova la logica. Una transazione su una rete pubblica la prova a tutti. Questa guida porta due modelli Token-2022 del Wen Open Lab fuori da una VM di test locale e sulla devnet di Solana, con un portafoglio che non contiene nulla di valore. Ogni passo stampa un link al Solana Explorer: il risultato si apre in un browser, non è uno screenshot di cui fidarsi.
Cosa ti serve. Node.js 20 o successivo e il progetto di esempio del Lab (lab/code, Apache-2.0); la Solana CLI; un portafoglio nuovo e vuoto creato solo per la devnet. Non usare mai una chiave che abbia contenuto fondi reali.

Cinque comandi (gli stessi del blocco in inglese qui sopra):
npm install
solana-keygen new -o devnet-wallet.json --no-bip39-passphrase
solana airdrop 2 $(solana-keygen pubkey devnet-wallet.json) --url devnet
npm test
KEYPAIR=./devnet-wallet.json npm run devnet
Due protezioni. Lo script si rifiuta di girare fuori dalla devnet e si ferma se il portafoglio ha meno di 0,2 SOL di devnet. Ogni transazione passa da un unico helper che stampa il suo link all'Explorer.
Modello 1: una ricevuta soulbound. Un nuovo indirizzo «acquirente» riceve un NFT Token-2022 unico: zero decimali, hash dell'ordine, SKU e data di garanzia dentro il mint, estensione NonTransferable, autorità di conio rimossa. È lo stesso layout leggero introdotto dal Wen New Standard (WNS). Nell'Explorer controlla: offerta 1, nessuna autorità di conio, estensioni Non-Transferable e Token Metadata, campi order_hash, sku, warranty_until. On-chain c'è solo un hash, nessun dato personale.
Modello 3: un token di regolamento solo con fattura. Tre estensioni Token-2022, nessun programma personalizzato: commissione dello 0,25% con tetto a 50 unità (Transfer Fee Config), account congelati finché l'emittente non li approva (Default Account State), memo obbligatorio sull'account del venditore (Memo Transfer). Lo script apre due account, li approva, finanzia l'acquirente con 10.000 unità di prova e paga la fattura INV-DEVNET-0001: 1.000 unità con il memo nella stessa transazione. Nell'Explorer controlla: il memo è l'istruzione subito prima del trasferimento, il log mostra il numero di fattura, il venditore riceve 997,5 e 2,5 restano trattenuti (Token-2022 arrotonda la commissione per eccesso).
Il pagamento che deve fallire. Infine lo script prova a pagare senza numero di fattura. Non c'è link all'Explorer, ed è proprio questo il punto: la rete lo rifiuta in simulazione («No memo in previous instruction») e nessuna transazione arriva in catena. Limite onesto: la regola prova che un memo esiste, non che il numero sia giusto; riconcilia i pagamenti con le tue fatture.
Regole di sicurezza. Le monete della devnet non hanno valore: chi le «vende» è una truffa. Tieni devnet-wallet.json fuori da ogni repository e non riusarlo mai sulla mainnet. Se la devnet è lenta, aspetta e riesegui. Codice di esempio, non sottoposto ad audit; non è consulenza finanziaria o legale.
Condividi la tua esecuzione con #100daysofsolana: le esecuzioni indipendenti sono la prova migliore. Le prime esecuzioni pubbliche sono raccolte nella pagina devnet del Lab (link qui sopra; c'è anche in italiano).
中文
从一次性钱包到浏览器链接:任何人都能复现的 devnet 运行
在一台笔记本上通过的测试证明了逻辑;公共网络上的交易则向所有人证明。本文把 Wen Open Lab 的两个 Token-2022 模型从本地测试虚拟机搬到 Solana devnet,使用的钱包里没有任何有价值的东西。每一步都会打印 Solana Explorer 链接,结果可以在浏览器中打开,而不是一张要你相信的截图。
你需要: Node.js 20 或更新版本,以及实验室的示例项目(lab/code,Apache-2.0);Solana CLI;一个只为 devnet 创建的全新空钱包。绝不要使用曾经存有真实资金的密钥。
五条命令(与上方英文部分相同):
npm install
solana-keygen new -o devnet-wallet.json --no-bip39-passphrase
solana airdrop 2 $(solana-keygen pubkey devnet-wallet.json) --url devnet
npm test
KEYPAIR=./devnet-wallet.json npm run devnet
两道保护。 脚本拒绝在 devnet 之外运行;钱包里的 devnet SOL 少于 0.2 时会停止。每笔交易都经过同一个辅助函数,并打印对应的浏览器链接。
模型 1:灵魂绑定收据。 一个新的“买家”地址会收到一枚独一无二的 Token-2022 NFT:零位小数,订单哈希、SKU 和保修日期存放在铸币内部,带 NonTransferable 扩展,铸币权限已移除。这正是 Wen New Standard(WNS)引入的轻量 NFT 布局。在浏览器中检查: 供应量为 1、没有铸币权限、扩展列表里有 Non-Transferable 和 Token Metadata、字段包含 order_hash、sku、warranty_until。链上只有哈希,没有个人数据。
模型 3:只认发票的结算代币。 三个 Token-2022 扩展,不需要自定义程序:0.25% 手续费、上限 50 个单位(Transfer Fee Config);新账户初始冻结,直到发行方批准(Default Account State);卖方账户要求备注(Memo Transfer)。脚本开设两个账户并批准,为买家注入 10,000 个测试单位,然后支付发票 INV-DEVNET-0001:1,000 个单位,备注在同一笔交易中。在浏览器中检查: 备注是紧挨在转账之前的指令,日志显示发票号,卖方收到 997.5,2.5 被预扣(Token-2022 对手续费向上取整)。
必须失败的付款。 最后,脚本尝试不带发票号付款。这一笔没有浏览器链接,这正是重点:网络在模拟阶段就拒绝了它("No memo in previous instruction"),交易根本不会上链。诚实的局限:备注规则只证明备注存在,不证明编号正确;请把付款与自己的发票清单对账。
安全规则。 devnet 币没有价值,任何“出售” devnet SOL 的人都是骗子。不要把 devnet-wallet.json 放进任何代码仓库,也绝不要在主网上重复使用。devnet 变慢时,稍等再运行。示例代码,未经审计;不构成金融或法律建议。
分享你的运行,加上 #100daysofsolana:独立运行是最好的证明。首批公开运行汇集在实验室的 devnet 页面(链接见上文,也有中文版)。
한국어
일회용 지갑에서 익스플로러 링크까지: 누구나 반복할 수 있는 devnet 실행
노트북 한 대에서 통과한 테스트는 로직을 증명하고, 공개 네트워크의 트랜잭션은 그것을 모두에게 증명합니다. 이 글은 Wen Open Lab의 Token-2022 모델 두 가지를 로컬 테스트 VM에서 꺼내, 가치 있는 것이 하나도 없는 지갑으로 Solana devnet에 올립니다. 단계마다 Solana Explorer 링크가 출력되므로, 결과는 믿어 달라는 스크린샷이 아니라 브라우저로 여는 것입니다.
필요한 것: Node.js 20 이상과 랩의 예제 프로젝트(lab/code, Apache-2.0), Solana CLI, 그리고 devnet 전용으로 새로 만든 빈 지갑. 실제 자금을 한 번이라도 담았던 키는 절대 쓰지 마세요.
명령 다섯 개(위 영어 부분과 같습니다):
npm install
solana-keygen new -o devnet-wallet.json --no-bip39-passphrase
solana airdrop 2 $(solana-keygen pubkey devnet-wallet.json) --url devnet
npm test
KEYPAIR=./devnet-wallet.json npm run devnet
두 가지 보호 장치. 스크립트는 devnet 밖에서는 실행을 거부하고, 지갑의 devnet SOL이 0.2보다 적으면 멈춥니다. 모든 트랜잭션은 익스플로러 링크를 출력하는 헬퍼 하나를 거칩니다.
모델 1: 소울바운드 영수증. 새 "구매자" 주소가 하나뿐인 Token-2022 NFT를 받습니다. 소수점 0자리, 주문 해시·SKU·보증 날짜는 민트 안에, NonTransferable 확장, 민트 권한 제거. Wen New Standard(WNS)가 도입한 가벼운 NFT 구조 그대로입니다. 익스플로러에서 확인: 공급량 1, 민트 권한 없음, 확장 목록에 Non-Transferable과 Token Metadata, 필드에 order_hash, sku, warranty_until. 체인에는 해시만 있고 개인 정보는 없습니다.
모델 3: 인보이스 전용 정산 토큰. 맞춤 프로그램 없이 Token-2022 확장 세 가지: 0.25% 수수료, 상한 50단위(Transfer Fee Config), 발행자가 승인할 때까지 동결된 새 계정(Default Account State), 판매자 계정의 필수 메모(Memo Transfer). 스크립트는 계정 두 개를 열고 승인한 뒤 구매자에게 테스트 단위 10,000을 넣고, 인보이스 INV-DEVNET-0001을 지급합니다. 1,000단위, 같은 트랜잭션 안의 메모와 함께. 익스플로러에서 확인: 메모가 전송 바로 앞의 명령이고, 로그에 인보이스 번호가 보이며, 판매자는 997.5를 받고 2.5는 원천 징수됩니다(Token-2022는 수수료를 올림합니다).
실패해야 하는 결제. 마지막으로 스크립트는 인보이스 번호 없이 결제를 시도합니다. 여기에는 익스플로러 링크가 없고, 바로 그것이 핵심입니다. 네트워크가 시뮬레이션 단계에서 거부하므로("No memo in previous instruction") 트랜잭션은 체인에 오르지 않습니다. 정직한 한계: 메모 규칙은 메모가 있다는 것만 증명하고 번호가 맞는지는 증명하지 않습니다. 결제는 내 인보이스 목록과 대조하세요.
안전 규칙. devnet 코인은 가치가 없습니다. devnet SOL을 "판다"는 사람은 사기입니다. devnet-wallet.json은 어떤 저장소에도 넣지 말고 메인넷에서 재사용하지 마세요. devnet이 느리면 기다렸다가 다시 실행하세요. 감사받지 않은 예제 코드이며, 금융·법률 조언이 아닙니다.
내 실행을 공유하세요. #100daysofsolana와 함께. 독립적인 실행이 가장 좋은 증거입니다. 첫 공개 실행은 랩의 devnet 페이지에 모입니다(위 링크, 한국어판도 있습니다).



Top comments (0)