Using Truffle

Truffle is a development environment, testing framework and asset pipeline for Ethereum, aiming to make life as an Ethereum developer easier.

Adding Truffle to your project

You'll need Node.js v8+arrow-up-right installed before we get started. And you can choose a preferred package management tool to begin with:

# To use truffle locally in your project, you must init a package.json file
$ npm init

# Install truffle and wallet-provider to your project
$ npm i -D truffle @truffle/hdwallet-provider

# Generate truffle configuation file and default folders
$ npm exec -- truffle init
circle-info

You can install global Truffle to your environment:

$ npm i -g truffle

Then, you can ignore npm exec -- or yarn commands before truffle

Setup Truffle config file

We are going to edit truffle-config.js. First, we uncomment this line to import @truffle/hdwallet-provider:

truffle-config.js
- // const HDWalletProvider = require('@truffle/hdwallet-provider');
+ const HDWalletProvider = require('@truffle/hdwallet-provider');

Then, we add ThunderCore network settings into your project.

triangle-exclamation

Deploy a Contract

circle-info

You'll need gas tokens to deploy contracts. To test on ThunderCore testnet, you can get testnet tokens from ThunderCore testnet Faucetarrow-up-right

Now, we can deploy the Migrator contract in the template to ThunderCore testnet.

When it's done, should show messages like this:

Congratulations! You have successfully deployed a smart contract onto the ThunderCore network.

You can check the deployment status at:

Last updated