I'm currently trying to test my contract code on Rinkeby. If I'm not mistaken, I need to run a full Rinkeby node on my hard drive right? I did geth --rinkeby
but it's taking a long time to sync. Am I approaching this correctly? Do I even need a full node?
2 Answers
The first thing you will have to do is get a lot of ether to work with on the Rinkeby test network.
Remember, doing anything is going to take some amount of ether. Luckily, on Rinkeby we can easily request more ether for testing purposes.
Second, you want to head over to https://faucet.rinkeby.io/ to test this contract of yours.
In order to use this test faucet you have to create a new post from a Twitter account, a Google Plus account or a Facebook account that contains your account address.
You then paste the link to that social networking post on https://faucet.rinkeby.io/ and then request up to 18.75 ether.
This is more involved, they want you to use a social networking account just to keep people from spamming and getting so much ether and bogging down the network.
I am going to assume you probably already have one of these accounts.
So you go into your social network account and then click on the Rinkeby test network that you should have as an extension with metamask on Chrome and click on the three dots and copy the address to clipboard and then paste it into a tweet, or G+ post or facebook post.
And then get a copy of the url to that post or tweet and paste into the input bar of the Rinkeby authenticated faucet.
Click on the Give me ether, and ensured you select 18.75 ethers and then wait to get funded. You can’t do this again until 39 hours later.
Then open metamask again, make sure you have Rinkeby test network selected and you should see 18.75 ether pop up.
Please take this opportunity to make sure you're running at least version 8.0.0 of Node JS. You can check your current version by running the command node -v
at your command line.
If you are running an older version, you can easily update it by grabbing an updater here: https://nodejs.org/en/download/.
You can use Truffle for contract creation, testing and deployment to Rinkeby, but because it is undergoing rapid development which means things are breaking all the time, I wouldn't recommend it. Feel free to peruse through all the posts on this forum regarding problems with Truffle.
Instead, you can create a custom node project from scratch that is going to aid you in contract creation, testing and deployment to Rinkeby.
Remix is great but its limited to the browser. Instead, make your own custom project on your own code editor and write Solidity in JavaScript.
I would test it with Mocha and then setup a deployment script to deploy to Rinkeby.
If you're just testing you can also use a public API to the Rinkeby network like rinkeby.infura.io (requires a free API key). There is also a WebSocket interface that supports subscriptions and doesn't require an API key.
Read more in the Infura docs.
geth --rinkeby --fast
. Short definition of fast sync: it gets the block headers, the block bodies, it processes no transactions until current block - 1024. Then it gets a snapshot state and goes like a full synchronization.