2

I don't want to run an ethereum node on my local machine, but for my project I need to tests solidity contracts. Are there any tools that allow such thing?

  • 1
    You can use testrpc or deploy an isolated private test network. – Ismael Oct 15 '17 at 19:11
  • Yes, that seems like what I'm looking for. I will try this and let people know how it goes. I will probably use truffle for tests alongside testrpc. cheers! – viknek Oct 15 '17 at 20:45
1

Is there a way to unit test Solidity contractswithout running ethereum node? I don't want to run an ethereum node on my local machine

Since your Question is to test smart contract without running in a node, suggesting to have a private network is not the answer, although its a good way to test smart Contracts. And as mentioned in @jojeyh's answer

You have to run a node at least locally

I don't think its necessary for you to have a node running.

With Remix IDE, the browser IDE of solidity, You have two options for this.

  1. Use Injected web3 with a service like metamask (you have to install the browser plugin) and connect to a test network.
  2. Use JavaScript VM to test smart contracts without actually deploying it to a network.

All what you have to do is to select the environment to be JavaScriptVM or InjectedWeb3.

enter image description here

This question might also be useful to you.

OR With testrpc

What you are looking for is not the browser based one, you can always use testrpc as @ismael mentioned in a comment. And as mentioned in there github repo they use EthereumJS to simulate fullnode behavior hence your goal is achieved.

testrpc is a Node.js based Ethereum client for testing and development. It uses ethereumjs to simulate full client behavior and make developing Ethereum applications much faster. It also includes all popular RPC functions and features (like events) and can be run deterministically to make development a breeze.

OR

if you want to setup a private node as suggested by some others, refer go-ethereum github wiki page at first. but in this case you are running a node.

Hope this helps!

  • I would rather avoid using web interfaces as I need something a bit more lower level for my project, but this will be my second option. Thanks! – viknek Oct 15 '17 at 21:05
  • I didn't mention it since it was in @ismael 's comment. I'll add that to answer – Achala Dissanayake Oct 17 '17 at 19:44
1

You have to run a node at least locally, but I think private chains are what you're looking for. Basically you just run a private chain on your local computer (create your own chain) and then mine that chain so it processes transactions (your contracts).

Check this, its a great tutorial to get started on Ubuntu.

You can also use a test chain and get test ethers through a faucet. I use Ropsten and it works well. Technically you'll be running a node and it might take a little to sync but then you can deploy contracts on an actual network.

Cheers

  • I would rather use something a bit more light weight like testrpc. Thanks! – viknek Oct 15 '17 at 21:06

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.