1

How to setup a ethereum testnet node locally?

I am new to ethereum please some one help sharing step by step links

swa
  • 91
  • 2
  • 6

1 Answers1

2

What operating system are you on? You need to run a node locally using either Geth or Parity. I prefer Geth. Either one will let you run a node on the Ethereum Ropsten testnet blockchain.

Once it's installed, with apt-get install geth on Ubuntu, you need to run geth --testnet --syncmode="light" --rpc --rpcapi db,eth,net,web3,personal --cache=1024 --rpcport 8545 --rpcaddr 127.0.0.1 --rpccorsdomain "*". This will set up a one-off testnet that uses syncmode="light" to get a super quick copy of the blockchain. Shouldn't take longer than 15-20 mins. If you take out the syncmode="light" it'll take a couple hours to a day to sync, but will be re-usable.

Once it starts syncing, it'll say "imported new block headers" or "imported new state entries" for awhile. When the processed number catches up with the one at ropsten.etherscan.io, you're good to go and your node is caught up.

You're going to get a copy of the chaindata in your ~/.ethereum folder if you're on Ubuntu, ~/AppData/Roaming/Ethereum on Windows in the chaindata folder if you ran it without using light syncmode, and lightchaindata if you used light syncmode. You will need to delete this lightchaindata folder every time you want to run geth again on the fast sync mode.

The other parameters open up geth with web3 and via RPC, and let any domain connect to it. Once you've used Metamask or Ethereum Wallet or Mist to confirm you can connect to the testnet on localhost, you can tweak the options. Metamask is a chrome plugin that lets you access the blockchain. If you click the network in the top left of the plugin, you will be able to select LOCALHOST. If it connects, you're on your local geth testnet instance!

diabetesjones
  • 521
  • 4
  • 11
  • I am using windows 10. I need run node locally only to test my application – swa Jul 04 '17 at 04:28
  • https://github.com/ethereum/go-ethereum/wiki/Installation-instructions-for-Windows

    Here is the Geth install path for your OS.

    – diabetesjones Jul 04 '17 at 04:29
  • https://geth.ethereum.org/downloads/ <-- here specifically. If you need it just for test, definitely use syncmode="light" because it will be done syncing in a much shorter time. – diabetesjones Jul 04 '17 at 04:30
  • how to start node? – swa Jul 04 '17 at 04:32
  • 2
    geth --testnet --syncmode="light" --rpc --rpcapi db,eth,net,web3,personal --cache=1024 --rpcport 8545 --rpcaddr 127.0.0.1 --rpccorsdomain "*" in the command line – diabetesjones Jul 04 '17 at 04:33
  • I think when i kept ur above command in commandline it is INFO [07-04|10:26:36] Imported new block headers count=192 elapsed=62.642ms number=12096 hash=da8539…8a15ca ignored=0...... code is running – swa Jul 04 '17 at 04:56
  • yes if the code is running then you just need to let it run! As long as the number keeps going up. Once it catches up to the number at ropsten.etherscan.io, you will have a fully synced node. – diabetesjones Jul 04 '17 at 05:35
  • I got error and node running stopped and i again try to run same code i got error Fatal: Error starting protocol stack: listen udp :30303: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted. – swa Jul 04 '17 at 06:12
  • You will need to close the terminal and re-open it, as you're trying to run another node at the same time at the same ip/port, which isn't allowed. – diabetesjones Jul 04 '17 at 14:57