Make your first transactions on DevNet, using the System and memo programs!
@nexis-network/web3.js
provides helper functions for creating
transactions and instructions. You can create a new transaction with the
constructor, new Transaction()
. Once created, you can add instructions to the
transaction using the add()
method.
One of those helper functions is SystemProgram.transfer()
, which makes an
instruction for the SystemProgram
to transfer some NZT:
SystemProgram.transfer()
function requires:
SystemProgram.transfer()
returns the instruction for sending NZT from the
sender to the recipient.
The program used in this instruction will be the system
program (at the
address 11111111111111111111111111111111
), the data will be the amount of NZT
to transfer (in Lamports) and the accounts will be based on the sender and
recipient.
The instruction can then be added to the transaction.
Once all the instructions have been added, a transaction needs to be sent to the
cluster and confirmed:
sendAndConfirmTransaction()
function takes the following parameters:
solana airdrop 1
to get free test NZT
in your account when testing, whether locally or on devnet.
sendAndConfirmTransaction()
in the example above, search
for that signature in the Nexis Native Chain Explorer, then see:
.env
file we made earlier in
Intro to Cryptography.
Create a file called transfer.ts
:
devnet
network.