Genesis

@liskhq/lisk-genesis is a package which contains genesis block creation functions according to the Lisk protocol.

Installation

npm install @liskhq/lisk-genesis

Update

To perform an upgrade, execute the following command:

npm update @liskhq/lisk-genesis

Usage

const accountAssetSchemas = { [moduleName: string]: AccountSchema };
const genesisBlockParams = {
	initRounds: 5,
	height: 5,
	timestamp: 1591873718,
	previousBlockID: Buffer.from(
		'454690a1c37838326007519a7ce1c8a6a495df50898f1ebd69d22fbcedf9689a',
		'hex',
	),
	initDelegates: validDelegateAccounts.map(a => a.address),
	accounts: [...validAccounts, ...validDelegateAccounts],
	accountAssetSchemas,
}
const genesisBlock = genesis.createGenesisBlock(genesisBlockParams);
const genesisBlockJSON = genesis.getGenesisBlockJSON({genesisBlock, accountAssetSchemas})
const genesisBlockSchema = genesis.getGenesisBlockSchema(accountAssetSchemas)

Interface

interface Genesis {
  public createGenesisBlock: (params: GenesisBlockParams) => GenesisBlock,
  public getGenesisBlockJSON: (params: GenesisBlockJSONParams) => Record<string, unknown>,
  public getGenesisBlockSchema: (accountSchema: accountAssetSchemas) => Schema,
  GenesisBlockParams,
  GenesisBlockJSONParams,
  accountAssetSchemas,
  GenesisBlockHeaderWithoutId
}