Generate & Connect New Chain Account

To create a new account, use the new_account function. Aleph will create a blockchain account on the chain of your choice and import it as an Account object.

Call the new_account function on the corresponding chain module of your choice:

//EXAMPLE

import { avalanche } from 'aleph-js'

account = await avalanche.new_account()

// RETURNS THE ACCOUNT OBJECT

{
  'private_key': '<PRIVATE KEY>',
  'public_key': '<PUBLIC KEY>',
  'address': '<ADDRESS>',
  'type': 'AVAX',
  'source': 'integrated',
  'signer': '<KEYPAIR>',
  'name': '<ACCOUNT NAME OR ADDRESS>'
}

Some of the chains allow for passing extra parameters to create the blockchain account. Below you will find a table of the optional parameters, sorted by chain.

ChainParametersDefault value

Cosmos

path

"m/44'/118'/0'/0/0"

prefix

"cosmos"

Ethereum

path

"m/44'/60'/0'/0/0"

NULS2

chain_id

1

prefix

"NULS"

Solana

path

"m/44'/60'/0'/0/0"

Substrate

format

42

Last updated