Qtum Custom Token Walkthrough

Qtum Blocked Unblock Follow Following Aug 30, 2017

The following guide was created by a Qtum developer in Shanghai, Jun Chen, going through the steps required to deploy a custom token on our blockchain. This is a sample token, and has no value whatsoever other than the information presented below. Please keep in mind, this was all done on Qtum Skynet (our second test network) and is for demonstration purposes only. Please take note of the mobile functionality

With the release of our main network September 13th 2017, expect this to be more polished. This technology exists in a proof-of-concept.

Keep in mind that this example uses Qtum Skynet tokens, which can be acquired from our faucet at no cost, and are used for testing purposes only.

1) Introduction

Contract Address: 802045d58789706b9c0111c8fda5319af8b91413

Name: SKY

Starting time: August 23, 2017 11:00:00 Beijing

End time: August 30, 2017 00:00:00 Beijing

Redeem ratio: 1 QTUM = 100 SKY

Minimal Sales Target: 1,000,000 SKY

Sales Cap: 100 million SKY

Founding team share: 10%

Note: This token is for information purposes only, this is not a real crowdsale.

You can receive Qtum Testnet (Skynet) tokens from our faucet below:

skynet.qtum.me

2. Desktop Wallet Installation

Depending on your operating system, choose a Qtum wallet to download:

Installation instructions can be found here:

Https://github.com/qtumproject/qtum/blob/testnet-2/README.md

3. Send Qtum Testnet Tokens to the Smart Contract

On the “Send to Smart Contract” page of the wallet, enter the contract address: 802045d58789706b9c0111c8fda5319af8b91413

parameter Data Hex: d7bb99ba

QTUM Amount: <Any integer>

Click “Send To Contract” to participate in this fake crowdsale.

Make sure you record the hash160 address that is displayed in the popup. Take a screenshot for future reference.

4. Verify the Token

Check the transaction was confirmed.

Create a new file named interface.json, as follows:

[{“constant”:true,”inputs”:[],”name”:”name”,”outputs”:[{“name”:””,”type”:”string”}],”payable”:false,”type”:”function”},{“constant”:false,”inputs”:[{“name”:”_spender”,”type”:”address”},{“name”:”_value”,”type”:”uint256"}],”name”:”approve”,”outputs”:[{“name”:”success”,”type”:”bool”}],”payable”:false,”type”:”function”},{“constant”:true,”inputs”:[],”name”:”totalSupply”,”outputs”:[{“name”:””,”type”:”uint256"}],”payable”:false,”type”:”function”},{“constant”:false,”inputs”:[{“name”:”_from”,”type”:”address”},{“name”:”_to”,”type”:”address”},{“name”:”_value”,”type”:”uint256"}],”name”:”transferFrom”,”outputs”:[{“name”:”success”,”type”:”bool”}],”payable”:false,”type”:”function”},{“constant”:true,”inputs”:[],”name”:”decimals”,”outputs”:[{“name”:””,”type”:”uint8"}],”payable”:false,”type”:”function”},{“constant”:true,”inputs”:[],”name”:”endTime”,”outputs”:[{“name”:””,”type”:”uint256"}],”payable”:false,”type”:”function”},{“constant”:false,”inputs”:[],”name”:”finalize”,”outputs”:[],”payable”:false,”type”:”function”},{“constant”:true,”inputs”:[],”name”:”founder”,”outputs”:[{“name”:””,”type”:”address”}],”payable”:false,”type”:”function”},{“constant”:true,”inputs”:[],”name”:”version”,”outputs”:[{“name”:””,”type”:”string”}],”payable”:false,”type”:”function”},{“constant”:false,”inputs”:[],”name”:”refund”,”outputs”:[],”payable”:false,”type”:”function”},{“constant”:true,”inputs”:[],”name”:”standard”,”outputs”:[{“name”:””,”type”:”string”}],”payable”:false,”type”:”function”},{“constant”:true,”inputs”:[],”name”:”tokenContributionCap”,”outputs”:[{“name”:””,”type”:”uint256"}],”payable”:false,”type”:”function”},{“constant”:true,”inputs”:[{“name”:””,”type”:”address”}],”name”:”balanceOf”,”outputs”:[{“name”:””,”type”:”uint256"}],”payable”:false,”type”:”function”},{“constant”:true,”inputs”:[],”name”:”startTime”,”outputs”:[{“name”:””,”type”:”uint256"}],”payable”:false,”type”:”function”},{“constant”:true,”inputs”:[],”name”:”tokenContributionMin”,”outputs”:[{“name”:””,”type”:”uint256"}],”payable”:false,”type”:”function”},{“constant”:true,”inputs”:[],”name”:”tokenContributionRate”,”outputs”:[{“name”:””,”type”:”uint256"}],”payable”:false,”type”:”function”},{“constant”:true,”inputs”:[],”name”:”founderPercentOfTotal”,”outputs”:[{“name”:””,”type”:”uint8"}],”payable”:false,”type”:”function”},{“constant”:true,”inputs”:[],”name”:”symbol”,”outputs”:[{“name”:””,”type”:”string”}],”payable”:false,”type”:”function”},{“constant”:false,”inputs”:[{“name”:”_to”,”type”:”address”},{“name”:”_value”,”type”:”uint256"}],”name”:”transfer”,”outputs”:[{“name”:”success”,”type”:”bool”}],”payable”:false,”type”:”function”},{“constant”:true,”inputs”:[],”name”:”funding”,”outputs”:[{“name”:””,”type”:”bool”}],”payable”:false,”type”:”function”},{“constant”:false,”inputs”:[],”name”:”contribute”,”outputs”:[{“name”:”amount”,”type”:”uint256"}],”payable”:true,”type”:”function”},{“constant”:true,”inputs”:[{“name”:””,”type”:”address”},{“name”:””,”type”:”address”}],”name”:”allowance”,”outputs”:[{“name”:””,”type”:”uint256"}],”payable”:false,”type”:”function”},{“inputs”:[],”payable”:false,”type”:”constructor”},{“payable”:true,”type”:”fallback”},{“anonymous”:false,”inputs”:[{“indexed”:false,”name”:”_this”,”type”:”address”}],”name”:”ContractCreated”,”type”:”event”},{“anonymous”:false,”inputs”:[{“indexed”:true,”name”:”_contributor”,”type”:”address”},{“indexed”:false,”name”:”_amount”,”type”:”uint256"},{“indexed”:false,”name”:”_return”,”type”:”uint256"}],”name”:”Contribution”,”type”:”event”},{“anonymous”:false,”inputs”:[{“indexed”:true,”name”:”_from”,”type”:”address”},{“indexed”:false,”name”:”_value”,”type”:”uint256"}],”name”:”Refund”,”type”:”event”},{“anonymous”:false,”inputs”:[{“indexed”:false,”name”:”_time”,”type”:”uint256"}],”name”:”Finalized”,”type”:”event”},{“anonymous”:false,”inputs”:[{“indexed”:true,”name”:”_from”,”type”:”address”},{“indexed”:true,”name”:”_to”,”type”:”address”},{“indexed”:false,”name”:”_value”,”type”:”uint256"}],”name”:”Transfer”,”type”:”event”},{“anonymous”:false,”inputs”:[{“indexed”:true,”name”:”_owner”,”type”:”address”},{“indexed”:true,”name”:”_spender”,”type”:”address”},{“indexed”:false,”name”:”_value”,”type”:”uint256"}],”name”:”Approval”,”type”:”event”}]

Use ethabi (https://github.com/paritytech/ethabi) to encode the parameters, execute the command ethabi encode function interface.json balanceOf -p to save the hash160 address and then keep this data:

On the “Call Contract” page of the wallet, enter the contract address: 802045d58789706b9c0111c8fda5319af8b91413 Data Hex: Use the data saved in the previous step.

Click “Call Contract” to see the number of hexadecimal tokens in the output of the pop-up data.

The hexadecimal 3e8 is converted to a decimal system of 1000

5. Use your phone wallet to view

Open QTUM mobile wallet

(source address https://github.com/qtumproject/qtum-android, https: //github.com/qtumproject/qtum-ios),

In the “Profile” page, select “Smart Contract”, in the second page select “Watch Token”

Fill in Token Name: SKY

Address Token Address: 802045d58789706b9c0111c8fda5319af8b91413

ABI interface: Copy the interface.json data.

Click OK to complete

Slide the main page into the “Other Tokens” page:

6. Send Tokens

Let’s send some tokens to the Qtum mobile wallet.

In the desktop wallet on the Console page enter the command gethexaddress “phone wallet Qtum address”, get the address of the hash160 address, save it.

Use the command ethabi encode function interface.json transfer -p Previously saved hash160 address number — lenient, save the returned data.

Use the command ethabi encode function interface.json transfer -p Previously save hash160 address number — lenient, save the returned data.

Congratulations! You have just created your own token on Qtum Skynet! As we reach the launch date of the Main Network, this process will be identical. Please take note of the mobile functionality that was involved in this process. This guide requires a moderate level of IT knowledge, but it’s entirely possible for someone with little blockchain knowledge to figure this out.

If you would like to discuss this topic further, we have a development channel on the Qtum Slack

Qtumslack.herokuapp.com