MetaCoin

A Truffle Example on Arcology

The Truffle MetaCoin example is a simple demonstration of a basic cryptocurrency-like smart contract and a corresponding decentralized application DApp provided by the Truffle framework to help developers learn and get started with Ethereum smart contract development using Truffle.

Create a New Directory

Create a new directory where you want to set up your Truffle project if you haven't already done so. You can use the Truffle Box feature to download the MetaCoin example. Run the following command to download the MetaCoin Truffle Box:

>mkdir MetaCoin
>cd MetaCoin
metaCoin> truffle unbox metacoin

You can observe the directory structure as follows:

metaCoin> tree
.
├── contracts              // Directory for storing contracts
   ├── ConvertLib.sol
   └── MetaCoin.sol
├── LICENSE
├── migrations             // Directory for deployment scripts
   └── 1_deploy_contracts.js
├── test                   // Directory for test scripts
   ├── metacoin.js
   └── TestMetaCoin.sol
└── truffle-config.js      // The configuration file

This directory structure includes contract storage, deployment scripts, test scripts, and the crucial configuration file for your Ethereum Native Contracts project.

Modifying Configuration

The Truffle Suite uses Ganache as its default development blockchain network for local development and testing purposes, but it allows you to configure and connect to custom development networks, including private or custom Devnets. Please refer to the configuration document for more.

Compile the Contract

metaCoin>truffle compile

Deployment

Use the command below to deploy the contract to the devnet.

metaCoin> truffle migrate --network arcology_devnet

That's it! You should now have the MetaCoin example downloaded and ready for testing in your Truffle project.

Testing

You can navigate to the project directory and run the tests now. The command below will run the test suite for the MetaCoin smart contract.

metaCoin> truffle test --network arcology_devnet

Last updated