I am attempting to deploy on my local Ethereum testnet. My new testnet address needs a balance. So I try to create a Genesis File:
geth init
Fatal: Must supply path to genesis JSON file
~/geth init CustomGenesis.json
Fatal: invalid genesis file: json: cannot unmarshal hex string of odd length into Go struct field Genesis.extraData of type hexutil.Bytes
~/geth init CustomGenesis2.json
Fatal: Failed to read genesis file: open CustomGenesis2.json: no such file or directory
~/e CustomGenesis.json
~/cat CustomGenesis.json
{
"nonce": "0x0000000000000042",
"timestamp": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x0",
"gasLimit": "0x8000000",
"difficulty": "0x400",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x3333333333333333333333333333333333333333",
"alloc": {
"0x9370855ace244dc18fba024988046dde0d9f8ad8": {
"balance": "1000000000000000000000"
}
}
}
What's wrong with my CustomGenesis.json?
EDIT:
I tried running the commands from https://github.com/ethereum/go-ethereum/wiki/Private-network
CustomGenesis.json:
{
"config": {
"chainId": 15,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"difficulty": "200000000",
"gasLimit": "2100000",
"alloc": {
"0x9370855ace244dc18fba024988046dde0d9f8ad8": {
"balance": "1000000000000000000000"
}
}
}
To create a database that uses this genesis block, run the following command. This will import and set the canonical genesis block for your chain.
geth --datadir path/to/custom/data/folder init genesis.json
Future runs of geth on this data directory will use the genesis block you have defined.
geth --datadir path/to/custom/data/folder --networkid 15
So I run the above with
geth --rpc --datadir path/to/custom/data/folder --networkid 15
WARN [03-05|19:33:23] No etherbase set and no accounts found as default
INFO [03-05|19:33:23] Starting peer-to-peer node instance=Geth/v1.7.2-stable/darwin-amd64/go1.9.2
INFO [03-05|19:33:23] Allocated cache and file handles database=/Users/quantum/cc/geth/path/to/custom/data/folder/geth/chaindata cache=128 handles=1024
INFO [03-05|19:33:23] Initialised chain configuration config="{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Byzantium: 4370000 Engine: ethash}"
INFO [03-05|19:33:23] Disk storage enabled for ethash caches dir=/Users/quantum/cc/geth/path/to/custom/data/folder/geth/ethash count=3
INFO [03-05|19:33:23] Disk storage enabled for ethash DAGs dir=/Users/quantum/.ethash count=2
INFO [03-05|19:33:23] Initialising Ethereum protocol versions="[63 62]" network=15
INFO [03-05|19:33:23] Loaded most recent local header number=0 hash=d4e567…cb8fa3 td=17179869184
INFO [03-05|19:33:23] Loaded most recent local full block number=0 hash=d4e567…cb8fa3 td=17179869184
INFO [03-05|19:33:23] Loaded most recent local fast block number=0 hash=d4e567…cb8fa3 td=17179869184
INFO [03-05|19:33:23] Loaded local transaction journal transactions=0 dropped=0
INFO [03-05|19:33:23] Regenerated local transaction journal transactions=0 accounts=0
INFO [03-05|19:33:23] Starting P2P networking
INFO [03-05|19:33:25] UDP listener up self=enode://cd3f867d2e6e268ab27e555e255097bb96f1f61381dcce74c90a11ee2f960e8542955764a14c7e96e5002b10eb2cc74badf29f974d4d3b61b936e2be36bfe7b6@[::]:30303
INFO [03-05|19:33:25] RLPx listener up self=enode://cd3f867d2e6e268ab27e555e255097bb96f1f61381dcce74c90a11ee2f960e8542955764a14c7e96e5002b10eb2cc74badf29f974d4d3b61b936e2be36bfe7b6@[::]:30303
INFO [03-05|19:33:25] IPC endpoint opened: /Users/quantum/cc/geth/path/to/custom/data/folder/geth.ipc
INFO [03-05|19:33:25] HTTP endpoint opened: http://127.0.0.1:8545
then in a new shell,
geth attach
Fatal: Unable to attach to remote geth: dial unix /Users/quantum/Library/Ethereum/geth.ipc: connect: no such file or directory
so now I cannot connect to my test network.
geth version
Geth
Version: 1.7.2-stable
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.9.2
Operating System: darwin
GOPATH=/Users/quantum/code/go
GOROOT=/usr/local/Cellar/go/1.9.2/libexec