Skip to content

Predeploying Contracts in the Genesis File

To predeploy contracts when starting Pantheon, specify contract code in the genesis file.

Contract Code in Genesis File

{
  ...
  "alloc": {
      "0x0ffd23af8eebc60b3cfdeed6f814988757237314": {
      "balance": "0x100000000000000000000000000000000000000000000000000",
      "code": "0x6080604052600436106043576000357c010000000000000000000000000000000000000000000000000000000090048063010fc84214604857806355241077146070575b600080fd5b348015605357600080fd5b50605a60a7565b6040518082815260200191505060405180910390f35b348015607b57600080fd5b5060a560048036036020811015609057600080fd5b810190808035906020019092919050505060ad565b005b60005481565b80600081905550807f04474795f5b996ff80cb47c148d4c5ccdbe09ef27551820caa9c2f8ed149cce360405160405180910390a25056fea165627a7a7230582038cb7ea327af8f73feabcfbff64498f1e74831e67f7c75286760d3845c6747c70029",
      "storage": {
        "7aa07e0c924147697605046b7c2c32645b7bbfb41e0ac5d0a84ac93cbb759798": "0000000000000000000000000000000000000000000000000000000000000001",
        "cea2b0602db61f92b76ec4402875cc38eedc9fc425cb1b697fc2265d50fc20fb": "0000000000000000000000000000000000000000000000000000000000000001",
      }
    }
  },
  ...
}

The contract code in the genesis file defines:

  • Address
  • Balance
  • Bytecode
  • Key value pairs for contract storage.
Questions or feedback? You can discuss issues and obtain free support on Pegasys Pantheon Gitter room.
For paid professional support by PegaSys, contact us at [email protected]