Truffle Box (rsk-next-box)


In this box you’ll find a basic starter pack. It includes Truffle and Next JS.

This starter contains two main elements

  • Truffle framework
  • Next JS App (located at app/ folder)


Run the unbox command

truffle unbox rsk-next-box

For simplicity, there is hook that is going to setup the environment and install all it’s dependencies.

Environment setup


As said before, this box comes with two environments

  • Truffle environment (located at root folder)
  • Next environment (located at /app)

Each environment comes with a specific package.json.

Truffle Environment setup

First ensure you are at the root folder and have truffle installed.

If you don’t have truffle installed you’ll need to run this in order to install it.

npm install -g truffle

To install truffle dependencies

# At project root folder (I.E '../rsk-next-box/')
npm install

Now, the only thing you’ll need to do it’s to copy your mnemonic to truffle-config.js

// truffle-config.json

const HDWalletProvider = require('@truffle/hdwallet-provider');

//Put your mnemonic here, take care of this and don't deploy your mnemonic into production!
const mnemonic = 'A_MNEMONIC';

Using the truffle console

You can start a truffle console for any RSK network

# Console for Mainnet
truffle console --network mainnet

# Console forn Testnet
truffle console --network testnet

Migrating contracts

In order to migrate contracts to a specific network

# Migrate for Mainnet
truffle migrate --network mainnet

# Migrate for Testnet
truffle migrate --network testnet

App environment setup

First install it’s dependencies.

# At app folder (I.E '../rsk-next-box/app')
npm install

Then you can run the app/ with

# At app folder (I.E '../rsk-next-box/app')
npm run dev

The page will automatically reload if you make changes to the code.


To build the app/ run

# At app folder (I.E '../rsk-next-box/app')
npm build

Communicating with RSK network

Web3 JS and ethereumjs-tx have been bundled in order to communicate with RSK network.

Code format with Prettier

This project is integrated with Prettier for handling code format. You can format the app/ runing

# At app folder (I.E '../rsk-next-box/app')
npm lint

To define new rules or edit exsting ones, just edit .prettierrc

You can ignore files at .prettierignore