Understand asymmetric cryptography and how Nexis Native Chain uses it.
@nexis-network/web3.js
provides helper functions for creating a brand new keypair,
or for constructing a keypair using an existing secret key.example.sol
- point to addresses
like dDCQNnDmNbFVi8cQhKAgXhyhXeJ625tvwsunRyRc7c8
@nexis-network/web3.js
npm module. Set up a project how you normally would, then
use npm
to install @nexis-network/web3.js
Keypair.generate()
function from
@nexis-network/web3.js
:
Keypair
from
an existing secret key stored in the filesystem or an .env
file. In node.js,
the @nexis-network-developers/helpers
npm package includes some extra functions:
.env
file use getKeypairFromEnvironment()
getKeypairFromFile()
generate-keypair.ts
npx esrun generate-keypair.ts
. You should see the text:
Keypair
has a publicKey
and secretKey
property. Update the file:
npx esrun generate-keypair.ts
. You should see the text:
.env
file:
Make a new file called .env
with the contents of the key you made earlier:
generate-keypair.ts
:
npx esrun generate-keypair.ts
. You should see the following result: