CashTokens: Token Primitives for Bitcoin Cash
A new Cash Improvement Proposal (CHIP) for the May 2023 Upgrade is now available:
CHIP-2022-02-CashTokens: Token Primitives for Bitcoin Cash
The CashTokens CHIP proposes two, low-level token primitives: fungible and non-fungible tokens. Together, they enable decentralized applications comparable to global-state contracting (e.g. Ethereum), while retaining Bitcoin Cash's >1000x efficiency advantage in transaction and block validation.
The CashTokens proposal builds on the ideas behind PMv3. By "factoring out" these two common primitives, we can achieve many of PMv3's benefits – with more efficient contracts and backwards-compatibility for wallet software. CashTokens can be deployed in a typical protocol upgrade, requiring only full nodes to support the new virtual machine (VM) operations.
On Universal Token Standards
In the past, I've been hesitant to endorse efforts to create a "universal" token standard for Bitcoin Cash – I was concerned that any such standard would be "designing in the dark", and would need to be proven out in real-world use cases prior to standardization.
The core of this concern is that tokens must logically interoperate with the Bitcoin Cash VM. An upgrade that implements some colored coin behavior into the base protocol (e.g. OP_CHECKCOLORVERIFY
, OP_GROUP
, Unforgeable Groups, Confidential Assets) would be valuable for many use cases (chain-tracked equities, bearer bonds, pegged assets, etc.), but if such an upgrade were later found to be incompatible with large classes of BCH contract applications, the ecosystem could be forever stuck implementing expensive workarounds.
However, after a review of many potential contract constructions, there are two VM-compatible primitives which allow any "token standard" to be constructed: fungible and non-fungible CashTokens. Since these primitives are a logical extension of the existing VM design, they ensure that any larger standards developed using these primitives are interoperable with BCH contracts.
Primitives, Not Standards
While fungible tokens and non-fungible tokens are broad terms in other cryptocurrency systems, they have precise, minimal definitions in the CashTokens proposal. These basic "building blocks" can be used to develop larger standards (akin to ERC20, ERC23, ERC223, ERC721, ERC777, ERC1155, ERC1400, ERC1404, etc. in the Ethereum ecosystem).
Tokens
In the CashTokens proposal, tokens are a new type of asset which can be created and used on Bitcoin Cash. They can be issued by an entity (a person, company, etc.) or a decentralized application (i.e. covenant).
Like Bitcoin Cash, tokens cannot be counterfeited. Tokens can be held by any contract, wallets can easily verify the authenticity of a token or group of tokens, and tokens cannot be inadvertently destroyed by non-token-aware wallet software (a risk for SLPv1 tokens).
Fungible Tokens
Fungible tokens are "tokens" as most commonly understood – they have a total supply and each unit is undifferentiated from each other unit. Multiple groups of fungible tokens can be merged into a single group in a transaction, and that group can again be divided into multiple smaller groups of tokens.
Fungible tokens are the basic building block behind most exchangeable assets: stocks, bonds, options, pegged assets (other assets or currencies issued on Bitcoin Cash), general-admission tickets, loyalty points, etc.
Beyond representing off-chain assets, fungible tokens are critical for covenant applications to represent on-chain assets – e.g. voting shares, utility tokens, collateralized loans, prediction market options, etc. – and to implement complex coordination tasks – e.g. liquidity-pooling, auctions, voting, sidechain withdrawals, spin-offs, mergers, and more.
Non-Fungible Tokens
In contrast, non-fungible tokens are unique units which cannot be merged or divided. In the CashTokens CHIP, they are authenticated messages belonging to a token category – a domain of tokens issued by a particular entity or covenant.
Non-fungible tokens allow contracts to attest to some message, a commitment, in an impersonation-proof way: other contracts can safely read and act on the commitment, certain that it was produced by the claimed contract. This primitive enables covenants to design public interfaces, paths of operation intended for other contracts – even contracts which are designed and deployed separately.
Decentralized Applications
In short, non-fungible tokens allow contracts to "call" other contracts, while preserving Bitcoin Cash's massively-parallel performance (already 25,000 transactions per second on modest, 2020 hardware). With these building blocks, we can build advanced, decentralized applications on Bitcoin Cash.
Bitcoin Cash decentralized applications can already scale to millions of users without increasing transaction fees, even during periods of high network activity. Bitcoin Cash covenants don't rely on miners for transaction ordering, so high network usage has no impact on transaction fees.
Update (June 2022): see Jedex – Joint-Execution Decentralized Exchange, a technical demonstration of a massively-parallel, non-custodial, censorship-resistant decentralized exchange (DEX) built directly on Bitcoin Cash.
Deployment
CashTokens can be deployed using a small set of VM operations, meaning only full nodes need to upgrade their software. Existing wallets are not impacted: and a new CashAddress version allows token-aware wallets to avoid sending tokens to old software, and technical design of CashTokens even prevent them from being accidentally destroyed if inadvertently sent to older wallets.
Discussion & Feedback
The full technical specification is available on GitHub:
Reviews and feedback are deeply appreciated. Please open issues on GitHub, join the discussion on Bitcoin Cash Research, or chat with us in CashToken Devs.
You can also follow development by subscribing to CashTokens on Telegram.