Imagine Coin is a conceptual art piece designed to explore the relationship between arbitrary Replicated State Machine transactions and monetary value. It accomplishes this with a contract that conforms to a standard ERC-20 interface, but does not token balances or allowances in the contract state. This means that contract users are forced calculate token balances by using their imagination to interpret all Imagine Coin activity.
For an example of what an off-chain state machine might look like, see the example code at the bottom of this page, as well as the Imagine Coin Explorer.
Replicated State Machines
State Machine Replication is the key concept to understand the application layer of blockchains. While various cryptographic and network consensus mechanisms are used to determine the validity and order of transactions, smart contracts give meaning to these transactions. Given the same ordered list of events, any state machine within a network should be able to deterministically calculate its own state from scratch.
Consider the following set of events:
- Alice mints $10
- Alice transfers $8 to Bob
- Alice transfers $3 to Charlie
As long as a network agrees on the rules of the state machine (along with the order of events), each node should be able to independently arrive at the same state. Of course, changing the rules would lead to a different end state. In this example transaction 3 could fail, or it could leave Alice with -$1. Depending on the rules, changing the order of transactions could have no effect on the state, or it could leave Bob with $0.
Integers & Value
One popular use of smart contracts on the Ethereum network is modeling ownership of fungible and non fungible tokens. While some contracts are fairly complicated, the rule set governing the actual ownership of tokens tends to be quite simple. For fungible tokens, this amounts to incrementing and decrementing integers that are assigned to addresses.
People tend to have strong emotional attachement to these integers. They can use these integers to make other blockchain integers go up and down, they can prominently display these integers on websites for others to see, or they can use their integers to convince large centralized institutions to increment integers in a central database. These integers can even lead to acquiring pieces of paper, which may be exchanged for real, non-digital things such as sandwiches.
While this system is largely decentralized and trustless, it's also largely immaterial. Integer values and physical paper might be fairly concrete, but the meaning behind them is determined entirely by the imagination of the participants. Moreover, getting from one integer to another integer to another integer to a piece of paper to a sandwich requires multiple participants in the chain to share similar ideas around abstract concepts such as value and ownership.
Where the existing token ecosystem relies on collective imagination to define the meaning of arbitrary values stored on the blockchain, Imagine Coin takes things one step further: it relies on collective imagination to define the rules that determine these values.
Imagine Coin is a smart contract that defines functions for the full ERC-20 interface, but refrains from implementing any logic for these functions. This means that the Ethereum blockchain determines the order and validity of the contract's transactions, but no logic or storage of data is performed. Users of the contract are free to determine the meaning behind these transactions. The execution of the state machine takes place in their imaginations.
The imaginary state machine consists of the following events, which are presented with non-binding suggestions as to what they could potentially mean.
- Mint: Increment the caller's token balance by the amount specified. Fail and revert if the transaction does not include enough Ether at the price of 0.0001 ETH per token. Fail and revert if the specified amount of tokens would increase to total mint count above 1 million.
- Burn: Decrement the caller's token balance by the amount specified. Fail and revert if they attempt to burn an amount greater than their current balance.
- Approve: Set an allowance for spender. Fail and revert if the amount is greater than the sender's balance.
- Transfer: Decrement the sender's token balance by the amount specified, and increment the recipient's token balance by the amount specified. Fail and revert if this amount is greater than the sender's balance. Fail and revert if the function caller is not the sender, or if the amount is greater than the caller's allowance. If the caller is an approved spender, decrement their allowance by the amount of the transaction.
These events are emitted by the contract convenience, but do not interoperate with the existing ERC-20 ecosystem.