Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Accept a genesis.json file #1042

Open
danfinlay opened this issue Mar 8, 2016 · 7 comments
Open

Accept a genesis.json file #1042

danfinlay opened this issue Mar 8, 2016 · 7 comments

Comments

@danfinlay
Copy link
Contributor

The genesis.json file format specifies an initial state for the blockchain, including balances of account numbers.

This could be very useful for development environments where a client has a wallet on it, and we want them to have a balance even on the simulated blockchain.

Lets clients operate in the development environment with nothing but the RPC address and an account that they've generated.

(I'm talking about Metamask here).

sample genesis.json here.

The basic format is this:

{
"nonce": "0x0000000000000042",
"difficulty": "0x400000000",
"alloc": {
  "3282791d6fd713f1e94f4bfd565eaa78b3a0599d": {
    "balance": "1337000000000000000000"
    }
  },
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
"gasLimit": "0x1388"
}

The part I care the most about is the alloc hash, which includes a map of accounts to an object containing their initial balance.

An aside: A lot of pre-sale purchasers picked 1337... as their initial balance :)

@axic
Copy link
Contributor

axic commented Mar 9, 2016

Would be great! I was thinking about hacking in a command line option just to provide a list of accounts, but this would be way better.

@axic
Copy link
Contributor

axic commented Apr 18, 2016

A newer, more complex version of genesis.json: https://github.com/ethereum/wiki/wiki/Ethereum-Chain-Spec-Format

@aakilfernandes
Copy link
Contributor

Would also be useful for dev testing purposes (include pre-deployed contracts in the genesis)

@benjamincburns
Copy link
Contributor

Seems that this would eliminate the need for the request in #265, amongst other things - though the effort involved might be substantially larger (especially since there's already a PR for #265).

@benjamincburns
Copy link
Contributor

Per PR #406, we'll want to also make it possible to save a genesis file when none is specified.

@john-osullivan
Copy link

Is anyone trying to work on this? I'm in the scenario described by @aakilfernandes , trying to test a pre-deployed contract. Having to spin up a real chain each time is a pain!

@zcstarr
Copy link

zcstarr commented Nov 26, 2019

Going to just ping this here, I think this is still a good idea 👍 , is there any major blocker to this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: Stalled
Development

No branches or pull requests

10 participants