Skip to content

Development Environment

Don Marti edited this page Jul 28, 2017 · 3 revisions

This page has our notes on our smart contract development environment. Andy is currently working on a packaged environment that will cover the web2 and web3 environments.

Web2 Dev Environment:

See the readme

Web3 Dev Environment:

Packages:

  • Truffle 3.2.2 (more recent versions I've had a few problems with)
  • Metamask 3.8.0
  • testrpc v4.0.1
  • geth 1.5.5

For Dapp development:

We should develop in solidity and javascript, using the standard libraries provided by truffle(well supported). Rich is tooling up and getting some simple dapps with tests running under truffle. Sadly, metamask is our only option for web3 injection and browsing.

Available synced ethereum nodes and virts:

  • Linux Virts: We have geth syncing testnet on the linode "wfpbb". Andy has a linode virt up running a web2 app.
  • Ethereum-only nodes: We have an Infura setup

Step by step (not complete)

From zero to running unit tests in metamask:

sudo npm install n -g
sudo npm install -g scrypt
sudo npm uninstall truffle
sudo npm uninstall -g ethereumjs-testrpc
sudo npm install -g truffle@3.2.2
sudo npm install -g ethereumjs-testrpc
mkdir stuff
cd stuff
truffle init webpack
npm install truffle-default-builder --save

truffle compile
truffle build
truffle migrate --reset
truffle migrate --network ropsten 
truffle serve ( or "npm run dev" - seems to work on truffle 3.3)

Right here goes some other stuff like editing truffle.js, setting up testrpc and/or geth, funding metamask wallets, etc.

config metamask to talk to testrpc or geth
import a testrpc or geth private key into metamask
use the dapp

here we need the truffle unit test config

Howtos

Installing truffle and getting started: https://github.com/richbodo/building_blocks/blob/master/docs/truffle_testrpc_install.md

Getting testrpc to work with metamask: http://truffleframework.com/tutorials/truffle-and-metamask

Using the default builder and more about truffle 3 settings:

http://truffleframework.com/tutorials/upgrading-from-truffle-2-to-3

Old reliable reality check without web3:

https://medium.com/@codingwithgas/this-is-a-code-block-906bf915e290

Other stuff to try, sometime, if we get the chance:

Docker config:

https://github.com/dougvk/truffle3-frontend-example

Dapp packages and dev environments:

https://github.com/OpenZeppelin/zeppelin-solidity

https://truffle-box.github.io/

https://github.com/iurimatias/embark-framework/blob/develop/README.md

Developer Questions - needs a home

Solidity

  1. Does inheriting contract methods exact a performance penalty?
  2. Is it better to handle a set of items as an array, or a mapping coupled with a counter variable?

  3. How to handle events? Can they be used to store historical data instead of transactions?

    event data is NOT available inside contracts.

Clone this wiki locally