Connect to Nexis Native Chain DevNet from TypeScript and read data from the blockchain!
◎
symbol.
Each NZT is made from 1 billion Lamports.
In the same way that finance apps typically do math in cents (for USD) and pence
(for GBP), Nexis Native Chain apps typically transfer, spend, store, and handle NZT as
Lamports, only converting to full NZT to display to users.
dDCQNnDmNbFVi8cQhKAgXhyhXeJ625tvwsunRyRc7c8
. Most
addresses on Nexis Native Chain are also public keys. As mentioned in the previous
chapter, whoever controls the matching secret key for an address controls the
account - for example, the person with the secret key can send tokens from the
account.
@nexis-network/web3.js
to do most of the work with
Nexis Native Chain. We’ll also install TypeScript and esrun
, so we can run .ts
files on
the command line:
@nexis-network/web3.js
is going to
happen through a Connection
object. The Connection
object establishes a
connection with a specific Nexis Native Chain network, called a ‘cluster’. For now, we’ll
use the Devnet
cluster rather than Mainnet
. Devnet
is designed for
developer use and testing, and DevNet
tokens don’t have real value.
npx esrun example.ts
) shows:
LAMPORTS_PER_SOL
for showing Lamports as NZT:
npx esrun example.ts
will show something like:
check-balance.ts
, substituting your public key for
<your public key>
.
The script loads the public key, connects to DevNet, and checks the balance:
npx esrun check-balance.ts
. You should see something
like:
mainNet
and look up some famous Nexis Native Chain
wallets. Try toly.sol
, shaq.sol
or mccann.sol
.