# Truffle: Deploying a Smart Contract
Learn how to deploy a simple Solidity-based smart contract to Haqq using the Truffle environment
# Pre-requisite Readings
# Install Dependencies
First, install the latest Truffle version on your machine globally.
If you haven't already, you will also need to install Haqq if you plan on deploying your smart contracts locally. Check this document for the full instructions.
# Create Truffle Project
In this step we will create a simple counter contract. Feel free to skip this step if you already have your own compiled contract.
Create a new directory to host the contracts and initialize it:
Initialize the Truffle suite with:
contracts/Counter.sol containing the following contract:
Compile the contract using the
# Truffle configuration
truffle-config.js and uncomment the
development section in
This will allow your contract to connect to your Haqq local node.
# Start Node
Start your local node using the following command on the Terminal
For further information on how to run a node, please refer to the quickstart guide.
# Deploy contract
In the Truffle terminal, migrate the contract using:
You should see incoming deployment logs in the Haqq daemon Terminal tab for each transaction (one to deploy
Migrations.sol and the other to deploy
# Run Truffle tests
Now, you can run the Truffle tests using the Haqq node using the