neozipkit 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +410 -186
- package/contracts/ABI.txt +889 -0
- package/contracts/Bytecode.txt +1 -0
- package/contracts/COMPILATION_NOTES.md +59 -0
- package/contracts/QUICK_DEPLOY.md +286 -0
- package/contracts/README.md +235 -131
- package/contracts/VERIFICATION.md +308 -0
- package/contracts/deploy-interactive.js +448 -0
- package/contracts/deployment-arbitrum-sepolia.json +12 -0
- package/contracts/deployment-arbitrum.json +12 -0
- package/contracts/deployment-eth-sepolia.json +12 -0
- package/contracts/hardhat.config.js +114 -0
- package/contracts/package.json +20 -0
- package/contracts/scripts/compile-and-extract.js +119 -0
- package/contracts/scripts/verify-contract.js +223 -0
- package/contracts/src/{NZIP-NFT-Private.sol → NZIP-NFT-v2.0.sol} +66 -151
- package/contracts/src/NZIP-NFT.sol +9 -15
- package/dist/blockchain/browser/TokenVerifierBrowser.d.ts +67 -0
- package/dist/blockchain/browser/TokenVerifierBrowser.d.ts.map +1 -0
- package/dist/blockchain/browser/TokenVerifierBrowser.js +313 -0
- package/dist/blockchain/browser/TokenVerifierBrowser.js.map +1 -0
- package/dist/blockchain/browser/WalletManagerBrowser.d.ts +98 -0
- package/dist/blockchain/browser/WalletManagerBrowser.d.ts.map +1 -0
- package/dist/blockchain/browser/WalletManagerBrowser.js +434 -0
- package/dist/blockchain/browser/WalletManagerBrowser.js.map +1 -0
- package/dist/blockchain/browser/ZipkitMinterBrowser.d.ts +58 -0
- package/dist/blockchain/browser/ZipkitMinterBrowser.d.ts.map +1 -0
- package/dist/blockchain/browser/ZipkitMinterBrowser.js +317 -0
- package/dist/blockchain/browser/ZipkitMinterBrowser.js.map +1 -0
- package/dist/blockchain/browser/index.d.ts +11 -0
- package/dist/blockchain/browser/index.d.ts.map +1 -0
- package/dist/blockchain/browser/index.js +16 -0
- package/dist/blockchain/browser/index.js.map +1 -0
- package/dist/blockchain/core/WalletManager.d.ts +124 -0
- package/dist/blockchain/core/WalletManager.d.ts.map +1 -0
- package/dist/blockchain/{ZipKitWallet.js → core/WalletManager.js} +157 -177
- package/dist/blockchain/core/WalletManager.js.map +1 -0
- package/dist/blockchain/{ZipKitMinter.d.ts → core/ZipkitMinter.d.ts} +46 -11
- package/dist/blockchain/core/ZipkitMinter.d.ts.map +1 -0
- package/dist/blockchain/core/ZipkitMinter.js +548 -0
- package/dist/blockchain/core/ZipkitMinter.js.map +1 -0
- package/dist/blockchain/{ZipKitOTS.d.ts → core/ZipkitOTS.d.ts} +6 -15
- package/dist/blockchain/core/ZipkitOTS.d.ts.map +1 -0
- package/dist/blockchain/{ZipKitOTS.js → core/ZipkitOTS.js} +26 -84
- package/dist/blockchain/core/ZipkitOTS.js.map +1 -0
- package/dist/blockchain/core/ZipkitVerifier.d.ts +177 -0
- package/dist/blockchain/core/ZipkitVerifier.d.ts.map +1 -0
- package/dist/blockchain/core/ZipkitVerifier.js +632 -0
- package/dist/blockchain/core/ZipkitVerifier.js.map +1 -0
- package/dist/blockchain/core/contracts.d.ts +83 -0
- package/dist/blockchain/core/contracts.d.ts.map +1 -0
- package/dist/blockchain/core/contracts.js +341 -0
- package/dist/blockchain/core/contracts.js.map +1 -0
- package/dist/blockchain/core/index.d.ts +12 -0
- package/dist/blockchain/core/index.d.ts.map +1 -0
- package/dist/blockchain/core/index.js +59 -0
- package/dist/blockchain/core/index.js.map +1 -0
- package/dist/blockchain/index.d.ts +11 -7
- package/dist/blockchain/index.d.ts.map +1 -0
- package/dist/blockchain/index.js +18 -34
- package/dist/blockchain/index.js.map +1 -0
- package/dist/blockchain/node/WalletManagerNode.d.ts +47 -0
- package/dist/blockchain/node/WalletManagerNode.d.ts.map +1 -0
- package/dist/blockchain/node/WalletManagerNode.js +203 -0
- package/dist/blockchain/node/WalletManagerNode.js.map +1 -0
- package/dist/blockchain/node/index.d.ts +12 -0
- package/dist/blockchain/node/index.d.ts.map +1 -0
- package/dist/blockchain/node/index.js +24 -0
- package/dist/blockchain/node/index.js.map +1 -0
- package/dist/browser/ZipkitBrowser.d.ts +27 -0
- package/dist/browser/ZipkitBrowser.d.ts.map +1 -0
- package/dist/browser/{ZipKitBrowser.js → ZipkitBrowser.js} +96 -43
- package/dist/browser/ZipkitBrowser.js.map +1 -0
- package/dist/browser/index.d.ts +12 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +42 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser-esm/index.d.ts +12 -0
- package/dist/browser-esm/index.js +59559 -0
- package/dist/browser-esm/index.js.map +7 -0
- package/dist/browser-umd/index.d.ts +12 -0
- package/dist/browser-umd/index.js +59576 -0
- package/dist/browser-umd/index.js.map +7 -0
- package/dist/browser-umd/index.min.js +63 -0
- package/dist/browser.d.ts +8 -14
- package/dist/browser.js +13 -28
- package/dist/core/ZipCompress.d.ts +99 -0
- package/dist/core/ZipCompress.d.ts.map +1 -0
- package/dist/core/ZipCompress.js +309 -0
- package/dist/core/ZipCompress.js.map +1 -0
- package/dist/core/ZipDecompress.d.ts +58 -0
- package/dist/core/ZipDecompress.d.ts.map +1 -0
- package/dist/core/ZipDecompress.js +172 -0
- package/dist/core/ZipDecompress.js.map +1 -0
- package/dist/{shared → core}/ZipEntry.d.ts +8 -1
- package/dist/core/ZipEntry.d.ts.map +1 -0
- package/dist/{shared → core}/ZipEntry.js +225 -82
- package/dist/core/ZipEntry.js.map +1 -0
- package/dist/core/Zipkit.d.ts +315 -0
- package/dist/core/Zipkit.d.ts.map +1 -0
- package/dist/core/Zipkit.js +647 -0
- package/dist/core/Zipkit.js.map +1 -0
- package/dist/core/components/HashCalculator.d.ts +138 -0
- package/dist/core/components/HashCalculator.d.ts.map +1 -0
- package/dist/core/components/HashCalculator.js +360 -0
- package/dist/core/components/HashCalculator.js.map +1 -0
- package/dist/core/components/Logger.d.ts +73 -0
- package/dist/core/components/Logger.d.ts.map +1 -0
- package/dist/core/components/Logger.js +156 -0
- package/dist/core/components/Logger.js.map +1 -0
- package/dist/core/components/ProgressTracker.d.ts +43 -0
- package/dist/core/components/ProgressTracker.d.ts.map +1 -0
- package/dist/core/components/ProgressTracker.js +112 -0
- package/dist/core/components/ProgressTracker.js.map +1 -0
- package/dist/{shared → core}/components/Support.d.ts +1 -0
- package/dist/core/components/Support.d.ts.map +1 -0
- package/dist/{shared → core}/components/Support.js +1 -0
- package/dist/core/components/Support.js.map +1 -0
- package/dist/{shared → core}/components/Util.d.ts +7 -2
- package/dist/core/components/Util.d.ts.map +1 -0
- package/dist/{shared → core}/components/Util.js +14 -34
- package/dist/core/components/Util.js.map +1 -0
- package/dist/{shared → core}/constants/Errors.d.ts +1 -2
- package/dist/core/constants/Errors.d.ts.map +1 -0
- package/dist/{shared → core}/constants/Errors.js +1 -3
- package/dist/core/constants/Errors.js.map +1 -0
- package/dist/{shared → core}/constants/Headers.d.ts +3 -0
- package/dist/core/constants/Headers.d.ts.map +1 -0
- package/dist/{shared → core}/constants/Headers.js +20 -17
- package/dist/core/constants/Headers.js.map +1 -0
- package/dist/core/encryption/Manager.d.ts +58 -0
- package/dist/core/encryption/Manager.d.ts.map +1 -0
- package/dist/core/encryption/Manager.js +121 -0
- package/dist/core/encryption/Manager.js.map +1 -0
- package/dist/core/encryption/ZipCrypto.d.ts +172 -0
- package/dist/core/encryption/ZipCrypto.d.ts.map +1 -0
- package/dist/core/encryption/ZipCrypto.js +554 -0
- package/dist/core/encryption/ZipCrypto.js.map +1 -0
- package/dist/core/encryption/index.d.ts +9 -0
- package/dist/core/encryption/index.d.ts.map +1 -0
- package/dist/core/encryption/index.js +17 -0
- package/dist/core/encryption/index.js.map +1 -0
- package/dist/core/encryption/types.d.ts +29 -0
- package/dist/core/encryption/types.d.ts.map +1 -0
- package/dist/core/encryption/types.js +12 -0
- package/dist/core/encryption/types.js.map +1 -0
- package/dist/core/index.d.ts +24 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +57 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/version.d.ts +5 -0
- package/dist/core/version.d.ts.map +1 -0
- package/dist/core/version.js +31 -0
- package/dist/core/version.js.map +1 -0
- package/dist/index.d.ts +8 -18
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -35
- package/dist/index.js.map +1 -0
- package/dist/node/ZipCompressNode.d.ts +123 -0
- package/dist/node/ZipCompressNode.d.ts.map +1 -0
- package/dist/node/ZipCompressNode.js +576 -0
- package/dist/node/ZipCompressNode.js.map +1 -0
- package/dist/node/ZipDecompressNode.d.ts +120 -0
- package/dist/node/ZipDecompressNode.d.ts.map +1 -0
- package/dist/node/ZipDecompressNode.js +461 -0
- package/dist/node/ZipDecompressNode.js.map +1 -0
- package/dist/node/ZipkitNode.d.ts +406 -0
- package/dist/node/ZipkitNode.d.ts.map +1 -0
- package/dist/node/ZipkitNode.js +1305 -0
- package/dist/node/ZipkitNode.js.map +1 -0
- package/dist/node/index.d.ts +26 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +65 -0
- package/dist/node/index.js.map +1 -0
- package/dist/types/index.d.ts +59 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +36 -1
- package/dist/types/index.js.map +1 -0
- package/examples/README.md +269 -0
- package/examples/blockchain-tokenize.ts +354 -0
- package/examples/create-zip.ts +172 -0
- package/examples/extract-zip.ts +158 -0
- package/examples/list-zip.ts +161 -0
- package/examples/test-files/data.json +116 -0
- package/examples/test-files/document.md +80 -0
- package/examples/test-files/document.txt +2 -0
- package/examples/test-files/file1.txt +48 -0
- package/examples/test-files/file2.txt +80 -0
- package/examples/tsconfig.json +44 -0
- package/examples/unzip-token.ts +491 -0
- package/examples/verify-tokenized-zip.ts +305 -0
- package/examples/zip-token.ts +604 -0
- package/package.json +108 -24
- package/src/blockchain/README.md +59 -66
- package/src/{browser/TokenVerifierBrowser.ts-remove → blockchain/browser/TokenVerifierBrowser.ts} +125 -79
- package/src/blockchain/browser/WalletManagerBrowser.ts +486 -0
- package/src/blockchain/browser/ZipkitMinterBrowser.ts +400 -0
- package/src/blockchain/browser/index.ts +13 -0
- package/src/blockchain/{ZipKitWallet.ts → core/WalletManager.ts} +241 -143
- package/src/blockchain/core/ZipkitMinter.ts +716 -0
- package/src/blockchain/{ZipKitOTS.ts → core/ZipkitOTS.ts} +28 -62
- package/src/blockchain/core/ZipkitVerifier.ts +853 -0
- package/src/blockchain/core/contracts.ts +370 -0
- package/src/blockchain/core/index.ts +71 -0
- package/src/blockchain/index.ts +21 -55
- package/src/blockchain/node/WalletManagerNode.ts +171 -0
- package/src/blockchain/node/index.ts +40 -0
- package/src/browser/{ZipKitBrowser.ts → ZipkitBrowser.ts} +104 -41
- package/src/browser/index.esm.ts +37 -0
- package/src/browser/index.ts +25 -0
- package/src/core/ZipCompress.ts +398 -0
- package/src/core/ZipDecompress.ts +212 -0
- package/src/{shared → core}/ZipEntry.ts +240 -90
- package/src/core/Zipkit.ts +794 -0
- package/src/core/components/HashCalculator.ts +384 -0
- package/src/core/components/Logger.ts +180 -0
- package/src/core/components/ProgressTracker.ts +134 -0
- package/src/{shared → core}/components/Util.ts +12 -34
- package/src/{shared → core}/constants/Errors.ts +0 -4
- package/src/{shared → core}/constants/Headers.ts +19 -17
- package/src/core/encryption/Manager.ts +137 -0
- package/src/core/encryption/ZipCrypto.ts +650 -0
- package/src/core/encryption/index.ts +15 -0
- package/src/core/encryption/types.ts +33 -0
- package/src/core/index.ts +34 -0
- package/src/core/version.ts +33 -0
- package/src/index.ts +54 -25
- package/src/node/ZipCompressNode.ts +632 -0
- package/src/node/ZipDecompressNode.ts +508 -0
- package/src/node/ZipkitNode.ts +1559 -0
- package/src/node/index.ts +69 -0
- package/src/types/index.ts +131 -1
- package/src/types/modules.d.ts +1 -11
- package/src/types/opentimestamps.d.ts +1 -23
- package/contracts/INTEGRATION.md +0 -338
- package/contracts/NETWORKS.md +0 -156
- package/contracts/NZIP-NFT-bytecode.txt +0 -1
- package/contracts/constants.ts +0 -952
- package/contracts/deploy-bytecode.mjs +0 -94
- package/dist/blockchain/CertificateToken.d.ts +0 -48
- package/dist/blockchain/CertificateToken.js +0 -386
- package/dist/blockchain/ZipKitMinter.js +0 -347
- package/dist/blockchain/ZipKitNFT.d.ts +0 -3
- package/dist/blockchain/ZipKitNFT.js +0 -7
- package/dist/blockchain/ZipKitVerifier.d.ts +0 -69
- package/dist/blockchain/ZipKitVerifier.js +0 -289
- package/dist/blockchain/ZipKitWallet.d.ts +0 -69
- package/dist/blockchain/contracts.d.ts +0 -14
- package/dist/blockchain/contracts.js +0 -77
- package/dist/blockchain/types.d.ts +0 -47
- package/dist/blockchain/types.js +0 -30
- package/dist/browser/ZipKitBrowser.d.ts +0 -18
- package/dist/browser/ZipKitStampBrowser.d.ts +0 -2
- package/dist/browser/ZipKitStampBrowser.js +0 -12
- package/dist/browser-index.d.ts +0 -18
- package/dist/browser-index.js +0 -57
- package/dist/server/ZipKitServer.d.ts +0 -74
- package/dist/server/ZipKitServer.js +0 -310
- package/dist/shared/ZipKit.d.ts +0 -243
- package/dist/shared/ZipKit.js +0 -772
- package/dist/shared/components/CertificateOTS.d.ts +0 -15
- package/dist/shared/components/CertificateOTS.js +0 -116
- package/dist/shared/components/FileSys.d.ts +0 -2
- package/dist/shared/components/FileSys.js +0 -113
- package/dist/shared/components/HashAccumulator.d.ts +0 -55
- package/dist/shared/components/HashAccumulator.js +0 -100
- package/dist/shared/components/ZipCrypto.d.ts +0 -3
- package/dist/shared/components/ZipCrypto.js +0 -78
- package/dist/shared/components/merkleTree.d.ts +0 -66
- package/dist/shared/components/merkleTree.js +0 -136
- package/dist/shared/types/index.d.ts +0 -21
- package/dist/shared/types/index.js +0 -3
- package/dist/shared/types.d.ts +0 -33
- package/dist/shared/types.js +0 -8
- package/dist/shared/version.d.ts +0 -2
- package/dist/shared/version.js +0 -6
- package/src/blockchain/CertificateToken.ts +0 -444
- package/src/blockchain/ZipKitMinter.ts +0 -470
- package/src/blockchain/ZipKitNFT.ts +0 -12
- package/src/blockchain/ZipKitVerifier.ts +0 -382
- package/src/blockchain/contracts.ts +0 -88
- package/src/blockchain/types.ts +0 -91
- package/src/browser/CertificateGeneratorBrowser.ts-remove +0 -498
- package/src/browser/ZipKitStampBrowser.ts +0 -9
- package/src/browser-index.ts +0 -36
- package/src/server/README.md +0 -25
- package/src/server/ZipKitServer.ts +0 -305
- package/src/shared/ZipKit.ts +0 -881
- package/src/shared/components/CertificateOTS.ts +0 -132
- package/src/shared/components/FileSys.ts +0 -87
- package/src/shared/components/HashAccumulator.ts +0 -113
- package/src/shared/components/ZipCrypto.ts +0 -91
- package/src/shared/components/merkleTree.ts +0 -162
- package/src/shared/types/index.ts +0 -25
- package/src/shared/types/modules.d.ts +0 -22
- package/src/shared/types/opentimestamps.d.ts +0 -23
- package/src/shared/types.d.ts +0 -8
- package/src/shared/types.ts +0 -43
- package/src/shared/version.ts +0 -3
- /package/src/{shared → core}/components/Support.ts +0 -0
package/contracts/README.md
CHANGED
|
@@ -1,152 +1,256 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Smart Contracts
|
|
2
2
|
|
|
3
|
-
This directory contains
|
|
3
|
+
This directory contains the smart contracts and related data for the NeoZipKit library.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Contract Files
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
- **Symbol**: `NZIP`
|
|
7
|
+
- **`src/NZIP-NFT.sol`** - Main production contract for ZIP file tokenization
|
|
8
|
+
- **`src/NZIP-NFT-v2.0.sol`** - Version 2.0 contract implementation
|
|
9
|
+
- **`ABI.txt`** - Contract ABI (Application Binary Interface)
|
|
10
|
+
- **`Bytecode.txt`** - Contract bytecode for deployment
|
|
12
11
|
|
|
13
|
-
##
|
|
12
|
+
## Contract Information
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
### Current Production Contract
|
|
15
|
+
- **Address**: `0x6313074922717351986929879903441992482216`
|
|
16
|
+
- **Network**: Base Sepolia (Chain ID: 84532)
|
|
17
|
+
- **Version**: 2.10.0
|
|
18
|
+
- **Status**: ✅ Active
|
|
19
|
+
|
|
20
|
+
### Contract Features
|
|
21
|
+
- ZIP file tokenization as ERC-721 NFTs
|
|
22
|
+
- Merkle root verification for file integrity
|
|
23
|
+
- Duplicate prevention via composite key system
|
|
24
|
+
- Blockchain metadata storage
|
|
25
|
+
- Universal verification (anyone can verify tokens)
|
|
26
|
+
|
|
27
|
+
## Compilation and Deployment
|
|
28
|
+
|
|
29
|
+
### Compiling the Contract
|
|
30
|
+
|
|
31
|
+
To compile the contract and generate compiled ABI and bytecode:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
cd contracts
|
|
35
|
+
yarn install # First time only
|
|
36
|
+
yarn compile:extract # Compile and extract ABI/bytecode
|
|
22
37
|
```
|
|
23
38
|
|
|
24
|
-
|
|
39
|
+
This will:
|
|
40
|
+
- Compile `src/NZIP-NFT.sol` using Hardhat
|
|
41
|
+
- Extract the ABI and write it to `ABI-compiled.txt`
|
|
42
|
+
- Extract the bytecode and write it to `Bytecode-compiled.txt`
|
|
25
43
|
|
|
26
|
-
|
|
27
|
-
- **Blockchain Verification**: Verify ZIP file authenticity against blockchain tokens
|
|
28
|
-
- **OpenTimestamps**: Bitcoin blockchain timestamping for file integrity
|
|
29
|
-
- **Multi-Network Support**: Base Mainnet, Base Sepolia, Ethereum, Polygon, Arbitrum
|
|
30
|
-
- **Smart Contracts**: Production-ready contracts for public and private tokenization
|
|
44
|
+
**⚠️ IMPORTANT:** The compilation script does NOT overwrite `ABI.txt` and `Bytecode.txt` (these are the deployed versions). The compiled files are written to `ABI-compiled.txt` and `Bytecode-compiled.txt` for review. Only manually copy them to `ABI.txt` and `Bytecode.txt` if you want to use the new compilation for deployment.
|
|
31
45
|
|
|
32
|
-
|
|
46
|
+
### Deploying the Contract
|
|
33
47
|
|
|
34
|
-
|
|
35
|
-
- **`NFTMinter`** - Mint NFTs for ZIP files
|
|
36
|
-
- **`TokenQuerier`** - Query token information from blockchain
|
|
37
|
-
- **`CertificateToken`** - Generate certificates for tokenized files
|
|
38
|
-
- **`ZipTokenProcessor`** - Process ZIP files for tokenization
|
|
39
|
-
- **`WalletManager`** - Manage wallet connections and networks
|
|
48
|
+
**SECURITY WARNING**: Contract deployment requires a private key with sufficient funds for gas fees.
|
|
40
49
|
|
|
41
|
-
|
|
50
|
+
- ⚠️ **NEVER** hardcode private keys in deployment scripts
|
|
51
|
+
- ⚠️ **NEVER** commit private keys to version control
|
|
52
|
+
- ✅ Use environment variables or interactive prompts for private keys
|
|
53
|
+
- ✅ Use testnet keys for development/testing
|
|
54
|
+
- ✅ Use secure key management (HSMs, KMS) for production deployments
|
|
55
|
+
- ✅ Verify network selection before deployment (especially for mainnet)
|
|
42
56
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
│ ├── NZIP-NFT.sol # Main tokenization contract
|
|
47
|
-
│ ├── NZIP-NFT-Private.sol # Private tokenization contract
|
|
48
|
-
│ └── *.sol # Legacy and deprecated contracts
|
|
49
|
-
├── constants.ts # Contract addresses and deployment info
|
|
50
|
-
└── *.md # Documentation files
|
|
51
|
-
```
|
|
57
|
+
For complete security guidelines, see [../SECURITY.md](../SECURITY.md).
|
|
58
|
+
|
|
59
|
+
Deploy to any supported network using the interactive deployment script:
|
|
52
60
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
- Open [Remix IDE](https://remix.ethereum.org/)
|
|
57
|
-
- Upload contract files from `src/` directory
|
|
58
|
-
- Compile and deploy using Remix
|
|
59
|
-
|
|
60
|
-
2. **Integrate with your application**:
|
|
61
|
-
```typescript
|
|
62
|
-
import { ZipTokenProcessor, MintingOptions } from 'neozipkit/server/blockchain';
|
|
63
|
-
|
|
64
|
-
const options: MintingOptions = {
|
|
65
|
-
wallet: 'path/to/wallet.json',
|
|
66
|
-
network: 'base-sepolia',
|
|
67
|
-
mintToken: true
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const processor = new ZipTokenProcessor('archive.zip', 'merkle_root_hash', options);
|
|
71
|
-
const result = await processor.processZipToken(options);
|
|
72
|
-
|
|
73
|
-
if (result.error) {
|
|
74
|
-
console.error('Processing failed:', result.error);
|
|
75
|
-
} else {
|
|
76
|
-
console.log('Success!', result);
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
3. **Command-line deployment scripts**
|
|
80
|
-
|
|
81
|
-
- Base Mainnet
|
|
82
|
-
```bash
|
|
83
|
-
cd /Users/stevenburg/Projects/NeoWare/neozipkit
|
|
84
|
-
export PRIVATE_KEY=0xYOUR_DEPLOYER_PRIVATE_KEY
|
|
85
|
-
export BASE_RPC_URL=https://mainnet.base.org
|
|
86
|
-
node contracts/deploy-bytecode.mjs
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
- Base Sepolia
|
|
90
|
-
```bash
|
|
91
|
-
cd /Users/stevenburg/Projects/NeoWare/neozipkit
|
|
92
|
-
export PRIVATE_KEY=0xYOUR_DEPLOYER_PRIVATE_KEY
|
|
93
|
-
export NETWORK=base-sepolia
|
|
94
|
-
export BASE_RPC_URL=https://sepolia.base.org
|
|
95
|
-
node contracts/deploy-bytecode.mjs
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
- Ethereum Mainnet
|
|
99
|
-
```bash
|
|
100
|
-
cd /Users/stevenburg/Projects/NeoWare/neozipkit
|
|
101
|
-
export PRIVATE_KEY=0xYOUR_DEPLOYER_PRIVATE_KEY
|
|
102
|
-
export NETWORK=eth
|
|
103
|
-
export ETH_RPC_URL=https://mainnet.infura.io/v3/YOUR_KEY
|
|
104
|
-
node contracts/deploy-bytecode.mjs
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
## 📦 Contract Constants and ABI
|
|
108
|
-
|
|
109
|
-
Contract addresses and deployment info are in `contracts/constants.ts`, while the ABI is in `src/blockchain/abi.ts`.
|
|
110
|
-
|
|
111
|
-
**Contract Constants** (`contracts/constants.ts`):
|
|
112
|
-
- `CONTRACT_ADDRESSES`: ChainId → address map (`NZIP_NFT` group)
|
|
113
|
-
- `DEPRECATED_CONTRACTS`: Historical addresses
|
|
114
|
-
- `CURRENT_DEPLOYMENT`: Current network, chainId, address, and tx/explorer info
|
|
115
|
-
|
|
116
|
-
**Contract ABI** (`src/blockchain/abi.ts`):
|
|
117
|
-
- `NZIP_CONTRACT_ABI`: Full contract ABI for integration
|
|
118
|
-
|
|
119
|
-
Example usage:
|
|
120
|
-
```ts
|
|
121
|
-
// For deployment scripts and contract management
|
|
122
|
-
import { CONTRACT_ADDRESSES, CURRENT_DEPLOYMENT } from '../contracts/constants';
|
|
123
|
-
|
|
124
|
-
// For application integration
|
|
125
|
-
import { NZIP_CONTRACT_ABI } from 'neozipkit/blockchain/abi';
|
|
126
|
-
import { CONTRACT_ADDRESSES } from 'neozipkit/blockchain/constants';
|
|
127
|
-
|
|
128
|
-
const baseSepolia = CONTRACT_ADDRESSES.NZIP_NFT[84532];
|
|
129
|
-
console.log('Base Sepolia NZIP‑NFT:', baseSepolia);
|
|
130
|
-
console.log('ABI functions:', NZIP_CONTRACT_ABI.map((f: any) => f.name).filter(Boolean));
|
|
61
|
+
```bash
|
|
62
|
+
cd contracts
|
|
63
|
+
node deploy-interactive.js
|
|
131
64
|
```
|
|
132
65
|
|
|
133
|
-
|
|
66
|
+
The script will prompt you for:
|
|
67
|
+
- Private key (not saved, entered securely)
|
|
68
|
+
- Network selection (ETH, ETH Sepolia, Base, Base Sepolia, Arbitrum, Arbitrum Sepolia, Polygon, Polygon Sepolia)
|
|
69
|
+
- Confirmation before deployment
|
|
134
70
|
|
|
135
|
-
|
|
71
|
+
**Note**: The interactive deployment script does not save your private key. It is only used during the deployment process and never stored.
|
|
136
72
|
|
|
137
|
-
|
|
138
|
-
- **Network Security**: Use secure RPC endpoints and validate all inputs
|
|
139
|
-
- **Smart Contract Audits**: Audit contracts before production deployment
|
|
140
|
-
- **Error Handling**: Implement comprehensive error handling for all operations
|
|
141
|
-
- **Type Safety**: Leverage TypeScript for compile-time error detection
|
|
73
|
+
### Verifying the Contract
|
|
142
74
|
|
|
143
|
-
|
|
75
|
+
After deployment, verify the contract on the blockchain scanner:
|
|
144
76
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
77
|
+
```bash
|
|
78
|
+
cd contracts
|
|
79
|
+
yarn verify <contractAddress> <network>
|
|
80
|
+
```
|
|
148
81
|
|
|
149
|
-
|
|
82
|
+
Example:
|
|
83
|
+
```bash
|
|
84
|
+
yarn verify 0x2716c4609fD97DaEdF429BC4B4Ec2faa81e2cC60 arbitrumSepolia
|
|
85
|
+
```
|
|
150
86
|
|
|
151
|
-
|
|
152
|
-
|
|
87
|
+
For detailed verification instructions, see [VERIFICATION.md](./VERIFICATION.md).
|
|
88
|
+
|
|
89
|
+
## Integration
|
|
90
|
+
|
|
91
|
+
The contract ABI and bytecode are automatically imported by the NeoZipKit library for blockchain operations. No manual configuration is required for basic usage.
|
|
92
|
+
|
|
93
|
+
For advanced deployment and configuration, refer to the main project documentation.
|
|
94
|
+
|
|
95
|
+
## Testnet Faucets
|
|
96
|
+
|
|
97
|
+
**Testnets are recommended for early release versions of NeoZipKit.** Testnet tokens have no real-world value and are intended solely for development and testing purposes. Before requesting tokens, ensure your wallet is configured to connect to the appropriate testnet network. Most faucets have daily limits and rate restrictions to prevent abuse.
|
|
98
|
+
|
|
99
|
+
### Ethereum Sepolia
|
|
100
|
+
|
|
101
|
+
Ethereum Sepolia is the primary Ethereum testnet. **Note:** Sepolia testnet has been experiencing instability since the Pectra upgrade (March 2025), including transaction processing failures and RPC timeouts. Consider using Base Sepolia for more reliable testing.
|
|
102
|
+
|
|
103
|
+
#### Alchemy Faucet
|
|
104
|
+
- **URL**: https://sepoliafaucet.com/
|
|
105
|
+
- **Daily Limit**: Up to 0.5 Sepolia ETH per day
|
|
106
|
+
- **Requirements**:
|
|
107
|
+
- Alchemy account (free registration)
|
|
108
|
+
- Sign in required
|
|
109
|
+
- **Steps**:
|
|
110
|
+
1. Visit https://sepoliafaucet.com/
|
|
111
|
+
2. Sign in with your Alchemy account (create one if needed)
|
|
112
|
+
3. Enter your Ethereum wallet address
|
|
113
|
+
4. Click "Send Me ETH"
|
|
114
|
+
5. Wait for tokens to arrive (usually within minutes)
|
|
115
|
+
|
|
116
|
+
#### Chainlink Faucet
|
|
117
|
+
- **URL**: https://faucets.chain.link/sepolia
|
|
118
|
+
- **Daily Limit**: 0.5 ETH per request
|
|
119
|
+
- **Requirements**:
|
|
120
|
+
- Wallet connection (MetaMask, WalletConnect, etc.)
|
|
121
|
+
- **Steps**:
|
|
122
|
+
1. Visit https://faucets.chain.link/sepolia
|
|
123
|
+
2. Connect your wallet
|
|
124
|
+
3. Ensure your wallet is set to Sepolia network
|
|
125
|
+
4. Select "0.5 ETH" from the token options
|
|
126
|
+
5. Click "Drip" to receive tokens
|
|
127
|
+
|
|
128
|
+
#### QuickNode Faucet
|
|
129
|
+
- **URL**: https://faucet.quicknode.com/ethereum/sepolia
|
|
130
|
+
- **Daily Limit**: 0.01 ETH per 24 hours
|
|
131
|
+
- **Requirements**:
|
|
132
|
+
- MetaMask wallet
|
|
133
|
+
- Optional: Share a tweet about QuickNode to double your daily limit
|
|
134
|
+
- **Steps**:
|
|
135
|
+
1. Visit https://faucet.quicknode.com/ethereum/sepolia
|
|
136
|
+
2. Connect your MetaMask wallet
|
|
137
|
+
3. Ensure MetaMask is configured for Sepolia network (Chain ID: 11155111)
|
|
138
|
+
4. Optionally share a tweet to increase your limit
|
|
139
|
+
5. Click "Send Me ETH"
|
|
140
|
+
|
|
141
|
+
#### Stakely Faucet
|
|
142
|
+
- **URL**: https://stakely.io/faucet/ethereum-sepolia-testnet-eth
|
|
143
|
+
- **Daily Limit**: 0.5 ETH per request
|
|
144
|
+
- **Requirements**:
|
|
145
|
+
- Twitter account
|
|
146
|
+
- Public tweet with request ID
|
|
147
|
+
- **Steps**:
|
|
148
|
+
1. Visit https://stakely.io/faucet/ethereum-sepolia-testnet-eth
|
|
149
|
+
2. Enter your Ethereum Sepolia wallet address
|
|
150
|
+
3. Complete the captcha verification
|
|
151
|
+
4. Copy the provided request ID
|
|
152
|
+
5. Share a public tweet containing the request ID
|
|
153
|
+
6. Wait for processing and token delivery
|
|
154
|
+
|
|
155
|
+
#### Tatum Faucet
|
|
156
|
+
- **URL**: https://tatum.io/faucets/sepolia
|
|
157
|
+
- **Daily Limit**: 0.002 Sepolia ETH every 24 hours
|
|
158
|
+
- **Requirements**:
|
|
159
|
+
- Tatum account (free registration)
|
|
160
|
+
- Minimum 0.001 ETH in your mainnet wallet (for verification)
|
|
161
|
+
- **Steps**:
|
|
162
|
+
1. Visit https://tatum.io/faucets/sepolia
|
|
163
|
+
2. Sign up for a Tatum Dashboard account
|
|
164
|
+
3. Ensure your mainnet wallet has at least 0.001 ETH
|
|
165
|
+
4. Enter your Sepolia wallet address
|
|
166
|
+
5. Request tokens (available once every 24 hours)
|
|
167
|
+
|
|
168
|
+
### Base Sepolia
|
|
169
|
+
|
|
170
|
+
Base Sepolia is the official testnet for Base (Coinbase's L2 network). It's generally more stable than Ethereum Sepolia and recommended for testing.
|
|
171
|
+
|
|
172
|
+
#### Alchemy Faucet
|
|
173
|
+
- **URL**: https://basefaucet.com/
|
|
174
|
+
- **Daily Limit**: Up to 0.5 Base Sepolia ETH per day
|
|
175
|
+
- **Requirements**:
|
|
176
|
+
- Alchemy account (free registration)
|
|
177
|
+
- Sign in required
|
|
178
|
+
- **Steps**:
|
|
179
|
+
1. Visit https://basefaucet.com/
|
|
180
|
+
2. Sign in with your Alchemy account
|
|
181
|
+
3. Enter your Base wallet address
|
|
182
|
+
4. Click "Send Me ETH"
|
|
183
|
+
5. Wait for tokens to arrive
|
|
184
|
+
|
|
185
|
+
#### Chainlink Faucet
|
|
186
|
+
- **URL**: https://faucets.chain.link/
|
|
187
|
+
- **Daily Limit**: 0.5 ETH per request
|
|
188
|
+
- **Requirements**:
|
|
189
|
+
- Wallet connection (MetaMask, WalletConnect, etc.)
|
|
190
|
+
- **Steps**:
|
|
191
|
+
1. Visit https://faucets.chain.link/
|
|
192
|
+
2. Connect your wallet
|
|
193
|
+
3. Select "Base Sepolia" from the network dropdown
|
|
194
|
+
4. Choose "0.5 ETH" from token options
|
|
195
|
+
5. Click "Drip" to receive tokens
|
|
196
|
+
|
|
197
|
+
#### Coinbase Developer Platform Faucet
|
|
198
|
+
- **URL**: https://docs.base.org/tools/network-faucets
|
|
199
|
+
- **Daily Limit**: 1 claim per 24 hours
|
|
200
|
+
- **Requirements**:
|
|
201
|
+
- Access to Coinbase Developer Platform
|
|
202
|
+
- **Steps**:
|
|
203
|
+
1. Visit https://docs.base.org/tools/network-faucets
|
|
204
|
+
2. Navigate to the Base Sepolia faucet section
|
|
205
|
+
3. Enter your Base Sepolia wallet address
|
|
206
|
+
4. Request testnet tokens
|
|
207
|
+
5. Wait for confirmation (usually within minutes)
|
|
208
|
+
|
|
209
|
+
#### thirdweb Faucet
|
|
210
|
+
- **URL**: Available via https://docs.base.org/tools/network-faucets
|
|
211
|
+
- **Daily Limit**: 1 claim per 24 hours
|
|
212
|
+
- **Requirements**:
|
|
213
|
+
- Wallet connection via EOA (Externally Owned Account) or social logins
|
|
214
|
+
- **Steps**:
|
|
215
|
+
1. Visit the Base documentation faucet page
|
|
216
|
+
2. Access the thirdweb faucet option
|
|
217
|
+
3. Connect your wallet (EOA or social login)
|
|
218
|
+
4. Ensure your wallet is set to Base Sepolia network
|
|
219
|
+
5. Claim your testnet funds
|
|
220
|
+
|
|
221
|
+
### Arbitrum Sepolia
|
|
222
|
+
|
|
223
|
+
Arbitrum Sepolia is the testnet for Arbitrum One, an Ethereum Layer 2 scaling solution.
|
|
224
|
+
|
|
225
|
+
#### Chainlink Faucet
|
|
226
|
+
- **URL**: https://faucets.chain.link/
|
|
227
|
+
- **Daily Limit**: 0.5 ETH per request
|
|
228
|
+
- **Requirements**:
|
|
229
|
+
- Wallet connection (MetaMask, WalletConnect, etc.)
|
|
230
|
+
- **Steps**:
|
|
231
|
+
1. Visit https://faucets.chain.link/
|
|
232
|
+
2. Connect your wallet
|
|
233
|
+
3. Select "Arbitrum Sepolia" from the network dropdown
|
|
234
|
+
4. Choose "0.5 ETH" from token options
|
|
235
|
+
5. Click "Drip" to receive tokens
|
|
236
|
+
|
|
237
|
+
#### QuickNode Faucet
|
|
238
|
+
- **URL**: https://faucet.quicknode.com/
|
|
239
|
+
- **Daily Limit**: Varies by network
|
|
240
|
+
- **Requirements**:
|
|
241
|
+
- MetaMask wallet
|
|
242
|
+
- Network configuration for Arbitrum Sepolia
|
|
243
|
+
- **Steps**:
|
|
244
|
+
1. Visit https://faucet.quicknode.com/
|
|
245
|
+
2. Select "Arbitrum Sepolia" from available networks
|
|
246
|
+
3. Connect your MetaMask wallet
|
|
247
|
+
4. Ensure MetaMask is configured for Arbitrum Sepolia (Chain ID: 421614)
|
|
248
|
+
5. Request testnet tokens
|
|
249
|
+
|
|
250
|
+
### General Tips
|
|
251
|
+
|
|
252
|
+
- **Wallet Configuration**: Always ensure your wallet is set to the correct testnet network before requesting tokens
|
|
253
|
+
- **Rate Limits**: Most faucets have daily limits; plan your testing activities accordingly
|
|
254
|
+
- **Network Congestion**: If you experience delays, try again later or use an alternative faucet
|
|
255
|
+
- **Multiple Faucets**: You can use multiple faucets to accumulate more testnet tokens if needed
|
|
256
|
+
- **No Real Value**: Remember that testnet tokens have no real-world value and cannot be converted to mainnet tokens
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
# Contract Verification Guide
|
|
2
|
+
|
|
3
|
+
This guide explains how to verify your deployed NeoZip NFT contract on blockchain scanners using Hardhat and Etherscan API V2.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Contract verification makes your contract's source code publicly visible on block explorers, allowing users to:
|
|
8
|
+
- View and audit the contract source code
|
|
9
|
+
- Interact with the contract through the explorer's UI
|
|
10
|
+
- Verify that the deployed bytecode matches the source code
|
|
11
|
+
|
|
12
|
+
All verification uses **Etherscan API V2**, which is the unified API for Etherscan and its family of block explorers (Arbiscan, Basescan, Polygonscan, etc.).
|
|
13
|
+
|
|
14
|
+
## Prerequisites
|
|
15
|
+
|
|
16
|
+
1. **Etherscan API Key**: Get a free API key from [Etherscan](https://etherscan.io/apis)
|
|
17
|
+
- This single API key works for all Etherscan-based explorers (Etherscan, Arbiscan, Basescan, Polygonscan)
|
|
18
|
+
- No need for separate API keys per network
|
|
19
|
+
|
|
20
|
+
2. **Hardhat Setup**: Ensure you've installed dependencies:
|
|
21
|
+
```bash
|
|
22
|
+
cd contracts
|
|
23
|
+
yarn install
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
3. **Environment Variable**: Set your Etherscan API key:
|
|
27
|
+
```bash
|
|
28
|
+
export ETHERSCAN_API_KEY=your_api_key_here
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Or add it to `hardhat.config.js`:
|
|
32
|
+
```javascript
|
|
33
|
+
etherscan: {
|
|
34
|
+
apiKey: {
|
|
35
|
+
mainnet: "your_api_key_here",
|
|
36
|
+
// ... other networks
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Quick Start
|
|
42
|
+
|
|
43
|
+
### Step 1: Compile the Contract
|
|
44
|
+
|
|
45
|
+
Before deploying, compile the contract to generate compiled ABI and bytecode:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
cd contracts
|
|
49
|
+
yarn compile:extract
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This will:
|
|
53
|
+
- Compile `src/NZIP-NFT.sol` using Hardhat
|
|
54
|
+
- Extract the ABI and write it to `ABI-compiled.txt`
|
|
55
|
+
- Extract the bytecode and write it to `Bytecode-compiled.txt`
|
|
56
|
+
|
|
57
|
+
**⚠️ IMPORTANT:** The compilation script does NOT overwrite `ABI.txt` and `Bytecode.txt` (these are the deployed versions that match contracts already on-chain). The compiled files are written to `ABI-compiled.txt` and `Bytecode-compiled.txt` for review. Only manually copy them to `ABI.txt` and `Bytecode.txt` if you want to use the new compilation for deployment.
|
|
58
|
+
|
|
59
|
+
### Step 2: Deploy the Contract
|
|
60
|
+
|
|
61
|
+
Deploy using the interactive deployment script:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
cd contracts
|
|
65
|
+
node deploy-interactive.js
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Or use any other deployment method. Make sure to save the contract address.
|
|
69
|
+
|
|
70
|
+
### Step 3: Verify the Contract
|
|
71
|
+
|
|
72
|
+
After deployment, verify the contract:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
cd contracts
|
|
76
|
+
yarn verify <contractAddress> <network>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Examples:**
|
|
80
|
+
```bash
|
|
81
|
+
# Verify on Arbitrum Sepolia
|
|
82
|
+
yarn verify 0x2716c4609fD97DaEdF429BC4B4Ec2faa81e2cC60 arbitrumSepolia
|
|
83
|
+
|
|
84
|
+
# Verify on Ethereum Sepolia
|
|
85
|
+
yarn verify 0x2716c4609fD97DaEdF429BC4B4Ec2faa81e2cC60 sepolia
|
|
86
|
+
|
|
87
|
+
# Verify on Base Sepolia
|
|
88
|
+
yarn verify 0x2716c4609fD97DaEdF429BC4B4Ec2faa81e2cC60 baseSepolia
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Supported Networks
|
|
92
|
+
|
|
93
|
+
The verification script supports the following networks:
|
|
94
|
+
|
|
95
|
+
| Network Name | Hardhat Config Name | Explorer |
|
|
96
|
+
|-------------|---------------------|----------|
|
|
97
|
+
| Ethereum Mainnet | `ethereum` | [Etherscan](https://etherscan.io) |
|
|
98
|
+
| Ethereum Sepolia | `sepolia` | [Sepolia Etherscan](https://sepolia.etherscan.io) |
|
|
99
|
+
| Base Mainnet | `base` | [Basescan](https://basescan.org) |
|
|
100
|
+
| Base Sepolia | `baseSepolia` | [Base Sepolia Explorer](https://sepolia.basescan.org) |
|
|
101
|
+
| Arbitrum One | `arbitrum` | [Arbiscan](https://arbiscan.io) |
|
|
102
|
+
| Arbitrum Sepolia | `arbitrumSepolia` | [Arbitrum Sepolia Explorer](https://sepolia.arbiscan.io) |
|
|
103
|
+
| Polygon Mainnet | `polygon` | [Polygonscan](https://polygonscan.com) |
|
|
104
|
+
| Polygon Sepolia (Amoy) | `polygonSepolia` | [Amoy Polygonscan](https://amoy.polygonscan.com) |
|
|
105
|
+
|
|
106
|
+
### Network Name Aliases
|
|
107
|
+
|
|
108
|
+
You can use any of these names when verifying:
|
|
109
|
+
- `sepolia`, `eth-sepolia`, `ethereum-sepolia`
|
|
110
|
+
- `baseSepolia`, `base-sepolia`
|
|
111
|
+
- `arbitrumSepolia`, `arbitrum-sepolia`
|
|
112
|
+
- `polygonSepolia`, `polygon-sepolia`, `amoy`
|
|
113
|
+
|
|
114
|
+
## Detailed Verification Steps
|
|
115
|
+
|
|
116
|
+
### 1. Get Your Etherscan API Key
|
|
117
|
+
|
|
118
|
+
1. Visit [Etherscan API](https://etherscan.io/apis)
|
|
119
|
+
2. Sign up or log in to your Etherscan account
|
|
120
|
+
3. Create a new API key
|
|
121
|
+
4. Copy the API key
|
|
122
|
+
|
|
123
|
+
### 2. Set the API Key
|
|
124
|
+
|
|
125
|
+
**Option A: Environment Variable (Recommended)**
|
|
126
|
+
```bash
|
|
127
|
+
export ETHERSCAN_API_KEY=your_api_key_here
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Option B: hardhat.config.js**
|
|
131
|
+
```javascript
|
|
132
|
+
etherscan: {
|
|
133
|
+
apiKey: {
|
|
134
|
+
mainnet: "your_api_key_here",
|
|
135
|
+
sepolia: "your_api_key_here",
|
|
136
|
+
// ... same key for all networks
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### 3. Verify the Contract
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
cd contracts
|
|
145
|
+
yarn verify <contractAddress> <network>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
The script will:
|
|
149
|
+
1. Validate the contract address
|
|
150
|
+
2. Check network configuration
|
|
151
|
+
3. Verify the API key is set
|
|
152
|
+
4. Submit verification request to the appropriate explorer
|
|
153
|
+
5. Display the explorer URL once verified
|
|
154
|
+
|
|
155
|
+
## Troubleshooting
|
|
156
|
+
|
|
157
|
+
### Error: "Etherscan API key not found"
|
|
158
|
+
|
|
159
|
+
**Solution:**
|
|
160
|
+
- Set the `ETHERSCAN_API_KEY` environment variable
|
|
161
|
+
- Or add it to `hardhat.config.js` in the `etherscan.apiKey` section
|
|
162
|
+
|
|
163
|
+
### Error: "Bytecode mismatch"
|
|
164
|
+
|
|
165
|
+
This error means the deployed bytecode doesn't match the compiled source code.
|
|
166
|
+
|
|
167
|
+
**Common Causes:**
|
|
168
|
+
1. Contract was compiled with different compiler settings
|
|
169
|
+
2. Source code has changed since deployment
|
|
170
|
+
3. Different Solidity version was used
|
|
171
|
+
|
|
172
|
+
**Solutions:**
|
|
173
|
+
1. **Recompile and redeploy:**
|
|
174
|
+
```bash
|
|
175
|
+
cd contracts
|
|
176
|
+
yarn compile:extract
|
|
177
|
+
# Redeploy with new bytecode
|
|
178
|
+
node deploy-interactive.js
|
|
179
|
+
# Verify again
|
|
180
|
+
yarn verify <address> <network>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
2. **Match exact compiler settings:**
|
|
184
|
+
- Check the deployed contract's compiler version on the explorer
|
|
185
|
+
- Update `hardhat.config.js` to match:
|
|
186
|
+
```javascript
|
|
187
|
+
solidity: {
|
|
188
|
+
version: "0.8.19", // Match deployed version
|
|
189
|
+
settings: {
|
|
190
|
+
optimizer: {
|
|
191
|
+
enabled: true,
|
|
192
|
+
runs: 200 // Match deployed settings
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Error: "Already Verified"
|
|
199
|
+
|
|
200
|
+
This is not an error! The contract is already verified on the explorer. You can view it on the explorer's website.
|
|
201
|
+
|
|
202
|
+
### Error: "Network not configured"
|
|
203
|
+
|
|
204
|
+
**Solution:**
|
|
205
|
+
- Check that the network name matches one in `hardhat.config.js`
|
|
206
|
+
- Use the exact network name from the config (e.g., `arbitrumSepolia`, not `arbitrum-sepolia`)
|
|
207
|
+
|
|
208
|
+
### Verification Takes Too Long
|
|
209
|
+
|
|
210
|
+
Verification can take 30 seconds to several minutes depending on:
|
|
211
|
+
- Network congestion
|
|
212
|
+
- Explorer API response time
|
|
213
|
+
- Contract complexity
|
|
214
|
+
|
|
215
|
+
Wait for the process to complete. If it times out, try again after a few minutes.
|
|
216
|
+
|
|
217
|
+
## Compiler Settings
|
|
218
|
+
|
|
219
|
+
The contract is compiled with these settings (defined in `hardhat.config.js`):
|
|
220
|
+
|
|
221
|
+
```javascript
|
|
222
|
+
solidity: {
|
|
223
|
+
version: "0.8.20",
|
|
224
|
+
settings: {
|
|
225
|
+
optimizer: {
|
|
226
|
+
enabled: true,
|
|
227
|
+
runs: 200
|
|
228
|
+
},
|
|
229
|
+
evmVersion: "paris"
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**Important:** When deploying, ensure these settings match. If you deploy with different settings, verification will fail with a bytecode mismatch.
|
|
235
|
+
|
|
236
|
+
## Manual Verification (Alternative)
|
|
237
|
+
|
|
238
|
+
If automatic verification fails, you can verify manually on the explorer:
|
|
239
|
+
|
|
240
|
+
1. Visit the contract address on the appropriate explorer
|
|
241
|
+
2. Click "Contract" tab
|
|
242
|
+
3. Click "Verify and Publish"
|
|
243
|
+
4. Select "Via Standard JSON Input" (recommended) or "Via Solidity (Single file)"
|
|
244
|
+
5. Fill in the required information:
|
|
245
|
+
- Compiler version: `0.8.20`
|
|
246
|
+
- Optimization: `Yes` (200 runs)
|
|
247
|
+
- EVM Version: `Paris`
|
|
248
|
+
6. Upload the Standard JSON Input or flattened contract source
|
|
249
|
+
|
|
250
|
+
## Best Practices
|
|
251
|
+
|
|
252
|
+
1. **Always compile before deploying:**
|
|
253
|
+
```bash
|
|
254
|
+
yarn compile:extract
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
2. **Verify immediately after deployment:**
|
|
258
|
+
- Verification is easier when done right after deployment
|
|
259
|
+
- The contract is fresh in the explorer's cache
|
|
260
|
+
|
|
261
|
+
3. **Keep compiler settings consistent:**
|
|
262
|
+
- Use the same settings for compilation and deployment
|
|
263
|
+
- Document any changes to compiler settings
|
|
264
|
+
|
|
265
|
+
4. **Test on testnets first:**
|
|
266
|
+
- Verify on testnets (Sepolia, Base Sepolia, Arbitrum Sepolia) before mainnet
|
|
267
|
+
- Testnets are free and help catch issues early
|
|
268
|
+
|
|
269
|
+
5. **Save deployment information:**
|
|
270
|
+
- Keep a record of deployed addresses and networks
|
|
271
|
+
- Note the compiler settings used for each deployment
|
|
272
|
+
|
|
273
|
+
## Network-Specific Notes
|
|
274
|
+
|
|
275
|
+
### Arbitrum Sepolia
|
|
276
|
+
|
|
277
|
+
- Uses Etherscan API V2 (same as other networks)
|
|
278
|
+
- API endpoint: `https://api-sepolia.arbiscan.io/api`
|
|
279
|
+
- Explorer: `https://sepolia.arbiscan.io`
|
|
280
|
+
|
|
281
|
+
### Base Sepolia
|
|
282
|
+
|
|
283
|
+
- Uses Basescan (Etherscan-based)
|
|
284
|
+
- API endpoint: `https://api-sepolia.basescan.org/api`
|
|
285
|
+
- Explorer: `https://sepolia.basescan.org`
|
|
286
|
+
|
|
287
|
+
### Polygon Sepolia (Amoy)
|
|
288
|
+
|
|
289
|
+
- Uses Polygonscan (Etherscan-based)
|
|
290
|
+
- API endpoint: `https://api-amoy.polygonscan.com/api`
|
|
291
|
+
- Explorer: `https://amoy.polygonscan.com`
|
|
292
|
+
|
|
293
|
+
## Additional Resources
|
|
294
|
+
|
|
295
|
+
- [Etherscan API Documentation](https://docs.etherscan.io/)
|
|
296
|
+
- [Hardhat Verification Plugin](https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-verify)
|
|
297
|
+
- [OpenZeppelin Contracts](https://docs.openzeppelin.com/contracts) (used by NZIP-NFT.sol)
|
|
298
|
+
|
|
299
|
+
## Support
|
|
300
|
+
|
|
301
|
+
If you encounter issues not covered in this guide:
|
|
302
|
+
|
|
303
|
+
1. Check the error message carefully
|
|
304
|
+
2. Verify your API key is correct and active
|
|
305
|
+
3. Ensure the network is properly configured
|
|
306
|
+
4. Try recompiling and redeploying if bytecode mismatch occurs
|
|
307
|
+
5. Check the explorer's status page for API issues
|
|
308
|
+
|