Skip to main content
Version: 0.4

Account Generation

On this page, we'll cover how to generate a new account on the AVN.

The Aventus blockchain is a Substrate-based blockchain, and like all Substrate-based blockchains, all keys use the SS58 address encoding format.

There are multiple ways to generate an account, and we'll explore two below and another after initialising the API.

1. Subkey

To begin, you would need to install Subkey. Subkey is a Substrate utility for generating accounts and keys and verifying them as well. The documentation provides an apt description on how to install Subkey, however, just to provide you with the briefs.

  1. Install cargo
  2. Run this command in your terminal:
# Use the `--fast` flag to get the dependencies without needing to install the Substrate and Subkey binary
curl -sSf | bash -s -- --fast
# Install only `subkey`, at a specific version
cargo install --force subkey --git --version 2.0.1 --locked

You can verify you have cargo installed by running cargo --version. You can also verify you have subkey installed by running subkey --version.

Now, to generating your account on the Aventus network. Run this command in your terminal:

subkey generate

If it generated a secret seed, public key(hex), public key (SS58), account ID, SS58 address Congratulations! You now have an account that can be used on the Aventus Network.

2. Using Polkadot libraries

Install yarn by running npm i --global yarn on your terminal. Verify it has been installed by running yarn --version.

yarn add @polkadot/util @polkadot/api

Running the above command in your terminal will install the Polkadot npm libraries required to generate your account keys. These keys can later be imported into your javascript script.


If you're getting a duplication error, try clearing your cache with npm cache clean --force. If that doesn't work, you could try reinstalling your node packages with yarn

You can use this code to generate an account

const { Keyring } = require("@polkadot/api");
const { u8aToHex } = require("@polkadot/util");
const { cryptoWaitReady, mnemonicGenerate } = require("@polkadot/util-crypto");

(async () => {
//To initialise WASM
await cryptoWaitReady();
// To generate a new keyring
const keyring = new Keyring({ type: "sr25519" });
// Generate a mnemonic seed phrase with 12 words
const mnemonic = mnemonicGenerate();
const keyPair = keyring.addFromUri(mnemonic, "sr25519");
// It is important to store the values returned here:
"\n ADDRESS: ",

If it successfully generated the account and logged it to the console, Congratulations! You now have an account that can be used on the Aventus Network.

The difference between the two methods is the first shows you your private key (secret seed), while the latter does not, however, you can still sign transactions with the latter.