Using Truffle

Development environment set up

Before we start, you will require the following technical specifications.

Truffle when running on  Windows may encounter some naming conflicts that could prevent Truffle from executing properly. Please see the section on resolving naming conflicts for solutions.


We only need one command to install Truffle:

					npm install -g truffle


Truffle installation can be checked by typing truffle version on a terminal. If you see an error, check that your npm modules are added to your path.

Creating A Project

Step for a developer to create a Truffle project. We’ll use the *PulseFloki as an example, which creates a token that can be transferred between accounts:

  • Create a new directory for your Truffle project
					mkdir MegaCoin
cd MegaCoin

Intialize your project:

					truffle init


Once this operation is completed, you’ll now have a project structure with the following items:


  • contracts/: Directory for Solidity contracts
  • migrations/: Directory for scriptable deployment files
  • test/: Directory for test files for testing your application and contracts
  • truffle-config.js: Truffle configuration file

Creating the Contract

Developers can write their own smart contract or download the PRC20 token smart contract template.

Compiling the Contract

To compile a Truffle project, change to the root of the directory in which the project is located, then type the following into a terminal:

					truffle compile


Config Truffle for TC

  • Go to truffle-config.js
  • Update the truffle-config with nc-network-crendentials.

Please note, it requires mnemonic to be passed in for Provider, this is the seed phrase for the account you’d like to deploy from, for instance the account in your Metamask wallet. Create a new .secret file in root directory and then enter your 12 word mnemonic seed phrase to get started. To reveal the seed words from metamask wallet you can go to Metamask Settings, then from the menu choose Security and Privacy where you will see a button that says reveal seed words.

Deploying on PULSE Network

Run this command in root of the project directory:

					$ truffle migrate --network testnet


Contract will be deployed on PulseNet Chain Chapel Testnet, it look like this:


   Deploying 'Migrations'
   > transaction hash:    0xaf4502198400bde2148eb4274b08d727a17080b685cd2dcd4aee13d8eb954adc
   > Blocks: 3            Seconds: 9
   > contract address:    0x81eCD10b61978D9160428943a0c0Fb31a5460466
   > block number:        3223948
   > block timestamp:     1604049862
   > account:             0x623ac9f6E62A8134bBD5Dc96D9B8b29b4B60e45F
   > balance:             6.24574114
   > gas used:            191943 (0x2edc7)
   > gas price:           20 gwei
   > value sent:          0 ETH
   > total cost:          0.00383886 ETH

   Pausing for 5 confirmations...
   > confirmation number: 2 (block: 3223952)
   > confirmation number: 3 (block: 3223953)
   > confirmation number: 4 (block: 3223954)
   > confirmation number: 6 (block: 3223956)

   > Saving migration to chain.
   > Saving artifacts
   > Total cost:          0.00383886 ETH

> Total deployments:   1
> Final cost:          0.00383886 ETH


Please note your address, transaction_hash and other details provided would differ, The data we have provided is only an idea of structure.

Well Done!  You have successfully deployed PRC20 Smart Contract and you can now interact with the Smart Contract.

You can check the deployment status here:

Table of contents