Money is perhaps the most obvious usage of cryptocurrencies but there are other ways to use them. In this section I’ll highlight some of the alternative usages and we’ll see that we can build other functionality on top of existing cryptocurrencies.I generally try to avoid the word blockchain which sometimes refer to private blockchains or blockchains which use a consensus model with known and trusted actors. Facebook’s Libra is such an example and IBM’s blockchain is another.Don’t let the similar names fool you: consensus algorithms with known participants and those with unknown participants are very different. I only consider those using the latter to be cryptocurrencies.
The first thing we can observe is that it’s possible to insert data into the ledgers of cryptocurrencies, essentially making the data immutable. It’s not important exactly how, but if you’re curious here are some ways:
Miners can add data to blocks.
For example Satoshi left a message in the first ever Bitcoin block:Satoshi embedded his message in the “Coinbase data” entry of the block. Other miners usually include the name of their mining pool. Such as in this block the coinbase data says “Mined by AntPool48”.Read this for more info about coinbase transactions.
The Times 03/Jan/2009 Chancellor on brink of second bailout for banks
Transactions can hold data.
See the OP_RETURN field in this Bitcoin Cash transaction which says:
Memo has reached 500,000 on-chain actions!
Addresses are user controlled.
Even if it’s not intended you can always insert arbitrary data as long as you can control your address.To control your address you can keep generating a new until you find one you like. If you want a vanity address for personal use you can generate one, for example one starting with “1Crypto”. Keep in mind that finding an address with 6 characters or more can take a long time. For example you could chain transactions, by sending from address to address, and treat the second character of the receiving address as your message:
To produce the message “Hello”.
Bitcoin does more than just transfer coins from one address to another. What it actually does is execute a small scripting language which is responsible for unlocking funds and transferring them to new addresses. You can for example send funds from several addresses to many addresses or lock funds and require more than one key to spend them.This is the script of a standard Bitcoin transaction (amount, destination and other data is specified elsewhere):OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIGOP_RETURN is another type of opcode which marks the output as invalid. It’s commonly used to add data to transactions and is the preferred way to embed data because nodes concerned with storage can remove it and still be able to fully validate new transactions.
The scripting language in Bitcoin is fairly limited but the scripting language in Ethereum is much more powerful and can do more things. You can for example create games where you buy and sell cats on Ethereum.Ethereum’s powerful scripting language comes with all sorts of trade-offs. It makes it much more difficult to scale—which is already difficult with Bitcoin.The scripting language in Ethereum is also Turing Complete, meaning it’s impossible to know if a script terminates. This means a new concept gas has to be introduced, drastically increasing the complexity of the system. Bitcoin avoids this problem by not having a Turing Complete scripting language.
Now it doesn’t matter if you know what a script is or how it works, just remember this: cryptocurrencies can do more than just transfer coins from one address to another. We’ll go into some of the examples in the following chapters.