Ethereum: Next Steps
Ok, so you've got the last article down. Now what?
Ethereum: Next Steps
Ok, clone this one next.
# get the repo
git clone https://gist.github.com/val314159/c8807758cc98bfdfd18dfc060d030c11 next-steps
cd next-steps
Let's launch a new chain!
Hopefully, you have make
and geth
installed. plus uuidgen
and perl
in there somewhere.
- It also creates the artifacts
account
andpassword
for accountID and password, respectively.
Now type:
make
This exposes http://localhost:8545
as an endpoint, using dd
for its datastore.
- If it's all good, you'll see some scroll-up like this:
uuidgen > password
geth --datadir dd account new --password password >account
WARN [11-27|20:09:55] No etherbase set and no accounts found as default
perl -i -npe 's/Address: {(.*?)}/$1/g' account
geth --datadir dd init g.js
INFO [11-27|20:09:56] Allocated cache and file handles database=/Users/val/xsrc/oboe/repos/c8807758cc98bfdfd18dfc060d030c11/dd/geth/chaindata cache=16 handles=16
INFO [11-27|20:09:56] Writing custom genesis block
INFO [11-27|20:09:56] Successfully wrote genesis state database=chaindata hash=9b8c99…f9d159
INFO [11-27|20:09:56] Allocated cache and file handles database=/Users/val/xsrc/oboe/repos/c8807758cc98bfdfd18dfc060d030c11/dd/geth/lightchaindata cache=16 handles=16
INFO [11-27|20:09:56] Writing custom genesis block
INFO [11-27|20:09:56] Successfully wrote genesis state database=lightchaindata hash=9b8c99…f9d159
geth --datadir dd --mine --nodiscover --maxpeers 0 --networkid 130031 --rpc --rpccorsdomain "*" --rpcport 8545
INFO [11-27|20:09:56] Starting peer-to-peer node instance=Geth/v1.7.2-stable/darwin-amd64/go1.9.2
INFO [11-27|20:09:56] Allocated cache and file handles database=/Users/val/xsrc/oboe/repos/c8807758cc98bfdfd18dfc060d030c11/dd/geth/chaindata cache=128 handles=1024
WARN [11-27|20:09:56] Upgrading database to use lookup entries
INFO [11-27|20:09:56] Initialised chain configuration config="{ChainID: 130031 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: <nil> EIP155: 0 EIP158: 0 Byzantium: <nil> Engine: unknown}"
INFO [11-27|20:09:56] Disk storage enabled for ethash caches dir=/Users/val/xsrc/oboe/repos/c8807758cc98bfdfd18dfc060d030c11/dd/geth/ethash count=3
INFO [11-27|20:09:56] Disk storage enabled for ethash DAGs dir=/Users/val/.ethash count=2
INFO [11-27|20:09:56] Database deduplication successful deduped=0
INFO [11-27|20:09:56] Initialising Ethereum protocol versions="[63 62]" network=130031
INFO [11-27|20:09:56] Loaded most recent local header number=0 hash=9b8c99…f9d159 td=200
INFO [11-27|20:09:56] Loaded most recent local full block number=0 hash=9b8c99…f9d159 td=200
INFO [11-27|20:09:56] Loaded most recent local fast block number=0 hash=9b8c99…f9d159 td=200
INFO [11-27|20:09:56] Regenerated local transaction journal transactions=0 accounts=0
INFO [11-27|20:09:56] Starting P2P networking
INFO [11-27|20:09:56] RLPx listener up self="enode://cdd1dfb0ec60b4f84ea55373d2c17d42c0824dc808d778059e3199df7e24d6d71aec00dcadab3f78369751729a13240127d3ff158d16f255bb1961f788f312fb@[::]:303\
03?discport=0"
INFO [11-27|20:09:56] IPC endpoint opened: /Users/val/xsrc/oboe/repos/c8807758cc98bfdfd18dfc060d030c11/dd/geth.ipc
INFO [11-27|20:09:56] HTTP endpoint opened: http://127.0.0.1:8545
INFO [11-27|20:09:56] Transaction pool price threshold updated price=18000000000
INFO [11-27|20:09:56] Starting mining operation
INFO [11-27|20:09:56] Commit new mining work number=1 txs=0 uncles=0 elapsed=118.049µs
INFO [11-27|20:09:58] Successfully sealed new block number=1 hash=e30b45…57b160
INFO [11-27|20:09:58] \360\237\224\250 mined potential block number=1 hash=e30b45…57b160
INFO [11-27|20:09:58] Commit new mining work number=2 txs=0 uncles=0 elapsed=129.972µs
INFO [11-27|20:09:58] Mapped network port proto=tcp extport=30303 intport=30303 interface="UPNP IGDv1-IP1"
INFO [11-27|20:09:58] Successfully sealed new block number=2 hash=5f2db9…ab874c
INFO [11-27|20:09:58] \360\237\224\250 mined potential block number=2 hash=5f2db9…ab874c
INFO [11-27|20:09:58] Commit new mining work number=3 txs=0 uncles=0 elapsed=107.091µs
INFO [11-27|20:09:58] Successfully sealed new block number=3 hash=2bb42c…bde54b
INFO [11-27|20:09:58] \360\237\224\250 mined potential block number=3 hash=2bb42c…bde54b
INFO [11-27|20:09:58] Mining too far in the future wait=2s
what else?
Get the Balance
Let's get the balance of the mining account.
- The first account gets the mining deposits.
- It's also known as the etherbase (or coinbase).
make get-bal
- You'll get something like:
curl http://localhost:8545 --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x'`cat account`'", "latest"],"id":1}'
{"jsonrpc":"2.0","id":1,"result":"0x97c9ce4cf6d5c0000"}
It should be growing too, since it's mining.
Attach to the javascript console
make attach
this uses geth.ipc
but you could also connect to http://localhost:8545
like:
geth attach http://localhost:8545
Next Next Steps
- Next we'll do some stuff in Python.