Generate & Connect New Chain Account

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

Call the NewAccount() function on the corresponding chain module of your choice:

// FUNCTION SIGNATURE
await ethereum.NewAccount(derivationPath?: "m/44'/60'/0'/0/0")

-----------------------------------------------

//EXAMPLE
import { ethereum } from 'aleph-sdk-ts'

account = await ethereum.NewAccount()

// --> RETURNS THE OBJECT
{ 
  account: { 
    address: "<address>", 
    publicKey: "<public key>",
    wallet: <wallet object> },
  mnemonic: "<mnemonic generated>" 
}

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

ChainParametersDefault value

Ethereum

derivationPath

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

Nuls

chain_id

1

prefix

""

Nuls2

chain_id

1

prefix

"NULS"

Last updated