GithubHelp home page GithubHelp logo

pinkdiamond1 / truffle-dappchain-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from loomnetwork/truffle-dappchain-example

0.0 0.0 0.0 1.63 MB

Example of Truffle configured with Loom Truffle Provider

License: BSD 3-Clause "New" or "Revised" License

JavaScript 94.39% Solidity 5.61%

truffle-dappchain-example's Introduction

Truffle DappChain Example

This simple example shows how you can use Truffle and the Loom Truffle Provider to build a simple Web UI that interacts with the Loom PlasmaChain.

Requirements

Make sure the following requirements are met and then follow the steps in the next section:

Recommended Node version v10.15.3
yarn or npm

Install

First, let's clone this repository. Open a terminal, cd into the directory where you store your projects, and run the following command:

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

Next, cd into truffle-dappchain-example:

cd truffle-dappchain-example

and run:

yarn install

Run against Loom Testnet

Generate the Loom private key

The following command will download the loom binary and generate the private key for you:

yarn gen:extdev-key

This will download the loom binary and generate a private key. The private key will be saved into a file called extdev_private_key.

Deploy to extdev_plasma_us1

As an example, we will deploy and run our application against extdev_plasma_us1.

Run the following command:

yarn deploy:extdev

The above command will compile and then deploy our smart contract to extdev_plasma_us1

Test

Run this command below to send transactions to the smart contract deployed to extdev_plasma_us1:

yarn test:extdev

If everything looks good, let's spin up a web server and interact with our smart contract.

Start the web interface

The web interface is built with React and Webpack. Open a new terminal and run the following command:

yarn serve:extdev

The web interface is available on http://localhost:8080.

Run against local Loom chain

First, you have to generate a private key using:

yarn gen:loom-key

This will download the loom binary and write a private key to a file called loom_private_key

Spin up Loom Chain

In a new terminal, run:

yarn loom:init

and then:

yarn loom:run

Deploy the smart contract

To deploy, run the following command:

yarn deploy

Test

yarn test

Web interface

We're ready to start the web server. In a new terminal, run:

yarn serve

Useful information

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

  2. Also is possible to call truffle command directly with yarn truffle.

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

Current limitations

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

Loom Network

https://loomx.io

License

BSD 3-Clause License

truffle-dappchain-example's People

Contributors

aaruel avatar adyromantika avatar andreipope avatar eduardonunesp avatar enlight avatar gakonst avatar glesaint avatar kevinbluer avatar lukezhangstudio avatar mattkanwisher avatar mimiiiz avatar nightingaleash avatar sebkim avatar sidharthramesh avatar tstxni97 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.