5

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
    No, you don't need a full node. You can, e.g., deploy your contract via MetaMask or directly using Infura. – user19510 Dec 21 '17 at 20:20
  • If you don't need to call the historic data in blockchain, consider using 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. – Roman Frolov Dec 21 '17 at 20:27
  • @smarx How do I deploy on web3/truffle and have it connect to MetaMask? – JorahFriendzone Dec 21 '17 at 21:21
  • I think that the easiest way is to just use Remix and deploy via the "injected web3" option, with MetaMask pointed at Rinkeby. See programtheblockchain.com/posts/2017/12/19/…. – user19510 Dec 22 '17 at 0:32
0

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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