/truffle-dappchain-example

Example of Truffle configured with Loom Truffle Provider

Primary LanguageJavaScriptBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Truffle DappChain Example

Simple example of Truffle interacting with Loom DappChain, this example uses loom-truffle-provider (check LoomTruffleProvider repository for more details)

Requirements

Node >= 8

Install

In order to download the Truffle DAppChain Example there're two methods Git or Unbox

Git method

git clone https://github.com/loomnetwork/truffle-dappchain-example
cd truffle-dappchain-example

yarn install
# or
npm install

Unbox method

# Install Truffle if not installed
npm install -g truffle

mkdir truffle-dappchain-example
cd truffle-dappchain-example

truffle unbox loomnetwork/truffle-dappchain-example

Start DappChain

# Download
curl https://raw.githubusercontent.com/loomnetwork/loom-sdk-documentation/master/scripts/get_loom.sh | sh

# Run
./loom init
./loom run

Deploy Truffle

# On second terminal

# Deploy Migrations.sol and SimpleStore.sol
yarn deploy

# Running test on directory /test
yarn test

In order to correctly redeploy the contracts there's a command "yarn deploy:reset"

Also is possible to call truffle command directly by call "yarn truffle"

We're not versioning the build directory for this particular example, although is recommended to versioning, the limitation can be removed by editing .gitignore

Web interface

The web interface is build with React using webpack to compile and generate the page

# On a third terminal

yarn serve

The web interface will be available on http://localhost:8080

Current limitations

  • Events declared on smart contracts should have an named parameter like NewValueSet(uint _value) in the contract SimpleStore.sol. Also it helps to dealing with events

Loom Network

https://loomx.io

License

BSD 3-Clause License