HSSN Demo
Demo1 - Syncing and Reading Devnet Data with Grid1
Click to watch the Demo1 video
Step 1:
Pull the script code from GitHub. It has been pulled here, so go to the next step directly.
Step 2:
Enter the App/hssn-demo directory and run npm i to install dependencies(the node environment needs to be installed first).
Step 3:
Open the script code and confirm that the rpc in the Connection in the script is consistent with the rpc address of grid-1 in https://explorer-hssn.hypergrid.dev/grids
Step 4:
Confirm that the pubkey in node_id in the script is consistent with the pubkey address of devnet in https://explorer-hssn.hypergrid.dev/grids.
Step 5:
Open https://mint.hypergrid.dev/ and mint a nft on devnet. Click tx to jump to the devnet browser to view the nft data.
Step 6:
Copy the mint account address, open the script code and replace REPLACE_ACCOUNT with the copied mint account address.The script has been configured with a wallet private key with test coins, which can be replaced with your own wallet private key with test coins
Step 7:
Run node demo1.js
Step 8:
Copy tx to grid-1 browser to view the synchronized log.
Step 9:
Open https://explorer-hssn.hypergrid.dev/sharedaccounts to view the mint account just synchronized.
Step 10:
Copy the mint account to the grid-1 browser to view the synchronized nft data.
Step 11:
The mint account address NFT image here cannot be displayed because metadata of metaplex and other nft programs are not synchronized. This demo only demonstrates synchronization and reading devnet data.
Demo2 - Synchronize and Read Data from Grid1 to Grid2, Update Data in Grid1, and Read Updated Data in Grid2
2-1: Deploy the SONIC NFT Minting Program on Grid1 and Mint a SONIC NFT
Click to watch the Demo2-1 video
Step 1:
Pull the project code from github and enter the Base/sonic-nft-program directory.
Step 2:
Run yarn to install dependencies (rust, solana, yarn, anchor and other environments need to be installed first)
Go to this website https://www.anchor-lang.com/docs/installation to view the installation environment tutorial
Step 3:
Run (anchor build) to compile the program and generate a new program id.(ps: It takes a long time to generate here)
Step 4:
Run (anchor keys list) to display the newly generated program id, and replace the values of declare_id in programs/hgnft/src/lib.rs and hgnft in Anchor.toml with the newly generated program id.
Step 5:
Run anchor build to compile the program again (compile the newly generated program ID into it).
Step 6:
Replace the value of cluster in Anchor.toml with https://grid-1.hypergrid.dev.
Step 7:
Run (solana-keygen new -o ./wallet.json) to create a new wallet private key file in the directory. The command line log will show the new wallet address.
Step 8:
Go to the faucet to receive the test coins
Step 9:
Run (anchor deploy) to deploy the program. The log will display the successfully deployed NFT casting program address (that is, the newly generated program id)
Step 10:
Run (anchor run test1 — —skip-build — —skip-deploy ) to test minting 1 NFT.
Copy the mint nft tx url displayed in the command line log and go to the grid-1 browser to view the tx details.
Copy the mint account URL displayed in the command line log and go to the grid-1 browser to view the mint account details.
2-2: Synchronize the Mint Account from Grid1 to Grid2 and Read Data from Grid1 on Grid2
Click to watch the Demo2-2 video
Step 1:
Enter the App/hssn-demo directory and open demo2.js.
Step 2:
Open https://explorer-hssn.hypergrid.dev/grids and compare the rpc address in Connection with that of grid-2.
Step 3:
Compare the pubkey in node_id and the pubkey address of grid-1. They are consistent.
(The script has been configured with a wallet private key with test coins, which can be replaced with your own wallet private key with test coins).
Step 4:
Replace REPLACE_ACCOUNT with the mint account address just now
Step 5:
Run npm i to install dependencies
I’ve already installed it here in advance.
Step 6:
Run node demo2.js to synchronize accounts
Step 7:
Copy tx to grid-2 browser to view the synchronized log
Step 8:
Open https://explorer-hssn.hypergrid.dev/sharedaccounts to view the mint account just synchronized.
Step 9:
Copy the mint account to the grid-2 browser to view the synchronized mint account.
Step 10:
Enter the Base/sonic-nft-program directory.
Step 11:
Replace the value of cluster in Anchor.toml with https://grid-2.hypergrid.dev.
Step 12:
Replace REPLACE_ACCOUNT in tests/hssn-demo2-2.ts with the synchronized mint account address.
Step 13:
Run (anchor run test2 — —skip-build — —skip-deploy) to read the data of the mint account synchronized on grid2
The command line log will display the name, level and other data of the NFT
2-3: Upgrade the NFT on Grid1 and Read Updated Data from Grid1 on Grid2
Click to watch the Demo2-3 video
Step 1:
Replace the value of cluster in Anchor.toml back to https://grid-1.hypergrid.dev
Step 2:
Replace REPLACE_ACCOUNT in tests/hssn-demo2-3.ts with the mint account address just now
Step 3:
Run (anchor run test3 — —skip-build — —skip-deploy ) to upgrade the NFT level on grid1 from level 1 to level 2.
Step 4:
Enter the App/hssn-demo directory
Step 5:
Run (node demo2.js) to synchronize accounts
Step 6:
Copy tx to grid-2 browser to view the synchronized log
Step 7:
Open https://explorer-hssn.hypergrid.dev/sharedaccounts to view the mint account just synchronized and the slot updated.
The SLOT value before synchronization is 1616121. After the synchronization program is started, the SLOT value here is 1617895, indicating that the synchronization is successful.
Step 8:
Copy the mint account to the grid-2 browser to view the synchronized mint account
Step 9:
Enter the Base/sonic-nft-program directory
Step 10:
Replace the value of cluster in Anchor.toml with https://grid-2.hypergrid.dev.
Step 11:
Run (anchor run test2 — —skip-build — —skip-deploy) to read the data of the mint account synchronized on grid2
The command line log will display the name, level and other data of the NFT. The level has been upgraded to 2.