Creation of arbitrary tokens on blockchain in an permissionless, self-validating network
The challenge in the current environment is that there are many choices in which platform can be used to create digital tokens. At its core a digital token itself is nothing special, we use them all them time without knowing it. From cookies in our browsers, to the secret links that are embedded in URLs, we use tokens everyday. So what is it that makes the digital tokens so special? It is the blockchain layer that makes the record of these tokens public and thus sharable in a much more easier way, and the addition of the innovation that Bitcoin brought with the solution to the double spend problem -- in this case, the problem of unique tokens being used twice being detectable without a centralized ledger of the tokens being kept in a server -- is what makes digital token on blockchain so useful. For the first time ever people can digitize their assets and sell them into a digital marketplace, and with the advent of digital currencies, they can also take payment in other tokens, or crypto currencies, thus eliminating the last remaining barrier to trade, which is the physical shop front.
Of course, any digital asset token which is not a cryptocurrency itself, carries with it an additional risk to the bearer. That of redeemability. This is the same risk that every IOU carries implicitly. Thus tokens are only as valuable and credible as their issuer is. And as we all know there are many varying levels of credibility in the market. There is so much variation that we even have a credit market itself to trade on the differences of credibility of given entities. Thus before we embark into creating a new token economy, we must first evaluate the different risks that we are attempting to reduce, which will help us in deciding the optimal design in the system that we develop. For that it helps to examine every blockchain token platform in differing layers, as each carry with it a different set of risks.
Layers
Consensus Layer
This is the base blockchain layer. The risks here are consensus failure, blockchain stagnation, 51% attackers, protocol bugs which fork the chain unintentionally. This layer is operated by the miners in a proof of work system, and they are generally uninterested in the information they are processing. It is much like a financial clearing house, in that they are indifferent to what is being cleared, so long as all the books balance out in the end. Miners validate transactions and build consensus blocks for a fee and are additionally awarded with inflation. Crypto currencies on their native blockchain are secured by this layer, and that is why they are the most secure token on its native blockchain.
Some token system proposals have the miners doing the validations for tokens that are moving on the blockchain. Others have the miners only commit and validate hashed proofs of the token validation logic which happens at a separate layer operating above the miners. We prefer the latter strategy, as it keeps the mining layer agnostic to token transfers (not being able to see what tokens are being transferred or even the amounts makes for more impartial miners), and presents less of a chance for transactional discrimination. Additionally, changing the base protocol to allow for miners to validate tokens presents some technical trade offs which negatives do not outweigh their advantages (UTXO bloat etc).
Validation Layer
This is a layer of servers that operate on top of the blockchain that does the validation of the token transfers. It is were the ‘token rules’ logic is run. Such rules may be who is allowed to issue tokens, transfer tokens, blacklists, token expiry, dividend rules etc. The output of the validation must be published to the blockchain in the form of a proof, which can then be read by all the users of the token network in order to simplify the processing at the wallet level. This level is somewhat like a private blockchain. It’s servers are only run by the participants in the token network which care to accept and send the tokens and nobody else. Permission to do so must be free and not restricted, and this is achieved by the fact that the validation code must be openly obtainable by anyone from the internet (perhaps through bittorrent magnet links) because any one who wants to accept the token as a business should be able to run their own services to contribute to the validation of all the transactions that involve the token. The key concept here is that an invalid token transaction (double spent etc) is still a valid txn on the blockchain. The only servers that ensure the token layer rules are the servers that validate them voluntarily. Every wallet should at the least validate its own tokens that it receives, but the validation layer validates ALL token transactions for the common good of the token network participants. All validation proofs or fraud proofs are committed to the blockchain for all to see.
Wallet Layer
This is the layer that runs on the mobile. It is at its base an SPV wallet, but it may need to do extra processing to validate token txns that concern it. It needs to be able to receive tokens from others, and be able to send them. It should be able to determine balances for tokens under control, and also be able to identify who are the token issuers and how to contact them.
ERC20 vs Custom Token Layer
The big difference between the Ethereum model of token support and the one described above (with a separate validation layer which is customized by token) is that ERC20 allows a simple interface that is built into a smart contract that lives in the consensus layer of the blockchain, so that the miners process all the validation rules associated with the token. This provides a seemingly better security model than one where the validation layer is separate. Although it does come with many tradeoffs, the first of which is that the mining layer is exposed to smart contract bugs. Many ERC20 bugs have been revealed that compromised the integrity of the tokens. Due in part to the fact that if the verification of token logic is done at the mining level, means that all miners will need to adhere to the same set of rules. For simple tokens where the only thing that need to be validated are double spend prevention (balance integrity) this is simple and bugs that affect the mining nodes will be rare, but if that is the case one needs to consider why the miners will be required to process logic which is simple enough to be done on a specific verification layer network for the token itself. The other consideration is that for the miners to be able to do the verification, that means that the smart contract itself needs to persist in the blockchain, and in the case of ERC20 model, this manifests itself as a smart contract that once launched it cannot be upgraded easily. If the verification logic for a particular token is done off-chain (but finality committed to the blockchain) then the logic can be upgraded or patched in the case that bugs are found. This is the main benefit of running a separate token verification layer.
The downside of running a separate layer is that the trust model is more centralized (though still more decentralized than using a central ledger controlled by one party) because it is a federation of verification servers instead of the decentralized mining network which is processing the token logic. This at first seems a disadvantage, but on closer examination, this is an acceptable trade-off, given the fact that any token inherently needs to trust the issuer(s) of the token by intrinsically. A token, unlike a cryptocurrency on its native blockchain, cannot be completely trustless. There is always the intrinsic trust relationship with the issuer of the token to be able to redeem the token for the asset that it represents. Therefore, as this trust relationship cannot be eliminated through blockchain, there is no reason to push this validation of the token rules onto the blockchain consensus layer. Some tokens may be privately circulated, others may be publicly made available, but both will have its validation servers either running by approved participants or the validation code made publicly available to any validator. In both cases though, the validation proofs will be committed to the public blockchain so that all validations valid or invalid, honest or cheats, will be provable for public scrutiny. This is all the mining consensus layer needs to support. A public record of information, where the logic required to process and interpret that information is off-chain.