logoAcademy

Initial Token Allocation

Learn about the initial token allocation and configure in your EVM blockchain.

Background

Alloc defines the initial balances of addresses at the time of chain creation. This field should be modified according to the specific requirements of each chain.

If no genesis allocation is provided, you won't be able to interact with your new chain, as all transactions require a fee to be paid from the sender's balance. Without an initial allocation, there will be no funds available to cover transaction fees.

Format

The alloc field expects key-value pairs. Keys must be valid addresses, and the balance field in each value can be either a hexadecimal or decimal number representing the initial balance of the address.

{
  "config": {
    // ...
  },
  "alloc": { 
    "8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC": {
      "balance": "0x295BE96E64066972000000" // 50,000,000 tokens
    }
  },
  // ...
}

Keys in the allocation are hex addresses without the canonical 0x prefix. Balances are denominated in Wei (10^18 Wei = 1 Whole Unit of the native token of the chain) and expressed as hex strings with the canonical 0x prefix. Use this converter for translating between decimal and hex numbers.

The default configuration for testing purposes allocates a significant number of tokens to the address 8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC.

The private key for this address (as defined in the .devcontainer) is: 56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027.

Warning
Never use this address or private key for anything other than testing on a local test network. The private key is publicly known, and any real funds transferred to this address are likely to be stolen.

Configure

Allocate tokens to two addresses:

  • The well-known test address 8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC.
  • Another test address that you have created (avoid using addresses associated with real funds).
{
  "config": {
    // ...
  },
  "alloc": {
    "8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC": { 
      "balance": "0x295BE96E64066972000000" // 50,000,000 tokens
    },
    "<your_address>": { 
      "balance": "0x295BE96E64066972000000" // 50,000,000 tokens
    }
  },
  // ...
}

On this page