Estoy intentando implementar en mi red de prueba Ethereum local. Mi nueva dirección de red de prueba necesita un saldo. Así que trato de crear un archivo de Génesis:
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"
}
}
}
¿Qué pasa con mi CustomGenesis.json?
EDITAR:
Intenté ejecutar los comandos desde https://github.com/ethereum/go-ethereum/wiki/Private-network
CustomGénesis.json:
{
"config": {
"chainId": 15,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"difficulty": "200000000",
"gasLimit": "2100000",
"alloc": {
"0x9370855ace244dc18fba024988046dde0d9f8ad8": {
"balance": "1000000000000000000000"
}
}
}
Para crear una base de datos que use este bloque de génesis, ejecute el siguiente comando. Esto importará y establecerá el bloque de génesis canónico para su cadena.
geth --datadir ruta/a/personalizado/datos/carpeta init genesis.json
Las ejecuciones futuras de geth en este directorio de datos usarán el bloque de génesis que ha definido.
geth --datadir ruta/a/personalizado/datos/carpeta --networkid 15
Así que ejecuto lo anterior con
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
luego en un caparazón nuevo,
geth attach
Fatal: Unable to attach to remote geth: dial unix /Users/quantum/Library/Ethereum/geth.ipc: connect: no such file or directory
así que ahora no puedo conectarme a mi red de prueba.
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
Ejecutar geth account new
en la línea de comandos y personal.newAccount("password")
en la consola.
ivicaa