17

I just want to deploy and call a simple sample smart contract only for testing purpose. Do I need to download the entire ethereum blockchain? Its too huge and takes too long to download. Can someone suggest a better option?

7

Ropsten test network is the right choice for you, when you are still testing.

  1. I simply install the Chrome Metamask plugin. It communicates with nodes on a remote server (so no downloading, though Ropsten is not as big as the main chain anyway)

  2. Create a new account after switching to the Ropsten network.

  3. Then you can use the Online Solidity Compiler to deploy the contract, like this:

  4. Top left corner, under Run > Environment, check the 2nd option "injected Web3"

  5. With "Create", you can deploy your contract and Metamask will ask you for your password.

Now you are able to test your contract using the provided interface.

You can also get your smart contracts in the "details" and use it in an application.

Choosing the 1st option "JavaScript VM" will achieve a similar experience but will not actually deploy anything on the network.

  • I use Remix with this approach too. It's very straightforward for beginner, but when I get to know more in Ethereum, I may go for Truffle way, which provide a automatic way for unit-testing – Richard Fu Jul 17 '18 at 7:33
16

Truffle is a development environment, testing framework and asset pipeline for Ethereum, aiming to make life as an Ethereum developer easier. With Truffle, you get:

  • Built-in smart contract compilation, linking, deployment and binary management.
  • Automated contract testing with Mocha and Chai.
  • Configurable build pipeline with support for custom build processes.
  • Scriptable deployment & migrations framework.
  • Network management for deploying to many public & private networks.
  • Interactive console for direct contract communication.
  • Instant rebuilding of assets during development.
  • External script runner that executes scripts within a Truffle environment.
5

You can use Populus (Python based) framework for smart contract development and testing. It comes with standard py.test based unit tests for smart contracts.

It includes

  • Test using TestRPC (instant transactions) or private testnet - no slow blokchain syncing

  • Built-in smart contract compilation, linking, deployment and binary management.

  • Scriptable deployment & migrations framework.

  • Network management for deploying to many public & private networks.

  • Interactive console for direct contract communication from Python prompt

  • Instant rebuilding of assets during development

  • External script runner that executes scripts within a Populus environment (simply do Python import)

Benefits over JavaScript approaches include

  • Cleaner test code - no callback hell (example)

  • More readable test by using assert keyword instead of various equality functions

3

You can use Embark to Deploy and Test both Simple and Complex contracts. By using a simulator or your own private chain there is no need to download an entire blockchain. More details can be found here.

0

Ethereum Wallet: You don't need to download the entire ETH blockchain to use testnet. The Ethereum Wallet is an easy way to deploy contracts on test networks. I would recommend the Rinkeby testnet.

0

A simple and straight forward command line tool for testing Ethereum smart contracts - Ethester. It has minimum of software deps: Python 2.7, Ethereum. Solidity compiler suggested but not required.

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.