Nitro User Manual

  1. Download and install official solana CLI tool

    sh -c "$(curl -sSfL <https://release.solana.com/v1.10.26/install>)"
    export PATH="/root/.local/share/solana/install/active_release/bin:$PATH"
  2. Configure your sei key

    # change to anything you like
    export ACCOUNT_NAME=admin
    export ACCOUNT_PASSWORD=12345678
    
    printf $ACCOUNT_PASSWORD"\n"$ACCOUNT_PASSWORD"\ny\n" | seid keys add $ACCOUNT_NAME
  3. Config sei and nitro public rpc node address on your local laptop

    1. Devnet:

      1. nitro public RPC: https://nitro-devnet.com:8899/

    2. Atlantic-1

      1. TBA

    # find a public rpc endpoint of a sei node
    export ENDPOINT=tcp://54.183.99.245:26657
    export CHAIN_ID=sei-devnet-1
    
    # find a public rpc endpoint of the nitro node
    export NITRO_ENDPOINT=https://nitro-devnet.com/rpc/
  4. Create your account and program account

    # replace this with the path you'd like to use
    export PATH_TO_STORE_KEY = $HOME/mykey.json
    
    # create account
    solana-keygen new --no-passphrase -fso $PATH_TO_STORE_KEY
    
    # get public key
    NITRO_PUBKEY=$(solana address -k $PATH_TO_STORE_KEY -u $NITRO_ENDPOINT)
  5. Fund yourself

    1. sei-devnet-1 bridge contract address: sei12wrtrzqt7atsen2wsl9k5hu82jsj6739h7pck20gtdd24mqyxv6qpj0rnt

    2. atlantic-1 bridge contract address: TBA

    # get usei from Sei faucet: <https://docs.seinetwork.io/smart-contracts-and-local-development/sei-tool-guide#sei-testnet-faucet>
    
    # lock fund on L1 contract
    LOCK_FUND_TX_HASH=$(printf $ACCOUNT_PASSWORD"\n" | ~/go/bin/seid tx wasm execute \\
      sei12wrtrzqt7atsen2wsl9k5hu82jsj6739h7pck20gtdd24mqyxv6qpj0rnt \\
      '{"lock":{"nitro_pubkey": "'$NITRO_PUBKEY'"}}' \\
      --amount=10000usei --from=$ACCOUNT_NAME --node $ENDPOINT --chain-id $CHAIN_ID --fees=1000usei -y \\
      --gas=500000 --broadcast-mode=block --output json | jq ".txhash")
    
    # notify listener (on L2)
    curl $NITRO_ENDPOINT/UnlockFund/ -X POST -d '{"tx_hash":"'$LOCK_FUND_TX_HASH'"}' -H "Content-Type: application/json"
    
    # verify if your account is funeded
    solana balance $ACCOUNT_PUBKEY --url $NITRO_ENDPOINT
  6. Deploy your own Solana program to the Nitro devnet

    # create an id for your program
    export PROGRAM_ID = $HOME/myprogram.json
    # create program account
    solana-keygen new --no-passphrase -fso $PROGRAM_ID
    PROGRAM_PUBKEY=$(solana address -k $PROGRAM_ID -u $NITRO_ENDPOINT)
    
    export PROGRAM_PATH=<path to your program build>
    solana program deploy $PROGRAM_PATH  -k $PATH_TO_STORE_KEY -u $NITRO_ENDPOINT --program-id $PROGRAM_ID
    
    # verify if the program is deployed successfully
    solana program show $PROGRAM_PUBKEY
  7. You can now use the RPC endpoint specified above to interact with your program!

Last updated