以太坊測試網連接:Connect to the Rospen Network

Posted by Kubeguts on 2018-05-13

Enviroment: MacOS

Assume reader has basic understanding of geth and ethereum.

Create a Ethereum Wallet

We can via myetherwallet to create a wallet.
https://www.myetherwallet.com/#generate-wallet

Record your privakey, pubkey:

1
2
private key: a406da76baa7c741ad28bfe87cef2133950d6bb6bcaaf0b1742d93c3bea56bab
public key: 0x2C58e0338435FE91FD2209105EcADebE8aaFCebB

Because we are going to connect the testnet Rospen, we should do some stuff…

  • Get a ether from faucet:

For simplicity, we just ask someone to send some ether on testnet to us. Please attach your account address to get some ether.

https://l.facebook.com/l.php?u=http%3A%2F%2Ffaucet.ropsten.be%3A3001%2F&h=ATPjPzMFxxXmP_Egwq9V35ye_LjGOM4A_vzMkbQOdLCN8FYVRgfurVVTwrcuUzqNCMUiXF2C8sUqt241q8nmTJO6hCnY7WhpkV6iUVWxsIqjlALAeEVFv_kH5Q

In serch bar, enter your account address to see whether if the ether is sending to your account or not.

Start to build a node and synchronize the Rospen network.

Notice that your geth version should be the latest so that you can sucessfully sync the network.

Current version : Version: 1.8.7-stable

Before sync the node , Put your keystore file in the testnet document.

When you download your keystore file.
For example, the filename will be:
UTC--2018-05-13T04-05-37.569Z--2c58e0338435fe91fd2209105ecadebe8aafcebb
Copy this file into your testnet key store:
/User/Library/Ethereum/testnet/keystore

Sync to the Rospen network

https://github.com/ethereum/ropsten

1
geth --unlock <account> --testnet --syncmode "full" "enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303,enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303"

Threre are some flags:

  • –unlock : use password to unlock the account.
  • –testnet: connect to the rospen network.
  • –syncmode “full”: in order to get our balances, we should synchronize whole blocks.
1
geth --testnet --fast --bootnodes "enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303,enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303"

If we already sync the entire network, we can just use
--fast --bootnodes to connect testnet…

Attach your geth

On MacOS (for testnet):

geth attach ipc:/Users/<username>/Library/Ethereum/testnet/geth.ipc

Then, in the console do eth.syncing

you will see those stuff:

1
2
3
4
5
6
7
8
> eth.syncing
{
currentBlock: 542220,
highestBlock: 3224277,
knownStates: 0,
pulledStates: 0,
startingBlock: 31397
}

That means you are sucessfully connecting the testnet.
After finish syncing process, you can see there is some ether in your accounts

Problem for connecting the ropsten network

https://stackoverflow.com/questions/49195614/connection-failed-to-ethereum-ropsten-testnet-network

Deploy to rospen network toturial:

https://michalzalecki.com/deploying-smart-contracts-with-truffle/