0

I am creating a voting smart contract that allows participants to vote on a particular issue and have the vote and various ancillary data written to the blockchain. I'm a new Ethereum/Solidity developer and I need help creating a good strategy for the test phase of the smart contract development and deployment when it is residing only on the test net.

I would like to make things as easy as possible on my test users so I'm hoping that I can have the smart contract "fund" the entire vote from Ether I requested from the Rinkeby test net myself (i.e. - from my account). I'm trying to avoid making every test user have to make their own Ether requests from the Rinkeby test net just so they can participate.

In general, how do most of you manage/facilitate the test phase of your smart contracts when they are running on a test net? Is there a good article or paper somewhere that outlines specifically these issues?

1

It's a bit of a chicken-egg scenario because they would need a little ether to sign a transaction to your contract. As an aside, your contract can forward ether it has, but not ether someone else (you) has.

The pattern you're after is a faucet. This would be a website that let's them request ether be sent to their account to bootstrap them from a 0 balance. It might be just as easy to provide clear instructions for collecting from an existing faucet.

For example (Rinkeby): https://faucet.rinkeby.io/

or (Ropsten): http://ipfs.b9lab.com:8080/ipfs/QmWBRdUQsLahC8dWVo3rS9jrFnxGSw3WHm5gcHu3URTv87/throttled_faucet.html

Hope it helps,

  • Is there a way to deploy the contract with an existing balance or "pay" it from my account to fund it as soon as its deployed?, From your answer, should I assume that there's no way to charge all Ether/Gas transaction costs to the contract itself (like putting a meal you buy for someone else on your hotel room bill)? Or are my testers still going to have at least some ether to sign any transactions against the contract, like you said? – Robert Oschler Mar 23 '18 at 0:35
  • Contracts can hold funds and they can forward funds but they can't pay for gas. This is because they can't be the initiator of signed transaction. It always comes from an externally owned account and it always bears the cost of gas to process the request irrespective of how many contracts might be in the chain of messages that unfolds. – Rob Hitchens - B9lab Mar 23 '18 at 1:44

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.