Truffle is a framework for developing, compiling and deploying smart contracts.

  1. Install Node.js
sudo apt update
sudo apt install nodejs npm
  1. Install Truffle
sudo npm install -g truffle
  1. Create a new directory to store your smart contract code
mkdir blockHAX
  1. Change directories to where you will be working with your Solidity contract files, and initialize Truffle
cd blockHAX
truffle init

This will create the following directories and files

├── contracts
│   └── Migrations.sol
├── migrations
│   └── 1_initial_migration.js
├── test
└── truffle-config.js

contracts - Directory where you will store your smart contract Solidity (.sol) files

migrations - Directory to store files that tell Truffle how to deploy the smart contracts (i.e. which order to deploy them in, any constructors, etc.)

test - location to store test scripts to test Solidity functionality

truffle-config.js - Configuration file that tells Truffle where to deploy contracts (local instance, testnet, mainnet, etc.) and what compiler version to use.

  1. Copy the Solidity files you want to work with into the /contracts folder. (Example faucet code on next page)
  2. Edit the migrations files necessary for deploying the Solidity contracts in the /migrations folder (1_initial_migration.js) to match the title of the Solidity file (BlockHAXSolidity.sol in the example below) you want to deploy:
const BlockHAX=artifacts.require("BlockHAXSolidity");

module.exports = function(deployer) {
    // deployment steps
    deployer.deploy(BlockHAX);
}