6

I have Ethereum Wallet v0.7.3, and was eager to try out my first contract on the testnet, but of course need ether.

Is it better to just create a private testnet? Is mining testnet ether feasible? Can I get enough to test a basic contract in a day? Are there testnet faucets?

2
  • Welcome to Ethereum Stack Exchange! It is preferred if you can post separate questions instead of combining your questions into one. That way, it helps the people answering your question and also others hunting for at least one of your questions. Thanks!
    – q9f
    Commented May 20, 2016 at 12:57
  • The other Q & A doesn't go into as much detail about the specific concern of getting testnet ether, but there certainly is some overlap. Commented May 20, 2016 at 15:50

4 Answers 4

7

Q: testnet or private? Is it better to just create a private testnet?

One advantage of using the testnet is that there are testnet block explorers like https://testnet.etherscan.io/ and https://morden.ether.camp/ if you need to examine your blockchain.

One problem with Testnet is that there are few peers running the Testnet blockchain. When you are trying to sync to the Testnet blockchain, you may find that geth will sometimes lose it's peer connections, and that you may have to restart geth --testnet manually to kick-start the peer connections.

If you are using your own private network, you don't have to worry about syncing as you are building your own blockchain. It's a little bit harder to connect your geth --dev instance to Ethereum Wallet if you intend to use the Ethereum Wallet, as you have to specify the location of the geth.ipc file for Ethereum Wallet to communicate with geth.


Q: How to get testnet ether? Is mining testnet ether feasible? Can I get enough to test a basic contract in a day?

Run the Ethereum Wallet (Mist). Select the TEST-NET network using the menu Develop -> Network -> Testnet (Morden).

Select the menu Develop -> Start Mining (Testnet only).

Once the blockchain is synced, you should have some Testnet ethers within 20 minutes, mining using the CPU only.


Q: Are there testnet faucets?

There are Testnet faucets, but when I was testing a few weeks ago, I could not get these to work. It was easier to mine the Testnet and wait 20 minutes or so.


See also How to create a temporary account for testnet with funds?

6

You can mine on testnet relatively easy to earn ether. From your geth console run miner.start(X) (where X is the number of threads it should use) and let it run for a while. I think in about 30 minutes I was able to mine roughly 150 ether. But your mileage may vary

Using the testnet would probably be a little easier than setting up your own private net. I actually run a dedicated testnet node just for experimentation.

2
  • for another datapoint, after 10 hours, I was able to mine 10 ether. I just used the GUI wallet and selected Mining from the Develop dropdown menu. Commented May 19, 2016 at 23:28
  • Using geth from the console may be a bit faster. I think it may also depend on the number of nodes on the network at that particular time.
    – dbryson
    Commented May 20, 2016 at 0:09
2

better is quite subjective and ymmv but I found that running a private net was quite a good way to understand more deeply the ins and outs of the various options in the client.

2
  • True. A private net does let you experiment with more internals. But using the testnet is a quick way to tryout a contract on the decentralized network while also having a more realistic sense of latency and other factors. I don't think I mentioned that it was necessarily 'better'
    – dbryson
    Commented May 19, 2016 at 15:09
  • better was referring to OP question, you effectively didn't make that distinction (^_o) !
    – euri10
    Commented May 19, 2016 at 15:14
0

Defenitley testnet, is the best thing for work and develop, here are the steps to install all what you need, run the geth miner and get some ethers easily:

Install eth && geth

Follow the instructions on this tutorial to intall eth and geth (I reccomend to install both of them): https://ethereum.org/cli Install solc

Follow the instrucitons on the sol compiler install here: https://ethereum.org/greeter Create you testnet blockchain

Create a new folder where you testnet will be located with a genesis.json file with this content:

{
    "nonce": "0xdeadbeefdeadbeef",
    "timestamp": "0x0",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "0x0",
    "gasLimit": "0x8000000",
    "difficulty": "0x400",
    "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "coinbase": "0x3333333333333333333333333333333333333333",
    "alloc": {
    }
}

More info about the genesis creation here: http://adeduke.com/2015/08/how-to-create-a-private-ethereum-chain/ Create your new account && start mining

Go to the app directory and run the folowwing command changing the fields to match your testnet directory and run it.

geth --genesis [YOU TESTNET DIRECTORY]/genesis.json --datadir[YOU TESTNET DIRECTORY] --rpc --rpcaddr="0.0.0.0" --verbosity=2 --maxpeers=0 --rpccorsdomain="http://localhost:3000" console

Once you are in we need to create a new account and select our password:

Run personal.newAccount() and put your new password.

Create a file called password-testnet and put you passoword there.

Now we have our account with teh password on a file we can start mining our testnet, change the directory on on the following command and run it.

geth --genesis [YOUR TESTNET DIRECTORY]/genesis.json --datadir [YOUR TESTNET DIRECTORY] --rpc --rpcaddr="0.0.0.0" --verbosity=5 --maxpeers=0 --rpccorsdomain="http://localhost:3000" --nodiscover --unlock=0 --password="password-testnet" --mine
1
  • 1
    Quite complicated. Why not simply geth -testnet or geth -dev ?
    – bortzmeyer
    Commented May 19, 2016 at 17:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.