Develop with Truffle
Overview
Truffle is one of the most popular development tools in the Ethereum community. ThunderCore is fast and EVM-compatible, so developers can use Ethereum development tools, including Solidity and Truffle, to develop DApps on ThunderCore. We have prepared a Truffle box: thunder-box, for developers. This tutorial will help you to use our thunder box to quickly set up your dev environment.
Get Started
First, ensure that you are in a new and empty directory and that you have nodejs
in your environment.
- Run the unbox command via npx and skip to step 3.
npx truffle unbox thundercore/thunder-box
- Alternatively, you can install Truffle globally and run the unbox command.
npm install -g truffle
truffle unbox thundercore/thunder-box
- Run the development console.
truffle develop
- Compile and migrate the smart contracts. Note that inside the development console we don't preface commands with
truffle
.
compile
migrate
- Alternatively, you can run the following to compile and migrate the smart contracts.
npm run compile
npm run migrate
- To clean up previously built contracts:
npm clean
Develop on Thunder Testnet and Mainnet
Get Thunder Tokens. Please follow this instruction to get your tokens.
To set up the control of accounts for deployment do ONE of the following:
- Write your 12-word mnemonic (seed phrase) to a file named .mnemonic
- Export your account private keys, one per line, to a file named .private-keys
# If you use private keys
mv .private-keys.template .private-keys
# in .private-keys file, copy your private keys
e59cb5e369b65eee650f90f3280cbe8039db81335943ac7a88df5f4df...
d92a96fa691a7c31b2e2891de05cacc85d562b128afa6bb8f7108aac7...
# If you prefer mnemonic
mv .mnemonic.template .mnemonic
# In .mnemonic file, copy your mnemonic, seperated by spaces
dog cat apple bird ...
- Compile and migrate your contract for testnet and mainnet
# Compile to testnet
npm run compile:testnet
# is equal to
truffle compile --network thunder-testnet
# ---
# Compile to mainnet
npm run compile:mainnet
# is equal to
truffle compile --network thunder-mainnet
# ---
# Migrate to testnet
npm run migrate:testnet
# is equal to
truffle migrate --network thunder-testnet
# ---
# Migrate to mainnet
npm run migrate:mainnet
# is equal to
truffle migrate --network thunder-mainnet