0

I have an issue with Geth, I want to compile and deploy a smart contract, and in order to do that, I have added ether to my wallet. We can verify the transaction here : https://etherscan.io/tx/0x0b3247c2c1d1f26411486ad3ee4fd47e2a8b71de56af0b0fe6759586dd18f6b5 where we can see the transaction is in the 4 679 731th block

Here, we can verify the amount of ether in the wallet : https://etherscan.io/address/0x704e2b488674afa69069a165d3c8a80a27c30d6f which is 0,075 ether.

Then,

I have built a virtual machine with an vanilla Ubuntu, install geth (v1.7.0-stable-6c6c7b2a) and try to sync from the 10-29-2017 to the 12-20-2017. I launch geth with : geth console

In my research, I have found two commands which can determine the progress of the sync :

var sync = web3.eth.syncing;sync;

give :

{ currentBlock: 1144835, highestBlock: 1720228, knownStates: 33418, pulledStates: 25707, startingBlock: 1144067 }

eth.getBlock("latest").number

give :

0

I used the following command to check how many ether an account have :

web3.fromWei(eth.getBalance("0x704e2b488674aFa69069A165D3C8a80A27C30D6f"), "ether")

give :

0

So in two month, I'm not sync, and my geth don't know how many ether I have on my account. I have apparently sync to the 1 144 835th block, and the transaction is in the 4 679 731th block, so I think it's normal, but in two months ? Do I have to wait 8 months to start using Geth ? It's not acceptable.

So I have built a second virtual machine on 12-29-2017 with the same vanilla Ubuntu, install geth (1.7.3-stable-4bb3c89d) and try to sync. The difference with the first : I launch with the fast syncmode : geth --fast --cache=1024 console.

Now, the commands

var sync = web3.eth.syncing;sync;

give :

{
  currentBlock: 3872910,
  highestBlock: 4884396,
  knownStates: 3180,
  pulledStates: 2379,
  startingBlock: 3865878
}
eth.getBlock("latest").number

give :

0

and

web3.fromWei(eth.getBalance("0x704e2b488674aFa69069A165D3C8a80A27C30D6f"), "ether")

give :

0

So in 12 days, I have sync 4x more, but in the 4 last days, I have the message : WARN [01-10|01:01:40] Rolled back headers count=2048 header=3894230->3892182 fast=3872910->3872910 block=0->0 every time and it doesn't sync more.

So I tried a third time on my personal computer, a windows 8.1, install geth (1.7.3-stable-4bb3c89d) and try to sync from the 01-07-2018 with command line : geth.exe --syncmode "full" console

Now, the commands

var sync = web3.eth.syncing;sync;

give :

{ currentBlock: 4881711, highestBlock: 4884507, knownStates: 34771, pulledStates: 26470, startingBlock: 4880214 }

eth.getBlock("latest").number

give :

0

and

web3.fromWei(eth.getBalance("0x704e2b488674aFa69069A165D3C8a80A27C30D6f"), "ether")

give :

0

So I have reached the targeted block (4 679 731) in one day, but geth always states that I have 0 ether in my account ?

My question is : how can I sync so I can start to work with SmartContract ?

When I search on the web, the only anwser I can read is to wait. I don't want to read this anwser anymore, or tell me a real method that can show me the real progress.

Jeff
  • 11
  • 3

1 Answers1

2

Syncing can be very frustrating. However, you don't need to constantly rebuild VMs to try to get a fully sync'ed node. Usually, you can just stop and restart geth and it'll find new peers and resume downloading the blockchain from where it left off. Starting from a blank slate, it's not uncommon for it to take close to a day to fully sync mainnet.

You do have alternatives, though. If you're just looking to develop smart contracts, you can use Truffle/Ganache (formerly, TestRPC) to run a local private dev blockchain. Remix is a development tool which can connect to TestRPC or you can execute smart contracts within it's own internal VM. If you want to connect to mainnet or testnet, you can use the MetaMask plugin which doesn't require you to have a sync'ed local node (Remix can connect through MetaMask as well). Finally, you can try using geth --light to enable light syncing mode.

Adam Kipnis
  • 10,175
  • 10
  • 35
  • 48