2014-04-28

Smart contracts and the demise of copycoins

Today I would like to talk about a few ways smart contracts in Crypto 2.0 systems can lead to the demise of copycoins. Lets start with some definitions:


  • Smart contract in this conversation denotes a program that exists in a cryptocurrency that can autonomously send and receive currency units according to given predefined rules.
  • A Crypto 2.0 system is a cryptocurrency that can support transactions in any user-defined currency. For example, Ripple, Ethereum and Mastercoin are all Crypto 2.0 systems.
  • A copycoin is a cryptocurrency that is identical to a number of other currencies (especially Bitcoin) from a technical standpoint. For example, Litecoin has a different block maturation speed and hashing algorithm, but is otherwise identical in features to Bitcoin. Just like Dogecoin, Auroracoin, Peercoin and Feathercoin, but unlike Namecoin, Ripple, Ethereum and Mastercoin which all do something innovative.
  • Ledger - an equivalent to a block for a Crypto 2.0 systems. I use this term to distinguish it from "blocks" that will be used to denote something inside of a Crypto 2.0 system.
Please note that technical aspects of a coin is not everything that makes a currency. The community is just as important. Just because a coin is a copycoin, doesn't mean it's not valuable - just look at Dogecoin.

Technical requirements

To create a copycoin, one usually takes an existing code base from Bitcoin/Litecoin/whatever and changes a few settings:
  • Coin name, address net byte (to determine if addresses start with 1, L, D or whatever)
  • Block maturation time
  • Number of coins per block
  • Coin distribution model (whether the amount of coins per block drops in the future and how)
  • Whether any coins are premined
  • Hashing algorithm (SHA, Scrypt, whatever)
  • What "Proof Of" the coin uses for hashing (proof of work, proof of stake, etc.)
Tweaks to those variables alone give us about 99% of available coins out there. The thing is, all of those variables can be very easily encapsulated into a smart contract and ran on a Crypto 2.0 system. This means that most of the copycoins can in the future be ran as a part of a bigger currency system. Now that we know what we need, lets look how a smart contract for a new copycoin would look.

Crypto 2.0 benefits

When discussing something like this, we first need to ask ourselves "why?". Why would a copycoin benefit from running on a Crypto 2.0 system as opposed to running by itself? Here are a few reasons:
  • It may be more economical to run 1 Crypto 2.0 system with 100 coins on it, rather than 100 coins by themselves. If a coin has low transaction traffic, it will have a lot of overhead. One well utilized system can be run better at a scale
  • No 51% attacks - if the coin is run inside a system protected by a vast amount of computing power (Bitcoin), or is generally resistant to 51% attacks (Ripple), any subcoin will be immune to such attacks. This removes the fear of the dreaded multipools for many coins
  • Possibly faster transaction times - some networks are insanely fast in comparison to even the fastest copycoins. Dogecoin runs at 1 block per minute. Geistgeld used to do 1 block per 15 seconds, Ripple creates a ledger every 5 seconds (full confirmation, not just 1 confirmation) without running into a problem of block race. This means that the transaction speed on the network can be increased if a fast Crypto 2.0 system is used
  • Built-in exchange - A few Crypto 2.0 systems have a built-in distributed exchange, like Mastercoin or Ripple. This means a new coin on the system can be instantly traded there on the spot

Designing the smart contract

Now that we figured out why we want to do something, lets look at how this can be achieved.

To implement a copycoin with the conditions given above in a Crypto 2.0 system, we would create a smart contract that does the following:

  • Creates a new currency with a given name and currency symbol
  • Each time a valid "block" for the currency is created, it sends the block creator a specified amount of currency units
  • The amount sent is predefined by the distribution model
  • It charges fees for any transaction using a given currency and distributes it to the "miners"
Sounds fairly straightforward. Combining what I know about Ethereum (what their smart contracts can do) with what I know about Ripple (how the system handles custom currencies), implementing this would be easy. The most challenging bit would be validating "blocks" for a given currency. Lets look at that more closely...

"Blocks"

A "block" for a copycoin implemented in a Crypto 2.0 system would probably be more akin to a block header. Rather than containing all past transactions, it would be just a digest of what happened since a last block. Here is what would be needed in a block:
  • Reference to the current ledger of the Crypto 2.0 system - this would force new blocks to use new Crypto 2.0 ledger hashes to ensure only a new block can be submitted. In order for a block to be valid, the ledger used would need to be newer than the ledger used for the previous block
  • Specify the recipient of the block reward - simply stating who should receive the money
  • Reference the currency one is mining for - we don't want the same block to be used for more than 1 currency, unless we would be doing some merged mining
  • Pay the cost of running the smart contract - those operations are usually not free on the Crypto 2.0 systems
That's basically all that's needed for creating a basic block. The rest varies according to the Proof Of we'd be using.

Proof of Work

Fairly simple - each block created would have a nonce and the hash of the transaction needs to be smaller than a given difficulty. The difficulty would be adjusted by the smart contract based on how often the blocks are submitted.

The person submitting the block can also earn all the fees spent since the last block.

Proof of Stake

There are two ways of doing Proof of Stake. The simplest one is to ignore blocks entirely. This means that each time the currency is used and a fee is paid, the supply of the coin will diminish. Since getting paid based on how much coins you have or having the supply of coins diminish is really interchangeable (you end up having the same percentage of coins in the end), you don't need to create any blocks really.

Alternative Proof of Stake would pay all the people that currently hold the coin their fair stake. Whoever would pay for the block would initialize this distribution.

Proof of Burn

Whoever creates a new block has to pay a fee to create new coins. The fee would be converted to the coins based on a predefined ratio or algorithm. 

Combining proofs

There is no reason why those proofs can't be combined. For example, one could initialize a Proof of Work payout that also has a Proof of Burn to compensate the miner for the fees they paid to initialize the block reward payout or what have you.

Conclusions

It is possible that once smart contracts are well integrated into Crypto 2.0 systems like Ethereum, we will see a demise of the copycoins created in the old way.

I wonder whether this prediction will come true, or will I be proven wrong by too many people distrusting such solutions...

No comments:

Post a Comment