HRC721 Token - How to deploy

How to deploy a HRC721 contract (NFT)

Introduction

This project is an implementation of NFT (non-fungible token) based on ERC721 and OpenZeppelin. You can use it to issue your own NFTs and build corresponding DApps on Hydra chain.

HRC721 Template

We will use a QRC721 template, based on ERC721 and OpenZeppelin templates. Download this project and install dependencies, like this:

$ git clone https://github.com/qtumproject/QRC721Token.git
$ cd QRC721Token
$ npm install

The QRC721 template tree will be installed in the QRC721Token folder. There is no need to edit anything in the template.

For npm to work you need to install nodejs, which will also install npm.

Dev Environment

  1. Install the Solidity compiler. You'd better install it from a binary package or the source code. Before you install the compiler check in the headers of the QRC721.sol file and of the imported OpenZeppelin templates which version of the compiler you will need. In our example SOLC 0.5.5+commit.47a71e8f.Linux.g++ was used.

  2. Install Solar. Solar is a smart contract deployment tool of Qtum. Solar is written in GO, so we needed to install also Golang. In our example go1.18.2 linux/arm was used.

Deploy QRC721

  1. Start the full Hydra node with GUI (hydra-qt -testnet). You should have some Hydra coins in the node for contract gas.

  2. Solar can deploy QRC721 and ERC721 contracts, so for using it with Hydra the source code of Solar should be changed to make the proper RPC calls to our Hydra full node. Then the command solar deply can be used. Instead we will use the command with a different option solar compile to only compile the template and get the BYTECODE and ABI. The command should be run in the QRC721Token folder.

cd QRC721Token
solar compile contracts/QRC721.sol

3. Using the Hydra full node with GUI (hydra-qt -testnet) and the BYTECODE and ABI you can now deploy your HRC721 contract. You will be able to enter the name and symbol of your smart contract after you populate the ABI field on the Smart Contracts > Create contracts tab of the Hydra node. Also select in the field “Sender Address” the address that will pay for the contract and push the button “Create Contract”. Wait for a confirmation on the blockchain for the contract to be deployed.

Last updated