This tutorial is part of a series of articles introduced here.
Part 2 described how to install Ethereum on your computer.
Our development environment requires the setup of a private Ethereum chain.
NB: It is important that what we mean by “private Ethereum blockchain” in this context has absolutely nothing to do with the “private blockchain” championed by Hyperledger, Eris/Monax, or the recently announced Enterprise Ethereum Alliance. These are different codebases with different client applications, so they correspond to different implementations of a different set of concepts. They are private in the sense that they limit who has access to their chain. They are also called permissioned blockchains, and to be perfectly transparent, we wish they were not even called blockchains at all. In this series of articles, what we call “private blockchain” is a private instance of the Ethereum implementation. Same code base, same client application, different network identifier and genesis block. In other words, what we will come to create in this series is a chain with the same rules as the main chain, the same consensus algorithm too, but a different root block. This will become clearer in part 3. For more information about the 3-layer model and differences between concepts, implementations and instances, you can also watch our Devoxx talk and read this article.
Our private chain needs miners in order to validate and propagate blocks of transactions within the blockchain. Miners will also be used to generate ether to pay for the gas required to process transactions on the Ethereum blockchain. Note that this ether will only be usable within our private blockchain.
Unfortunately, the Raspberry pi is not powerful enough to be used as a miner. The mining process is just too intense. This is why we will deploy at least two miners on our computer.
Why two miners and not only one?
At the time of writing this tutorial, Geth has an issue when it is deployed in a private chain. If you have only one miner, some transactions will not be processed and will remain pending. Having two miners solves this issue (check here for more information about the issue). By the way, two miners make sense to apply the notion of consensus within the blockchain.
Let’s start by describing how to create the first miner.
Introduction
Before we describe the steps to start the miners, it is important to understand the requirements for each node to join the same private blockchain:
- Each node will use a distinct data directory to store the database and the wallet.
- Each node must initialize a blockchain based on the same genesis file.
- Each node must join the same network id different from the one reserved by Ethereum (0 to 3 are already reserved).
- The port numbers must be different if different nodes are installed on the same computer.
All the operations must be performed from your computer.
Step 1 – Create the datadir folder
When running a private blockchain, it is highly recommended to use a specific folder to store the data (database and wallet) of the private blockchain without impacting the folders used to store the data coming from the public blockchain.
From your computer, create the folder that will host your first miner:
computer$ mkdir -p ~/ChainSkills/miner1
Repeat the operation for the second miner:
computer$ mkdir -p ~/ChainSkills/miner2
Step 2 – Create the Genesis file
Each blockchain starts with a genesis block that is used to initialize the blockchain and defines the terms and conditions to join the network.
Our genesis block is called “genesis.json” and is stored under “~/ChainSkills” folder.
Create a text file under ~/ChainSkills, called genesis.json, with the following content:
{ "nonce": "0x0000000000000042", "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", "difficulty": "0x400", "alloc": {}, "coinbase": "0x0000000000000000000000000000000000000000", "timestamp": "0x00", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "extraData": "0x436861696e536b696c6c732047656e6573697320426c6f636b", "gasLimit": "0xffffffff", "config": { "chainId": 42, "homesteadBlock": 0, "eip155Block": 0, "eip158Block": 0 } }
Update (24-May-2017): Since Geth 1.6, the genesis.json file has to provide a section “config” identifying the network id (chainId) of your private network. Based on our tutorial, we will use the network Id “42”.
Update (25-Sep-2017): A comma was missing after the gasLimit. We have also converted the extraData string with its hex value to avoid an error during the init phase.
Among the parameters, we have the following ones:
- difficulty: if the value is low, the transactions will be quickly processed within our private blockchain.
- gasLimit: define the limit of Gas expenditure per block. The gasLimit is set to the maximum to avoid being limited to our tests.
Step 3 – Initialize the private blockchain
Step 3.1 – Initialize miner #1
computer$ cd ~/ChainSkills computer$ geth --datadir ~/ChainSkills/miner1 init genesis.json I1226 00:44:16.572007 cmd/utils/flags.go:615] WARNING: No etherbase set and no accounts found as default ... I1226 00:44:16.604262 cmd/geth/chaincmd.go:131] successfully wrote genesis block and/or chain rule set: 6e92f8b23bcdfdf34dc813cfaf1d84b71beac80530506b5d63a2df10fe23a660
- you need a default account
- the blockchain has been successfully created
If you list the content of the miner1 folder, you will notice the following subfolders:
- geth: contains the database of your private blockchain (chaindata).
- keystore: location of your wallet used to store the accounts that you will create on this node.
Step 3.2 – Initialize miner #2
computer$ cd ~/ChainSkills computer$ geth --datadir ~/ChainSkills/miner2 init genesis.json I1226 00:47:14.867704 cmd/utils/flags.go:615] WARNING: No etherbase set and no accounts found as default ... I1226 00:47:14.890635 cmd/geth/chaincmd.go:131] successfully wrote genesis block and/or chain rule set: 6e92f8b23bcdfdf34dc813cfaf1d84b71beac80530506b5d63a2df10fe23a660
Step 4 – Create accounts
Let’s create some accounts for our miners.
Step 4.1 – Accounts for miner #1
Create the default account that will be used to run the node.
This account will receive all ethers created by the miner in the private blockchain. These ethers will serve to test our solutions by paying the gas required to process each transaction.
To create the default account for the miner #1, type the following command. Keep the password in a safe place:
computer$ geth --datadir ~/ChainSkills/miner1 account new Your new account is locked with a password. Please give a password. Do not forget this password. Passphrase: Repeat passphrase: Address: {3e3753727dd6d965c0c696ea5619b8050ca89a49}
computer$ geth --datadir ~/ChainSkills/miner1 account new Your new account is locked with a password. Please give a password. Do not forget this password. Passphrase: Repeat passphrase: Address: {ae3ab39b3ebc425289dad620aece197a4a3f8940}
computer$ ls -al ~/ChainSkills/miner1/keystore -rw------- 1 eloudsa staff 491 Dec 26 00:55 UTC--2016-12-25T23-55-58.526082355Z--3e3753727dd6d965c0c696ea5619b8050ca89a49 -rw------- 1 eloudsa staff 491 Dec 29 17:53 UTC--2016-12-29T16-53-48.822735465Z--ae3ab39b3ebc425289dad620aece197a4a3f8940
computer$ geth --datadir ~/ChainSkills/miner1 account list Account #0: {3e3753727dd6d965c0c696ea5619b8050ca89a49} /Users/eloudsa/ChainSkills/miner1/keystore/UTC--2016-12-25T23-55-58.526082355Z--3e3753727dd6d965c0c696ea5619b8050ca89a49 Account #1: {ae3ab39b3ebc425289dad620aece197a4a3f8940} /Users/eloudsa/ChainSkills/miner1/keystore/UTC--2016-12-29T16-53-48.822735465Z--ae3ab39b3ebc425289dad620aece197a4a3f8940
Step 4.2 – Accounts for miner #2
Repeat the same operation to create the default account for the second miner. The difference lies in the target folder (~/ChainSkills/miner2).
The default account of miner #2:
computer$ geth --datadir ~/ChainSkills/miner2 account new Your new account is locked with a password. Please give a password. Do not forget this password. Passphrase: Repeat passphrase: Address: {22b2f81b46146aa3e1036fd3dc5cbcf12551b2db}
An additional account of miner #2:
computer$ geth --datadir ~/ChainSkills/miner2 account new Your new account is locked with a password. Please give a password. Do not forget this password. Passphrase: Repeat passphrase: Address: {fa919b49ef34a821fb4cadfdfa5cc6593cb46fe1}
computer$ geth --datadir ~/ChainSkills/miner2 account list Account #0: {22b2f81b46146aa3e1036fd3dc5cbcf12551b2db} /Users/eloudsa/ChainSkills/miner2/keystore/UTC--2016-12-26T00-00-12.726226915Z--22b2f81b46146aa3e1036fd3dc5cbcf12551b2db Account #1: {fa919b49ef34a821fb4cadfdfa5cc6593cb46fe1} /Users/eloudsa/ChainSkills/miner2/keystore/UTC--2016-12-29T16-59-28.053461367Z--fa919b49ef34a821fb4cadfdfa5cc6593cb46fe1
Step 5 – Prepare the miners
We are ready to start the miners from our computer and to mine some ethers that will reward our default accounts.
Step 5.1 – Miner #1: setup
computer$ geth --identity "miner1" --networkid 42 --datadir "~/ChainSkills/miner1" --nodiscover --mine --rpc --rpcport "8042" --port "30303" --unlock 0 --password ~/ChainSkills/miner1/password.sec --ipcpath "~/Library/Ethereum/geth.ipc"
The meaning of the main parameters is the following:
- identity: name of our node
- networkid: this network identifier is an arbitrary value that will be used to pair all nodes of the same network. This value must be different from 0 to 3 (already used by the live chains)
- datadir: folder where our private blockchain stores its data
- rpc and rpcport: enabling HTTP-RPC server and giving its listening port number
- port: network listening port number, on which nodes connect to one another to spread new transactions and blocks
- nodiscover: disable the discovery mechanism (we will pair our nodes later)
- mine: mine ethers and transactions
- unlock: id of the default account
- password: path to the file containing the password of the default account
- ipcpath: path where to store the filename for IPC socket/pipe
#!/bin/bash geth --identity "miner1" --networkid 42 --datadir "~/ChainSkills/miner1" --nodiscover --mine --rpc --rpcport "8042" --port "30303" --unlock 0 --password ~/ChainSkills/miner1/password.sec --ipcpath "~/Library/Ethereum/geth.ipc"
Step 5.2 – Miner #1: start
Make the script runnable:
computer$ cd ~/ChainSkills/miner1 computer$ chmod +x startminer1.sh
Let’s start the miner #1:
computer$ ./startminer1.sh ...
Step 5.3 – Miner #1: JavaScript console
computer$ geth attach ... > miner.start() ... > miner.stop() ...
exit
command.Step 5.4 – Miner #1: stop
To stop your miner, go to its console window and press CTRL-C.
Another option is to kill the Geth running process as illustrated here below:
computer$ ps aux | grep geth eloudsa 43872 0.0 2.2 556717632 363492 s001 S+ 3:49PM 1:58.01 geth --identity miner1 --dev computer$ kill -INT 43872
Thanks to the identity parameter, we are able to easily identify the miner instance we want to stop.
Now let’s continue with the second miner.
Step 5.5 – Miner #2: setup
#!/bin/bash geth --identity "miner2" --networkid 42 --datadir "~/ChainSkills/miner2" --nodiscover --mine --rpc --rpcport "8043" --port "30304" --unlock 0 --password ~/ChainSkills/miner2/password.sec
- identity: a specific name used to identify our miner
- datadir: the folder related to the second miner
- rpcport: a specific HTTP-RPC port number used to reach the miner #2
- port: a specific network port number used to reach the miner #2
- password: path of the file containing the password of the default account on the miner #2
Let’s start the miner #2:
computer$ cd ~/ChainSkills/miner2 computer$ chmod +x startminer2.sh computer$ ./startminer2.sh ...
Step 5.6 – Miner #2: JavaScript console
computer$ cd ~/ChainSkills computer$ geth attach ipc:./miner2/geth.ipc
computer$ geth attach http://127.0.0.1:8043 ...
Be aware that these commands may have some limitations such as starting or stopping the mining process:
computer $ geth attach http://127.0.0.1:8043 Welcome to the Geth JavaScript console! instance: Geth/miner2/v1.5.5-stable-ff07d548/darwin/go1.7.4 coinbase: 0x22b2f81b46146aa3e1036fd3dc5cbcf12551b2db at block: 1294 (Sat, 31 Dec 2016 16:08:22 CET) modules: eth:1.0 net:1.0 rpc:1.0 web3:1.0 > miner.stop() ReferenceError: 'miner' is not defined at <anonymous>:1:1
First, you can see that the “miner” module is not specified in the list of modules: eth:1.0 net:1.0 rpc:1.0 web3:1.0
This is the reason why we have an error when we try to stop the mining process.
The following command is more useful:
computer $ geth attach ipc:./miner2/geth.ipc Welcome to the Geth JavaScript console! instance: Geth/miner2/v1.5.5-stable-ff07d548/darwin/go1.7.4 coinbase: 0x22b2f81b46146aa3e1036fd3dc5cbcf12551b2db at block: 1417 (Sat, 31 Dec 2016 16:12:25 CET) datadir: /Users/eloudsa/ChainSkills/miner2 modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 shh:1.0 txpool:1.0 web3:1.0 > miner.stop() true
Here the miner can be managed through the console because the miner module is available from the IPC interface.
Keep this in mind if you have any trouble running a command from the Geth console.
Of course, you can define the modules available for the Geth console by mentioning them from the command line (ipcapi and rpcapi parameters).
For example, let’s change the Geth command by mentioning the “miner” module:
#!/bin/bash geth --identity "miner2" --dev --networkid 42 --datadir "~/ChainSkills/miner2" --nodiscover --mine --rpc --rpcport "8043" --rpcapi "db,eth,net,web3,miner" --port "30304" --unlock 0 --password ~/ChainSkills/miner2/password.sec
Start the miner and open the console with the following command:
computer $ geth attach http://127.0.0.1:8043 Welcome to the Geth JavaScript console! instance: Geth/miner2/v1.5.5-stable-ff07d548/darwin/go1.7.4 coinbase: 0x22b2f81b46146aa3e1036fd3dc5cbcf12551b2db at block: 1473 (Sat, 31 Dec 2016 16:21:22 CET) modules: eth:1.0 miner:1.0 net:1.0 rpc:1.0 web3:1.0
Now the miner module is available from the Geth console!
You can manage the mining process:
> miner.stop() true
This shows that by changing the Geth command, you can allow or restrict the usage of some APIs available from the HTTP-RPC or IPC-RPC interfaces.
Step 5.7 – Miner #2: stop
The principle is the same as described for the miner #1.
Step 6 – Send ethers within miner #1
Step 6.1 – Start the miner and its console
computer$ cd ~/ChainSkills/miner1 computer$ ./startminer1.sh ...
computer$ geth attach ... >
Step 6.2 – Check balances
> eth.coinbase "0x3e3753727dd6d965c0c696ea5619b8050ca89a49"
> eth.accounts ["0x3e3753727dd6d965c0c696ea5619b8050ca89a49", "0xae3ab39b3ebc425289dad620aece197a4a3f8940"]
> eth.getBalance(eth.coinbase) 2.48859375e+21 > eth.getBalance(eth.accounts[1]) 0
> web3.fromWei(eth.getBalance(eth.coinbase)) 3008.125
Step 6.3 – Stop mining
We stop the mining process to let us review the content of a transaction:
> miner.stop() true
Step 6.4 – Send ethers
Through the Geth console, we send 10 ethers from account #0 to account #1:
> eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: web3.toWei(10, "ether")}) "0x4ed5ef14cb5df5069059ac201a7294d810b89dcc05c0f60f970b87bff7faa5b6"
> eth.pendingTransactions [{ blockHash: null, blockNumber: null, from: "0x3e3753727dd6d965c0c696ea5619b8050ca89a49", gas: 90000, gasPrice: 20000000000, hash: "0x4ed5ef14cb5df5069059ac201a7294d810b89dcc05c0f60f970b87bff7faa5b6", input: "0x", nonce: 0, r: "0xdfd5465e315207e41d10a01189c41a1e9b42e7577cd256a100b3fa2157e9b0", s: "0x39b10c973c1e9764e9b3cfd98339164d65e78971c917ae24fe880a2a7c775cf6", to: "0xae3ab39b3ebc425289dad620aece197a4a3f8940", transactionIndex: null, v: "0x1c", value: 10000000000000000000 }]
- The sender address
- The recipient address
- The value to transfer (expressed in Wei)
- The hash of the transaction
- The cost of the transaction (gas x gasPrice) in Wei
Let the miner process the transaction:
> miner.start() true
The transaction is processed:
> eth.pendingTransactions []
Check the balance of the recipient:
> web3.fromWei( eth.getBalance(eth.accounts[1])) 10
The recipient address has received 10 ethers.
Step 7 – Send ethers within miner #2
computer$ geth attach ipc:/Users/eloudsa/ChainSkills/miner2/geth.ipc OR computer$ geth attach http://127.0.0.1:8043
Step 8 – Send ethers between nodes of the private blockchain
Now, let’s try to send ethers between accounts of our miners.
We will send 5 ethers from the default account of the miner #1 to the account #1 of the miner #2.
Step 8.1 – Start miners
First, start both miners (miner #1 and miner #2).
Step 8.2 – Check balance from miner #2
From the Geth console attached to the miner 2, check the initial balance of the account 1:
> web3.fromWei(eth.getBalance(eth.accounts[1])) 10
Step 8.3 – Send Ethers from miner #1
From the console of the first miner, send 5 ethers from the default account (eth.coinbase) to the address of the account 1 in miner #2:
> eth.sendTransaction({from: eth.coinbase, to: '[REPLACE WITH ADDRESS OF ACCOUNT 1 IN MINER #2]', value: web3.toWei(5, "ether")}) "0x866db90bade948dbec0679b0a673807a74d6b3d94b3a7616dd86d72eb8a72e9b"
Step 8.4 – Check balance from miner #1
Check the balance from the Geth console attached to the miner #1:
> web3.fromWei( eth.getBalance("[REPLACE WITH ADDRESS OF ACCOUNT 1 IN MINER #2]")) 5
We have 5 ethers while we should expect 15 ethers.
Step 8.5 – Check balance from miner #2
Check the balance from the Geth console attached to the miner #2:
> web3.fromWei( eth.getBalance(eth.accounts[1])) 10
We have 10 ethers while we should expect 15 ethers.
Why?
Because our miners are not connected to the same blockchain.
Each miner is running its own version of the private blockchain. The transactions are not distributed within the same private blockchain.
To synchronise the blockchain, we have to pair the nodes with each other.
Summary
We have installed our miners but they are not synchronised with each other.
We will do that in Part 4 (what a teaser, man!).
<3 this post serie guys, thanks!
Thank you! Great tutorial so far! I’ll share what minor difficulties I had. With Geth version 1.6.1 I had to change the contents of genesis.json – it should contain configuration part, e.g.:
{
“config”: {
“chainId”: 10,
“homesteadBlock”: 0,
“eip155Block”: 0,
“eip158Block”: 0
},
“alloc” : {},
“difficulty” : “0x4000”,
“gasLimit” : “0xffffffff”
}
Other than that, keep chainId consistent when you initialize miners. I changed it and couldn’t send Transaction (Incorrect Sender Error), so I deleted chaindata and lightchaindata in both miners and reinitialized it with my genesis.json.
Why did you choose network id number 42? Does it mean that our miners join Kovan testnet?
Not with Geth. Kovan is only accessible through the Parity Ethereum client. But to be honest, we didn’t know about Kovan when we wrote this series of posts.
Hi, can I sent ETH from my private blockchain to my public ETH Wallet?
Nope. These are difference blockchain instances entirely, different ledgers, different currencies.
Hi,
Appreciate your tutorial. Went thru it, step-by-step, but in Step 5.2, “miner.start()” returns null. Do I need to update the genesis.json with the coinbase address, in the alloc field, before running it? Have been struggling with this for a day now. Couldn’t find an answer anywhere..
I know its been a while, but did you find a solution to this?
awesome tutorial!
but the genesis.json doesn’t work anymore with the newest version.
first you forgot a comma after the “gasLimit” attribute and you have to encode the extraData to Hex like this:
“extraData”: “0x436861696e536b696c6c732047656e6573697320426c6f636b”,
“gasLimit”: “0xffffffff”,
Just a tip: If you create the account before you initialize the blockchain, you can fund the account by adding this attribute:
“alloc”: {
“7df9a875a174b3bc565e6424a0050ebc1b2d1d82”: { “balance”: “300000” }
}
Hi Demetori
Good point!
We’ve forgot to update the description of the genesis block according our version used in our system.
You’re right, the alloc section can be filled with initial accounts and their balance. But we have decided to start with a clean situation to explain how to create accounts through the Geth console.
Cheers,
Said
eth.getBalance(eth.coinbase)
eth.getBalance(eth.accounts[0])
eth.getBalance(eth.accounts[1])
all returning zero 🙁
genesis.json
{
“nonce”: “0x0000000000000042”,
“mixhash”: “0x0000000000000000000000000000000000000000000000000000000000000000”,
“difficulty”: “1024”,
“alloc”: {},
“coinbase”: “0x0000000000000000000000000000000000000000”,
“timestamp”: “0x00”,
“parentHash”: “0x0000000000000000000000000000000000000000000000000000000000000000”,
“gasLimit”: “4294967295”,
“config”:
{
“chainId”: 42,
“homesteadBlock”: 0,
“eip155Block”: 0,
“eip158Block”: 0
}
}
Hi Vishal
When the blockchain is initalised, there are no accounts.
They have to be created using the following command:
On miner #1:
geth –datadir ~/ChainSkills/miner1 account new
On miner #2:
geth –datadir ~/ChainSkills/miner2 account new
Best,
Said
I tried it but this doesnt work for global network, It just works fine for local network. What if I want to create a private blockchain across global network, e.g. One node in Boston and other in NYC
I tried it but this doesnt work for global network, It just works fine for local network. What if I want to create a private blockchain across global network, e.g. One node in Boston and other in NYC
Hi Himanshu
Yes, you can implement such solutions in a global network using one of the public test networks provided by Ethereum: Ropsten or Rinkeby.
With these test networks, you can test your solutions using fake ethers.
We have a course on Udemy explaining how to create and deploy a Dapp on a test network and on the main network: https://www.udemy.com/getting-started-with-ethereum-solidity-development/?couponCode=REFERRAL10
tgg
Hi,
First thank you for this tutorials! They are well explained and easy to follow.
I am encountering an issue at step 6.1, when I check the balance of my accounts on both nodes, I obtain a return of 0.
I followed the tutorial step by step but get this situation even after doing it a second time.
I see that my miner is mining but no ether is added to my account. I waited for an hour and nothing.
Is it possible that I missed something important to get ethers in the default account of a node ?
Happy new year to you all.
I have found my “error”, I waited not enough time to let the DAG be generated.
INFO [01-07|14:42:11] Generating DAG in progress epoch=0 percentage=99 elapsed=30m16.954s
Now I obtain ether on my account and I am rich ^^ (in my blockchain only, but rich somewhere though)
Can we do something to lower the time needed to generate this ?
I have been reading lot of tutorials available in the internet and i must say this stands out in the crowd. Outstanding tutorials ! Keep up the good work buddy 🙂
I am working on windows 10 OS. geth attach ipc:./miner2/geth.ipc doesn’t work and showing some errors.
Hi Kolla
Which version on Geth are you using?
Cheers
Said
1.7.3
I am working on windows 10 OS. geth attach ipc:./miner2/geth.ipc doesn’t work and showing some errors. The version of geth is 1.7.3. Should I make any changes in startminer2.cmd . Can you please help me ?
Hello, great site of you. I am learning to delevop for smart contract. 🙂
I have the same problem. If geth is running, the file of geth.ipc is appearing there (under library/ethereum/ folder).
How do you mean, I should create the file of geth.ipc?
Best regards
Hello,
I have the problem number 5.6 of the end.
I have to overwrite startminer2.sh this code:
” #! / bin / bash
geth –identity “miner2” –dev –networkid 42 –datadir “~ / ChainSkills / miner2” –nodiscover –mine –rpc –rpcport “8043” –rpcapi “db, eth, net, web3 , Bergmann ” –port” 30304 “–unlock 0 –password ~ / ChainSkills / miner2 / password.sec ”
Unfortunately the advice shows me here:
“Fatal: Failed to unlock developer account: could not decrypt key with given passphrase”
But the password is same. How can I make this problem way?
were you able to solve your problem
hello ,i am getting this error. couldyou help me out please?
Failed to read password file: open ~/chainskills/miner1/password.sec: The system cannot find the path specified.
Hey did you get any solution to your problem?
Hello!
Great tutorial!
>>All the operations must be performed from your computer.
So, but is there any way to use some virtual machines?
Or it is not prohibited and will also work?
Cause there are some problems with memory, cpu e.t.c. and all the needed power is concentrated on my virtual hosts.
Thanks
I followed every step mentioned above and my mining committed successfully but still my account got 0 ether and mining has 0 hashrate. Can you please suggest me some solution?
Hi there,
thanks for this introduction.
Somehow no block is being mined and my account 0 doesn’t get any ETHs. That’s the return:
INFO [09-18|17:44:33.408] Maximum peer count ETH=25 LES=0 total=25
INFO [09-18|17:44:33.416] Starting peer-to-peer node instance=Geth/miner1/v1.8.15-stable/darwin-amd64/go1.11
INFO [09-18|17:44:33.416] Allocated cache and file handles database=/Users/Joachim/Network3/miner1/geth/chaindata cache=768 handles=128
INFO [09-18|17:44:33.435] Initialised chain configuration config=”{ChainID: 42 Homestead: 0 DAO: DAOSupport: false EIP150: EIP155: 0 EIP158: 0 Byzantium: Constantinople: Engine: unknown}”
INFO [09-18|17:44:33.435] Disk storage enabled for ethash caches dir=/Users/Joachim/Network3/miner1/geth/ethash count=3
INFO [09-18|17:44:33.435] Disk storage enabled for ethash DAGs dir=/Users/Joachim/.ethash count=2
INFO [09-18|17:44:33.435] Initialising Ethereum protocol versions=”[63 62]” network=42
INFO [09-18|17:44:33.436] Loaded most recent local header number=0 hash=c0990b…cdd1ab td=1024
INFO [09-18|17:44:33.436] Loaded most recent local full block number=0 hash=c0990b…cdd1ab td=1024
INFO [09-18|17:44:33.437] Loaded most recent local fast block number=0 hash=c0990b…cdd1ab td=1024
INFO [09-18|17:44:33.437] Loaded local transaction journal transactions=0 dropped=0
INFO [09-18|17:44:33.437] Regenerated local transaction journal transactions=0 accounts=0
INFO [09-18|17:44:33.437] Starting P2P networking
INFO [09-18|17:44:33.438] RLPx listener up self=”enode://aced047f1d4fd1aca18a5a0b048528a76041ab1b0faad55c5737b9320f4f52c77399f67ad16a7bbfa6cb60cbbab73973c056e5b3bfc05c6f61a050bef716f001@[::]:30303?discport=0″
INFO [09-18|17:44:33.442] IPC endpoint opened url=/Users/Joachim/Library/Ethereum/geth.ipc
INFO [09-18|17:44:33.443] HTTP endpoint opened url=http://127.0.0.1:8042 cors= vhosts=localhost
WARN [09-18|17:44:33.443] ——————————————————————-
WARN [09-18|17:44:33.443] Referring to accounts by order in the keystore folder is dangerous!
WARN [09-18|17:44:33.443] This functionality is deprecated and will be removed in the future!
WARN [09-18|17:44:33.443] Please use explicit addresses! (can search via `geth account list`)
WARN [09-18|17:44:33.443] ——————————————————————-
INFO [09-18|17:44:34.945] Unlocked account address=0x34040799F6661742c9970e74A3F8a1F495a0DA59
INFO [09-18|17:44:34.946] Transaction pool price threshold updated price=1000000000
INFO [09-18|17:44:34.946] Updated mining threads threads=0
INFO [09-18|17:44:34.946] Transaction pool price threshold updated price=1000000000
INFO [09-18|17:44:34.946] Etherbase automatically configured address=0x34040799F6661742c9970e74A3F8a1F495a0DA59
INFO [09-18|17:44:34.947] Commit new mining work number=1 sealhash=4b0b7c…5d5c34 uncles=0 txs=0 gas=0 fees=0 elapsed=918.014µs
do you solve your problem? i meet the same question.
Hi,
Thanks for the great tutorial I just have one question how do I get the ADDRESS OF ACCOUNT 1 IN MINER #2 ?
Thank you for your help.
Hello Team,
I need your help.
eth.getBalance(eth.coinbase)
eth.getBalance(eth.accounts[0])
eth.getBalance(eth.accounts[1])
These are all returning zero values
In the genesis.json file, i’ ve then added 300000 as you can see below,
{
“nonce”: “0x0000000000000042”,
“mixhash”: “0x0000000000000000000000000000000000000000000000000000000000000000”,
“difficulty”: “0x400”,
“alloc”: {“df4422e1680e688b3a24854c6a4e6d1fff656950”: {“balance”: “300000”},
“cb91a660e913623f1d038710789b55aac0630f27”: {“balance”: “300000”}},
“coinbase”: “0x0000000000000000000000000000000000000000”,
“timestamp”: “0x00”,
“parentHash”: “0x0000000000000000000000000000000000000000000000000000000000000000”,
“extraData”: “0x436861696e536b696c6c732047656e6573697320426c6f636b”,
“gasLimit”: “0x800000”,
“config”: {
“chainId”: 42,
“homesteadBlock”: 0,
“eip155Block”: 0,
“eip158Block”: 0
}
}
and i’m getting 300000 when i’ running these 3 commands in the console
eth.getBalance(eth.coinbase)
eth.getBalance(eth.accounts[0])
eth.getBalance(eth.accounts[1])
but when i’m running this command
eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: web3.toWei(10, “ether”)})
I’m getting an error message “Insufficient funds”
Error: insufficient funds for gas * price + value
at web3.js:3143:20
at web3.js:6347:15
at web3.js:5081:36
at :1:1
can someone help me on this?
Also, could you someone help me to create a smart contract in-order to authenticate users before accesing the raspberry pi
Thank you
Great work!
Nevertheless, I got a “Fatal: Consensus not specified. Exiting!!” error when running the script 🙁
Geth versión dumps this info (could it be that Quorum geth version has a different implementation?):
Geth
Version: 1.7.2-stable
Git Commit: 0d0c507a5945ab63c8441007f022a143e2418f1e
Quorum Version: 2.1.1
Architecture: amd64
Network Id: 1337
Go Version: go1.9.5
Operating System: linux
GOPATH=/home/jadepedro/workspace
GOROOT=/usr/local/go
I followed the tutorial step by step, i have a weird error regarding the geth attach step 5.5 and step 5.6
samdawaliby@samdawaliby-VirtualBox:~/ChainSkills/miner1$ geth attach ipc:./miner1/geth.ipc
Fatal: Unable to attach to remote geth: dial unix ./miner1/geth.ipc: connect: no such file or directory
I added next the rpcap parameters and then i tried to attach to miner 1 (geth attach http://127.0.0.1:8042) and miner 2 (geth attach http://127.0.0.1:8043) and it worked successfully. However what it is weird, when i run miner.start() on miner 1 it works, then when i run miner.start() on miner 2 it works BUT stops the mining on miner1 and i receive later on a big error.
Can you please help me fix this issue? I really checked everything, it just doesn’t seem normal, both miners should work seperatly.
I appreciate your help
Hi,
First of all, thanks for the amazing explanation.
I am completely new in working with blockchains and programming, so any help is more than welcome.
Currently I am at step 5.2 but is does not work on my windows CMD.
Nother using the mining.sh file but just entering the command line works fine.
Furthermore, I was wondering what extra software is needed for step 5.3?
If using windows, make PowerShell script files instead. Then use:
https://tecadmin.net/powershell-running-scripts-is-disabled-system/ to run.
5.3 does not require any more software. Just type “geth attach” in a new cmd window