Develop DApps on Nervos AppChain.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
contracts
docs
migrations
.gitignore
LICENSE
README.md
box-img-lg.png
box-img-sm.png
package.json
truffle-box.json
truffle-config.js
truffle.js
yarn.lock

README.md

AppChain-Truffle-Box

Chinese

AppChain-Truffle-Box is customized for you to develop DApps on Nervos AppChain. Please refer toour document for more details about Nervos Network.

This project rewrite truffle migrate part of truffle-box, so you need to read truffle-tutorial first, especially RUNNING MIGRATIONS part, this part show you how migrate works in detail.

Installation

  1. Install Truffle globally

To use our truffle box, you need to install truffle first.

yarn global add truffle
  1. Download
git clone https://github.com/cryptape/appchain-truffle-box.git
cd appchain-truffle-box/
rm -rf .git
yarn install

Configuration

You can configure your box in truffle.js.

The configure options are shown below.

module.exports = {
  networks: {
    development: {
      host: 'ip_address', // eg. '121.196.200.225'
      port: 'port', // eg. 1337
      network_id: '*', // Use '*' to match any network id
      privateKey: 'private key', // a string, required
      // the following parameters are OPTIONAL
      // validUntilBlock: 999999, // an int,  default to (current block number)+88
      // nonce: '999', // a string, default to random int
      // quota: 999999, // an int, defaut to 999999
    }, // you can add other network after here
  },
}

networks

You must use 'development' as the key for now.

  • host[required]
    Specify the host ip_address, don't add protocol name.

  • port[required]
    Specify the host port.

  • network_id[required]
    In order to be compatible with truffle, you have to set this attribute, but it's meaningless here.

  • privateKey [required]

    Your private key to send transaction.

  • nonce [optional]
    Nonce is a string used to prevent double-spending, default to be a random number from 1 ~ 100. Note that the type of nonce is string.

  • quota [optional]
    Similar to gas in ethereum, default value is 99999.

  • validUntilBlock [optional]
    Similar to timeout, default to be current block height + 88

Compile

Compile the smart contract.

truffle compile

Migration

First, add your migration scripts in /migration, for the details, please refer RUNNING MIGRATIONS for more details.

Input the command to do migration. (Note that we can NOT use truffle migrate command here...)

yarn migrate