#GeniusNinja33
This repository serves to demonstrate how transactions are created, signed, and sent to the NEAR blockchain.
- Current version of Node.js. >=v14.0.0
- Setup an environment variable
SENDER_PRIVATE_KEY
with the private key of the sender's account.
Either create a .env
file in the root of this project, or export a bash variable by running the following in your terminal (replacing the example key).
export SENDER_PRIVATE_KEY=ed25519:3wNVAVcERFTiuH2nDPZtQi5q5pn1HB6ECpruCrBiBFq5TRjghKgQJhoXjyXgEZRDsTV9Efj4xoGz9iw7BsSEJs3R
- Install dependencies by running:
npm i
send-tokens-easy.js
will show you the easiest (JavaScript) way to send NEAR tokens (Ⓝ) using anear-api-js
method;account.sendMoney()
- In
send-tokens-easy.js
, update:
- account IDs for
sender
andreceiver
. - network ID (
default
istestnet
)
- Run the file and send those tokens!
node send-tokens-easy.js
send-tokens-deconstructed.js
completely dissects the transaction construction process and shows the lowest level way to send NEAR tokens (Ⓝ).
- In
send-tokens-deconstructed.js
, update:
- account IDs for
sender
andreceiver
. - network ID (
testnet
is default)
- Enter the amount of Ⓝ you would like to send.
- Run the file and send those tokens!
node send-tokens-deconstructed.js
For a detailed walk-through, see the create-transactions doc.
Happy coding! 🚀