QRC20 profile

QRC20 is the token standard on QTUM, and its content is basically the same as ERC20 on Ethereum.

The contract code implements the following function interfaces and events:

function name() constant returns (string name)
function symbol() constant returns (string symbol)
function decimals() constant returns (uint8 decimals)
function totalSupply() constant returns (uint256 totalSupply)
function balanceOf(address _owner) constant returns (uint256 balance)
function transfer(address _to, uint256 _value) returns (bool success)
function transferFrom(address _from, address _to, uint256 _value) returns (bool success)
function approve(address _spender, uint256 _value) returns (bool success)
function allowance(address _owner, address _spender) constant returns (uint256 remaining)
event Transfer(address indexed _from, address indexed _to, uint256 _value)
event Approval(address indexed _owner, address indexed _spender, uint256 _value)
Copy the code

Code written

We have provided you with a sample code: QRC20Token. You can use this contract code to publish your tokens.

In the file qrc20token. sol, change the value of name, Symbol and totalSupply, which respectively represent the token name, token symbol and total amount of token issued.

Contract is issued

Install the purse

From eco.qtum.org/wallet or github.com/qtumproject… Select the link to download the latest Qtum Core wallet based on your operating system and architecture.

After the wallet is installed, a certain number of QTUM (more than 1) needs to be transferred into the wallet to pay the commission fee of subsequent contract creation. Click Request Payment to get your wallet address.

Compile the contract

Open the url in the browser ethereum. Making. IO/browser – sol…

Click the “+” button in the upper left corner to create a new file, SafeMath. Sol and Qrc20token. sol, and copy and paste the contract code you wrote earlier.

Click the “detail” button on the right of the page, copy and save the object content of the BYTECODE in the page that pops up.

Release the contract

Open the Qtum Core wallet, enter “Smart Contract” = “Create”, paste the hexadecimal BYTECODE obtained in the previous step into the text box.

Click the “Create Contract” button to save the SenderAddress and ContractAddress from the returned result for future use.

By waiting a moment for the transaction to be confirmed, our contract is created. According to the contract code, all initial tokens are allocated to the creator of the contract, known as SenderAddress.

Test network

Before the contract is published to the primary network, you can test the contract on the test network. The operation method on the test network is the same as that on the primary network.

When starting Qtum- Qt from the command line, bring –testnet to the test network.

Qtum in the test network is available in the test coin faucet.

The purse to use

Add tokens,

In the Qtum Core wallet, go to the “QRC Token” page, click “Add Token” and fill in the ContractAddress obtained when publishing the contract. Select SenderAddress as Token Address and click “Confirm” button to add the Token successfully.

If the previous SenderAddress is not found in the Token Address drop-down list, send some Qtum to the SenderAddress and try again.

Hair extension tokens,

On the “QRC Token” page, click to select the Token you want to operate, and then click the “Send” and “Receive” below to Send and Receive.

Other Frequently Asked Questions

  • Sending tokens requires a certain amount of QTUM as a handling fee. Please make sure there is enough balance under the QTUM address that holds the tokens.
  • A 0.1qtum handling fee will be deducted for sending tokens, and the excess handling fee will be returned in the form of mining income after the transaction is confirmed. The actual handling fee consumed is about 0.02qtum.
  • Contracts that do not meet the QRC20 standard will not be automatically added to the official blockchain browser. Please check the code before Posting the contract on the main network.