Based on Ubuntu 14.04.4 contains Geth a full Go-Client for Ethereum decentralized app platform.
3.5K
Based on Official Ubuntu base image (trusty) from ubuntu:14.04.4
This Dockerfile stands for a full ethereum node where you can connect via JSON RPC API and the JavaScript Runtime Environment JSRE with interactive Console and Script Mode. Besides this Solidity as Contract Compiler is already installed.
The full Ethereum Blockchain needs actually about 3,1 GByte in testnet and for mining 1,2 GByte for each Ethash epoche.
Pull from dockerhub:
docker pull blakeberg/geth-node
or copy the sources to your docker host and build on your own.
docker build --force-rm -t blakeberg/geth-node .
docker run -d -h geth --name geth -p 20022:22 -p 8545:8545 blakeberg/geth-node
Connect with ssh use the port that was just located:
ssh -p 20022 geth@localhost
if you us boot2docker you shoud add to your /etc/hosts under Windows or Mac OS X the IP and host name of the boot2docker VM
192.168.99.100 geth(IP to verify)
Decentralized platform that runs smart contracts or especially applications that run exactly as coded without downtime, censorship, fraud or third party smog. Applications so called Dapps need just an Ethereum client node which is connected in Ethereum networks and syncs the Blockchain - the decentralized public ledger and global world computer.
A Dapp contains one or more contracts and a graphical user interface to handle it.
The Ethereum node can be started inside the container within a ssh session or outside from host via docker exec command.
It will need a long time (3+ hours) to sync all blocks from testnet about 2,6GB for full blockchain
~/.ethereum/testnet/chaindata. You can see the state via JavaScript console typeeth.syncing
Instead of geth ... and geth attach you can run get console to get both logging and interactive JavaScript console.
If you have an issue with cross origin requests you can allow all domains with parameter
--rpccorsdomain "*"and if you can't connect to geth node you can allow all adresses with parameter--rpcaddr "0.0.0.0"
The url http://meteor:3000 was set as --rpccorsdomain for a dapp running in container "meteor-nodejs". (link below)
geth helpnohup geth --testnet --rpc --rpcaddr "geth" --rpccorsdomain "http://meteor:3000" &tail -f nohup.outcurl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' http://geth:8545 and will get a JSON Response {"id":67,"jsonrpc":"2.0","result":"Geth/v1.3.6/linux/go1.5.1"}geth attach and then admin.nodeInfo to get similiar info to request with curl beforeecho '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' | nc -U ~/.ethereum/geth.ipc (gets the same JSON response)docker exec --user geth -d geth nohup geth --testnet --rpc --rpcaddr "geth" --rpccorsdomain "http://meteor:3000" &curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' http://localhost:8545docker exec -i --user geth geth geth attach to open interactivelyadmin.nodeInfo to get similiar info to request with curl beforeIf you use boot2docker outside means the boot2docker VM in VirtualBox.
If your client running attach to JavaScript console and you will get an information about these module (Management APIs) with its versions modules: admin:1.0 db:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 shh:1.0 txpool:1.0 web3:1.0
You can and should restrict these modules to RPC API with --rpcapi "eth,web3" cause these interface will give everyone access to the API who can access this interface!
you can also restrict JSON IPC Api with
--ipcapi "admin,eth"and disable JSON IPC Api--ipcdisable. JSON RPC API won't be enabled if you not add--rpcapi. By default geth enables all API's over the ipc interface and only the db, eth, net and web3 for Dapps.
admindb (same as web3.db)debugeth (same as web3.eth)miner (you need to have an account)net (same as web3.net)personalshh (same as web3.shh)txpoolweb3 as it contains the modules net, eth, db and shhMining Ether = Securing the network = verify computation while Ether is the currency. You will get 5 Ether for a successful mined block with a much lower difficulty in testnet morden. You will need Ether to deploy contracts, interact with it and able to make transactions. At least one Ether is more than enough cause Gas price for (contract) computation takes about 20 Gwei (1 Ether = 1000000000 Gwei).
If you have already an account with ether you can send ether to newly created account at step 2 and skip the other steps go directly to contracts.
Before you start mining you should have been synced the full blockchain.
personal.newAccount("newpass")
(take this adress as 0x0...)miner.setEtherbase("0x0...")eth.syncing (you should have currentBlock=highestBlock before mining)miner.start()miner.hashrateweb3.eth.getBalance("0x0...")miner.stop() (if you have balance > 0)Mining will take 100% cpu and take some while depending on your cpu sha-3 hash performance.
It will take some time (15+ minutes) to generate about 1,2GB Ethash ~/.ethash. If your mining has begun you can see this with a hashrate > 0 from JavaScript console via miner.hashrate.
Don't loose your private keys
~/.ethereum/testnet/keystorecause you won't have access to your account and ether without them.
Solidity is a high-level language whose syntax is similar to that of JavaScript and it is designed to compile to code for the Ethereum Virtual Machine. This is a quick guide to use solidity and compile a sample contract.
You can find the solidity file for "Greeter" - a hello world contract under ~/greeter.sol.
solc --helpsolc --gas greeter.solsolc --userdoc greeter.solsolc --devdoc greeter.solsolc --optimize --bin --bin-runtime greeter.solsolc --abi greeter.sol
(you will need the JSON from greeter ABI)geth attachadmin.setSolc('/usr/bin/solc')eth.getCompilers() and you will get a JSON Response ["Solidity"]0x0608616212f0356c3d4c7c7b1c317151646164e1 and see contract in blockchain explorer (link below)var abi = <see ABI above>;var greeter = eth.contract(abi).at("0x0608616212f0356c3d4c7c7b1c317151646164e1");greeter for basic informationsgreeter.greet();loadScript('/home/geth/greeter.js');greeter2 for basic informationsgreeter2.greet();greeter.kill.sendTransaction({from:eth.accounts[0]})eth.getCode(greeter2.address) (you get 0 if the transaction for kill finished)eth.getStorageAt(greeter2.address) (you get 0 if the transaction for kill finished)Content type
Image
Digest
Size
179.9 MB
Last updated
about 9 years ago
docker pull blakeberg/geth-node