Skip to content

Latest commit

 

History

History
211 lines (141 loc) · 5.69 KB

developmentEnvironment.md

File metadata and controls

211 lines (141 loc) · 5.69 KB

Augmint Contracts - development environment

Install

These instructions are about the dev environment for contract development. For UI development see augmint-web repo

OSX / Linux

  1. Git

  2. Ethereum CLI

  3. nodejs
    NB: check supported node version in package.json

    Installing nodejs with n node version manager:

    npm install -g n
    n <node version, eg: 10.15.3>
    
  4. Yarn: npm install -g yarn@<version>
    NB: check required yarn version in package.json

  5. Docker cli

  6. git clone https://github.com/Augmint/augmint-contracts.git
    cd augmint-contracts
    yarn install
    

Windows

NB: windows install was not tested since a while, update on it is welcome

  1. Git Bash (required for truffle & yarn start)

  2. Git (if you haven't installed it as part of Git Bash in previous step)

  3. Ethereum CLI - including development tools

  4. nodejs
    NB: check supported node version in package.json

    Installing nodejs with Node Version Manager(NVM):

    nvm install <node version number, eg: 10.15.3>
    nvm use 10.15.3
    
  5. in Git bash:

    git clone https://github.com/Augmint/augmint-contracts.git
    cd augmint-contracts
    yarn install
    

Launch

1. Update to latest augmint-contracts

git pull
yarn install # if there were any node package changes in packages.json

2. Deploy to network

ganache-cli (formerly testrpc)

yarn start (runs truffle migrate with --reset flag)

or

  • yarn ganache:run or ./scripts/runganache.sh
  • in separate console:
    yarn migrate
    or to overwrite existing migration:
    yarn migrate --reset

NB: if you get this error from migration:

Error: Attempting to run transaction which calls a contract function, but recipient address 0xd217ac4354211cda27dd4027b5e223280f885ad3 is not a contract address

then you either need to do a yarn clean before yarn migrate or run migration as yarn migrate --reset

Tests

yarn start
yarn test

Publish NPM package

When the abiniser directory changed:

  • bump the version property in the package.json
  • release a new version as usual (staging -> master, git tag & github release)
  • npm publish from master branch. test it with --dry-run

Docker Image

A docker image with an initial state of the contracts in ganache is published for development of dependent packages.

The image is published to augmint/contracts dockerhub repo.

NB: augmint-contracts' own tests are also running on this container at Travis

Running docker image

yarn docker:start
yarnd docker:stop

Build docker image

  • localchaindb:builddocker : deletes local chain data folder (./localchaindb), launches ganache, migrates contracts and builds a docker image with localdockerimage name
  • docker:run : removes previous ganache container and runs a new from the docker image labeled localdockerimage
  • docker:start & docker:stop: start / stop ganache container

Publish docker image

Travis set to generate a docker image for master and staging branch builds. See .travis.yml

Tags

  • yarn docker:tag:build: every published image tagged with build-travisbuildnumber and commit-xxxxx
  • yarn docker:tag:staging : on staging branch image tagged with staging
  • yarn docker:tag:latest : on master branch image tagged with latest
  • yarn docker:tag:version : on master branch image tagged with vx.x.x tags (from git tag if it's in semver format)

Sequence diagrams

Sequence diagrams in docs folder are created with plant UML. To edit them there are two Atom editor plugins: plantuml-preview and language-plantuml

Non ganache launches/deploys

Private chain

First init

cd privatechain
./createprivatechain.sh
cd ..
truffle migrate
cp ./build/contracts/\* ./src/contractsBuild

Launch

cd privatechain
./runprivatechain.sh

Reset privatechain

cd privatechain
rm -r chaindata/geth
./createprivatechain.sh
cd ..
truffle migrate --network privatechain
cp ./build/contracts/\* ./src/contractsBuild

Rinkeby & main networks

For new deploys on rinkeby and main net see migration instructions

### Alternative ganache launches

Alternatively: Ganache UI

If you use ganache UI then

  • set the port to 8545
  • For running UI tests set mnemonic:
    hello build tongue rack parade express shine salute glare rate spice stock

Alternatively: truffle develop

NB: truffle runs local chain on localhost:9545

  1. truffle develop

  2. in truffle console:
    migrate or
    migrate --reset to overwrite existing migration

  3. cp ./build/contracts/* ./src/contractsBuild

    TODO: use same mnemonic & port as runganache.sh