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:
//EXAMPLEimport { avalanche } from'aleph-js'account =awaitavalanche.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>'}
// New account function signature for Cosmosawaitcosmos.new_account( { path:"m/44'/118'/0'/0/0", prefix:"cosmos" })-------------------------------------------------// EXAMPLE import { cosmos } from'aleph-js'account =awaitcosmos.new_account()// RETURNS THE ACCOUNT OBJECT{'private_key': '<PRIVATE KEY>','public_key': '<PUBLIC KEY>','mnemonics': '<MNEMONICS>','address': '<ADDRESS>','prefix': '<PREFIX>','path': '<PATH>','type': 'CSDK','source': 'integrated'}
// FUNCTION SIGNATUREawaitsubstrate.new_account( { format:42 })-----------------------------------------------// EXAMPLE import { substrate } from'aleph-js'account =awaitawaitsubstrate.new_account()// RETURNS THE ACCOUNT OBJECT{'keyring': keyring,'private_key': '<PRIVATE KEY>','public_key': '<PUBLIC KEY>','mnemonics': '<MNEMONICS>','address': '<ADDRESS>','address_format': format,'type': 'DOT','source': 'integrated','signer': pair,'name':}
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.