QRC20 Token Report — February 25, 2018

Iconic “I amsterdam” sign — not Earlz, just some random bitcoin maximalist, Airdrop drawing, De Gekroonde Poelenburg windmill, Zaandam, Netherlands

As a token of my appreciation for the Community, here is a tutorial about Qtum QRC20 tokens: what they are, where they are, how to interact with them, how to watch them, and how they are created and destroyed, using a recent token airdrop for Qtum holders to illustrate these details in the life of a token.

I am an independent researcher, occasional blogger and social moderator, and appreciate the technical guidance from the Qtum Team and discussions in the Community. If you have any comments or corrections for this article, please reach out on the social medias.

Mainnet Performance

First, a brief review of recent Qtum Mainnet performance.

Unique Reward Addresses

For the last 7 days, unique addresses per day peaked at 306 on February 25th and averaged 291 per day. This means approximately half of the block rewards for 600 blocks per day were won by smaller wallets. Unique addresses for the week were 1,107. These numbers represent a slight increase in unique reward addresses from 10 days ago, and could indicate more small wallets being deployed as discussed in my New Year’s report.

Node Count

Node count as shown by the Nodemap is around 3,250, with approximately 1,260 in China. Your researcher wonders if the Nodemap will be able to keep up with the coming order-of-magnitude increase in node count, but other blockchain nodemaps handle many nodes, so let’s hope the Nodemap is hitting the gym and getting pumped up for the additional work!

Transaction Fees

Last year, the transaction fees were a few percent of the block reward fees each day. Two weeks ago, the transaction fees were about half the block reward fees. This past week, there were some periods the Explorer said the transaction fees are greater than the block reward fees on a 24-hour basis for each. If the Explorer is doing the calculations correctly, it means the network has seen much growth in transactions, and especially for smart contract calls (tokens and DAPPs) which typically carry a 0.1 QTUM fee. There were some big peaks in transaction fees as the airdrop was deployed.

Block Spacing

Block spacing was stable around 600 blocks per day. For the two-week period February 11 to February 24 there were 14 blocks with spacing over 20 minutes, and the longest spacing was for block 98,210 at 31:20.

Network Weight

My alternate approach for calculating network weight relies on the percentage of block rewards raked in by big staking wallets with known balances and gives a more stable and accurate number than the calculated estimate of network weight by the wallets. In the last week, these big wallets with a balance of 6.64 million collected 26.4% of the block rewards giving a network weight of 25.2 million. The network weight of 25.2 million represents an annual staking return of 3.5%

Token Time

If you only want a token understanding of QRC20 tokens, here is the TL;DR:

Qtum QRC20 tokens are standardized digital assets that are created and live their entire lives within a Qtum smart contract, never leaving that contract. Transactions with the contract can assign tokens to different owners, and the contract stores a list of Qtum addresses and the tokens owned by each address. Anyone can create a smart contract and create tokens, and the smart contract with all its tokens lives in the Qtum blockchain. Tokens represent significant functionality, capability and economic value on blockchain 2.0 platforms.

For a deeper understanding of tokens our escort on the journey of discovery will be Alice, a 150-year-old literary character doyenne who has an innate curiosity about crypto currencies:

Alice started to her feet, for it flashed across her mind that she had never before seen a rabbit with either a waistcoat-pocket, or a watch to take out of it, and burning with curiosity, she ran across the field after it, and fortunately was just in time to see it pop down a large rabbit-hole under the hedge. In another moment down went Alice after it, never once considering how in the world she was to get out again. Alice’s Adventures in Wonderland, Lewis Carroll, 1865.
Published in the U.S. before 1923 and public domain in the U.S.

Alice wanted to send 10 Wonderland (WON) tokens to Bob. But as Alice tried to make the transaction from her wallet, things got curiouser and curiouser. Alice decided to learn all about the QRC20 tokens and following a white rabbit named Satoshi, she ended up falling down the rabbit hole to an alternate universe filled with tokens and smart contracts.

Keep reading if you want to join Alice and fall Down the Rabbit Hole to learn all about Qtum QRC20 tokens, including two secrets Alice discovers after eating the mushroom.

some ill-fated physical tokens

Let’s start with some basic explanations. A QRC20 token is a programmable digital asset that is created in a smart contract on the Qtum blockchain. The Qtum blockchain and its EVM (Ethereum Virtual Machine) has the capacity to provide smart contracts which can execute code and store data. Basic smart contracts with tokens can be easily created with Qtum Core wallets, Qtum mobile wallets, and the Qtum Web wallet. More sophisticated smart contracts can be currently written in the solidity programming language and published on the blockchain.

Qtum inherits its current virtual machine for executing smart contracts, with associated tokens, from Ethereum. In Ethereum, basic tokens are called ERC20, named for Ethereum Request for Comments 20, a proposal to add token functionality which was circulated in 2015. Qtum tokens are named QRC20 since they follow the same protocols and standards as ERC20 tokens.

Alice knows it is useful (and safer in doing transactions) to visualize a model of the blockchain — smart contract — token architecture, which will also help explain how tokens and airdrops work.

The smart contract is published to the network in a Contract Create transaction which is included in a specific block, where the smart contract will live forever. The drawing above shows a smart contract (the Bodhi contract in Testnet block 34,546) managing QRC20 tokens, and the contract will have storage to keep track of balances and offer a half-dozen functions to create tokens, transfer tokens between addresses, check balances, etc.

Contract Creation

Smart contracts begin their life on the Qtum blockchain when they are published to the blockchain in a Contract Creation transaction. To see such a contract creation transaction in action, we can look at the Bodhi contract on Testnet (your researcher couldn’t find the Bodhi contract on Mainnet).

Testnet is used by developers to evaluate and test their software, exactly what Bodhi did with this smart contract.

The Bodhi test smart contract began life in Testnet block 35,456 on November 20, 2017. The contract created some 335,000 test BOT tokens, and the Bodhi developers could run tests and make sure the code was ready for Mainnet.

Exchanges and Wallets

Next, we look at a simplified model of exchanges and wallets, which will help understand how an airdrop really works.

Note in the drawings below the Q addresses are shown to be sequential for clarity, in practice, the block numbers are sequential and Q addresses are random.

As the drawing shows, exchange customers can buy and sell among themselves with no blockchain transactions. The exchange maintains a balance using a hot wallet and a cold wallet (maybe multiples of each). For this example, the exchange has a balance of 6,000,000 coins, which are stored as transactions in the blockchain, and are never stored in the exchange itself. Later, Alice eats the mushroom and learns a secret about these coins.

We can consider two exchange transactions. First, an account can withdraw 300 coins from the exchange to a personal wallet. To accomplish this the customer enters their wallet address (Q12 here), and the exchange hot wallet (perhaps through intermediary addresses at the exchange) sends a transaction for 300 coins. Second, for a deposit into the exchange, the customer enters the deposit address for their exchange account and sends the transaction (perhaps through some intermediary addresses at the exchange) to the exchange hot wallet.

Now let’s look at some wallets connecting to the blockchain directly, not through an exchange.

Previously I have described a wallet as a browser on the blockchain that can manage coins. As an early crypto adopter, Alice can give us a little more detail about the role of the wallet:

  • Browse the blockchain and compute the balance based on past transactions
  • Hold the private keys and sign transactions
  • Set a good transaction fee (which will change over time)
  • For some wallets, publish smart contracts and contract calls (token transactions, etc.)

Only full nodes (that hold the entire blockchain) can send transactions to the network for inclusion on the blockchain, so the wallets above that are using Simplified Payment Verification (mobile wallets) and other types of lightweight wallets must talk to the blockchain through a full node.

Alice wants to point out that the wallets do not, by themselves, ever hold any coins or tokens, because the coins or tokens are always stored on the blockchain. And we will see below (spoiler alert) that even on the blockchain, tokens never leave the smart contract that created them. How boring for them!

Alice has a secret about the coins to share as we navigate down the rabbit hole. She says there aren’t really coins on the Qtum blockchain. The wallet calculates the sum of the unspent transactions for addresses the wallet controls, so the “coin” is more like the result of an Excel spreadsheet SUM formula. On the other hand, QRC20 token values are individual amounts, like the value in a single cell in Excel.

Snapshot

As we follow Alice down the rabbit hole, we decide to take a selfie or snapshot. An airdrop snapshot is a readout of the blockchain at a particular time, at a specific block. For the Bodhi airdrop, the snapshot was at block 93,333, at 23:40:16 UTC on February 2, 2018. Alice points out that the numbers 3 and 9 are considered lucky in China, representing to live, life and long lasting.

What happened then (educated guess coming…) is that Bodhi would take the blockchain up to height 93,333, and parse through all the transactions to find the balance at every Qtum address.

Airdrop

In this next section Alice wants to tell you who got the airdrop, and the answer is: everyone. The real question is whether you have a mechanism to access the tokens through your wallet or exchange.

Bodhi reported they airdropped 4,015,325.92 BOT tokens for the Qtum holders at a 4:100 ratio, which implies they airdropped against 100,383,148 QTUM (they excluded addresses with less than 10 QTUM). According to the QTUMs in Circulation chart, there were 100,353,364 QTUM on February 2 (genesis blocks of 100 million + block rewards so far), and the math largely works out, meaning virtually every Qtum address received BOT.

The easy and fair way to do an airdrop is to give tokens to every active address. To check how far back in blockchain history the snapshot looked, Alice used the way back machine (Explorer) to look at the very early block reward winners. She couldn’t find any active wallet addresses from the genesis blocks (1–5000), but this guy …Ch5b won block 5,041 on September 8, 2017, a real OG wallet, that did some mining through October 2017. …Ch5b still has a balance and did receive the BOT airdrop. We will see the actual airdrop transactions below, after seeing how the contract calls work.

We can go back to our drawings from above and see how the airdrop filled for the various blockchain addresses.

Now we can see to the left of the blockchain the Bodhi smart contract storage with the amount of BOT airdropped to each address. For example, the exchange cold wallet at address Q2 would have 200,000 BOT airdropped. There are two timing assumptions in this drawing. 1) If the deposit from Q10 occurred after block 93,333, then this address would still have 10 BOT from the airdrop. 2) If the withdrawal to address Q12 occurred before block 93,333 it would receive the airdrop.

Let’s see how the wallets did in the airdrop.

This is pretty much as expected, since BOT were airdropped to every active address (greater than 10 QTUM). As mentioned above, the issue with this all-inclusive airdrop is whether the wallets can access the tokens, which means the wallet must have a way to add the token contract address and be able to create and send token contract calls, and not all of the wallets above can accomplish this.

Talking to the Smart Contract

Going back to our original problem with Alice, which took us down this rabbit hole, Alice wanted to send 10 WON tokens to Bob. Think of it like this. If Alice wants to send 10 tokens to Bob, she can’t simply send 10 tokens from her wallet to Bob’s wallet, to his Q address. There are a few problems with this approach. First, the tokens are not in Alice’s wallet, they in the smart contract. Second, the tokens are not sent to Bob’s wallet, they are moved to Bob’s Q address in the smart contract storage.

No worries mate, Alice’s wallet knows how to talk the smart contract since she added the token and entered the smart contract address in her wallet. The transaction to “send” tokens to Bob is actually sent to the smart contract, and Bob’s Q address and the number of tokens to transfer to Bob are included as data in the contract call transaction. We will look at the data in a contract call in a bit after fixing another confusion factor.

Bitcoin addresses and Qtum Q addresses are displayed and entered by people as Base58 encoded alphanumeric characters. You probably never noticed it (Alice never did) but bitcoin and Q addresses never contain the characters zero, capital O, capital I, or lower-case l. The other numbers and letters are good, but it is if the white rabbit named Satoshi figured out that future crypto users would be totally screwing up entering “0” “O” “I” “l” (it’s hard, right) and so to reduce anguished customer service calls to Bithumb and Coinbase when people sent their bitcoin off to mistyped address oblivion, they just omitted those characters, which is pretty forward thinking for a rabbit. Here is the complication factor. The human-readable Base58 addresses are converted to a more efficient hexadecimal address for sending in the contract call transaction, and for storage within the smart contract. To convert between Base58 and hexadecimal, use this Web page for Base58 Encode, Decode and Validate.

Now we can look at the data in a contract call, and here is a typical example:

The data shows:

  • a9059cbb means this is a transfer operation
  • e22843f9a4… is the address to transfer to, in hex
  • 13956ed39 the amount to move, in hex and in satoshis.

How do you think the airdrop was actually accomplished? The Bodhi Foundation had to send ever so many contract calls. Once the smart contract was launched, it was happily sitting in the blockchain, waiting for instructions. And for the airdrop those instructions transferred BOT from the Bodhi Foundation address to all the airdrop recipients. You can see some of the airdrop going down early in the morning on February 15 for example, in blocks such as 100,719, which had so many big contact calls it charged 20 QTUM in transaction fees! These blocks contain multiple contract calls with up to 200 transactions each, as Bodhi updated the contract storage to execute the airdrop. Here are a few of the airdrop transactions for some of the very biggest Q addresses:

All these transactions to update the Bodhi smart contract were published to the blockchain in block 100,719, and others, but how does the smart contract storage in the blockchain actually get updated? Obviously, the block reward winning wallet processes these smart contract calls in their local copy of the blockchain, stuffing the updates into the appropriate block in their local storage.

Here is the second secret Alice wanted to share: all the full nodes validate the new block, they also process the smart contract transaction on their local copy of the smart contract block. Alice’s second secret is — every node executes every contract call when they are published in a block.

We can look at how this data is stored in the smart contract (again with the confusing hex addresses):

If you wanted to, you could go through this storage, find your address, and the number of tokens assigned to your address. Don’t try this though, there is a much simpler way to check your token balance, which Alice will show us below. But you know your correspondent can’t stand to see such a rich table of data without scraping it and running some Excel analysis.

On the Explorer smart contract page, press the “Show All” button and go for coffee while your browser loads 31,944 entries. Some interesting data that I don’t understand: there were many addresses with 1 or 2 satoshis of tokens (0.00000001 or 0.00000002 tokens), what is called dust on other blockchains. Ignoring those entries, the token distribution was:

The 10 largest token holdings are shown on the chart below. Alice guesses that the largest position of 40 million is the Bodhi Foundation and the rest are exchanges.

Checking Your Token Balance Made Easy

Alice wanted to show a super easy way to check your token balance in smart contract storage. She says to navigate to the Explorer Tokens page.

We can’t find her WON token, and so will use BOT for this example; click on the name “BOT — Bodhi Token”

Select “READ SMART CONTRACT” and paste the Q address into the “BalanceOf” field, and select “Query”. The balance in satoshis will appear. The get the balance in tokens, move the decimal point 8 places to the left (for this token).

You can also take a shortcut to this page by clicking on the token holdings for your address in the Explorer if you can see your tokens in the Explorer.

Tokens in the Explorer

After the airdrop, Alice was confused because she couldn’t see the tokens for her address in the Explorer, but there were other addresses proudly showing their tokens.

To understand why the Explorer is oblivious to the airdrop tokens remember how the airdrop worked: snapshot, some processing, then contract calls to the smart contract, with nothing touching the Q address on the blockchain.

The Explorer is kept in the dark until you add the token to your wallet and make a token transaction with your Q address (however small), or perhaps reloading your wallet (Alice will have to check with the white rabbit about this). Then the Explorer knows you have that token, and it will query the smart contract and present your token balance properly.

A popular Ethereum explorer has built-in the most popular ERC20 tokens, so you can see those tokens automatically for a given address. Maybe we will get that feature in a future version of the Qtum explorers.

Burning Tokens

Now we have reached the bottom of the rabbit hole on our journey with Alice, and it is time to talk about how tokens can be destroyed, or “burned” at the end of their useful life. For example, Qtum tokens existed as Ethereum ERC20 tokens prior to the Qtum Mainnet Ignition launch. In early October 2017, various exchanges allowed Qtum token holders to submit their Qtum ERC20 tokens to be swapped for QTUM Mainnet coins, and the swapped out Qtum ERC20 tokens were subsequently burned.

poor, unfortunate tokens

Why would anyone want to burn perfectly good tokens? Perhaps the tokens are being upgraded to a new token or coin, as was the case with Qtum. Also, organizations can burn some of their token inventory to reduce the supply, supporting the price, similar to how corporations buy back their own stock.

To burn tokens, you send them to a nonexistent address where they are stuck forever. For example, if we make up the Ethereum address 0x111111111111111…, a legitimate address for which no one has the private keys. We can tell the smart contract to move the tokens to that address, and they are gone forever or burned. We can take a quick look at those poor tokens at the Ethereum Qtum ERC-20 token page and by adding up the percentages for all the burn addresses see that 97.05% of the old Qtum ERC20 tokens have been burned:

If you are holding Qtum ERC20 tokens, time is of the essence to convert these ERC20 tokens to Qtum Mainnet coins, before the tokens become worthless. Check with the social medias if there is still an exchange that can complete this swap. But please hurry, because Qtum ERC20 tokens are far into the crypto graveyard, and there will come a time when these tokens will be a nice souvenir, with no ability to swap for Mainnet coins.

I’m not sure where Patrick has been globetrotting lately, but I think Earlz traveled through Amsterdam recently, coming back from the Berlin Meetup. I have several reports with photos of Berlin, so let’s finish in Amsterdam.

Amsterdam is a city with a rich history, beautiful canals, coffee shops that serve “coffee” from a bong, and special lighting year-round in the Red-Light District.

buy high, sell higher

Amsterdam was home of the tulip bubble (imploded 1637), which some people compare to the so-called cryptocurrency bubble. But if you do your own research (DYOR) you know the true analogy for blockchain 2.0 platforms such as Qtum (founded 2017) is the Dutch East India Company (founded 1602) which was the first global corporation, with significant new business paradigms (first to be publicly traded on a stock market), and in its time, the most valuable company in the world.

Let’s not tilt at windmills about bubble talk, instead see some fine windmill specimens near Amsterdam. Today these windmills are elegant historical gems, but in their glory, they were workhorse industrial machines sawing lumber, grinding flour and extracting linseed oil.

The Zaanse Schans

I’m pleased to report Alice did climb out of the rabbit hole, and if you see her talking to the white rabbit, don’t worry, they are probably just discussing blockchain governance and scaling.

I hope you have enjoyed this journey with Alice to learn about tokens and that your tokens will be very useful and profitable.

Jackson (JB395)

References

1. Official Qtum Core and QRC20 Tokens guide on Medium

2. Some excellent QRC20 token resources from the Community:

  • Silverminer, How to claim Bodhi Tokens, on Steemit
  • Sam Suh, QTUM Wallet Tutorial using the QBao Wallet — for Bodhi (BOT) Tokens or other QRC20 Tokens, on Medium

3. Excellent references on adding tokens and token transactions for wallets including mobile, QBao, qtum-qt and qtumd/qtum-cli from the Bodhi Foundation.

4. The Bodhi token contracts on GitHub.

5. My favorite Ethereum ERC20 token, the UET. Sorry I missed this ICO.

6. Alice’s Adventures in Wonderland, full text.

7. Music for blockchain research: Be In The Moment with Amsterdam DJ Armin Van Buren and his weekly vlog A State of Trance.

Armin in Southeast Asia.

8. Obligatory drone footage (DJI Mavic Pro) of Amsterdam, watch in 4k.