Cryptocurrency
A ledger is defined as a book of financial transactions.
- if all transactions were recorded reliably and securely in a ledger,
- there would be no need for dollars in a physical world
- the ledger could server as the currency itself
- thus, a fully digital currency with digital ledger does not need a physical currency
- ledger can be maintained without trusting a central authority as a distributed ledger using a blockchain
Cryptocurrency Construction
- to construct a decentralized digital currency, we need a digital unit of work
- one cryptographic hash computation can serve as a basic unit of work
- more work is considered “better”
- because ambiguous cases will always be resolved in favor of the result that represents the most work
- more work is considered “better”
- one cryptographic hash computation can serve as a basic unit of work
- how do we know that an entry in a distributed ledger is valid?
- by requiring ledger entries be digitally signed
- To mitigate duplicate ledger entries
- we add a transaction number to each entry
- this makes each ledger entry unique, so duplicates are known to be fraudulent
- To prevent overspending (offering to pay an amount they can’t afford to pay):
- require everyone to pay an initial amount to buy into the ledger
- then check to ensure they don’t overspend
Decentralized Distributed Ledger
- To make the distributed ledger decentralized,
- we allow anyone to have a copy of the ledger and anyone can make modifications to it
- problems of a distributed ledger
- maintaining a consistent view of the ledger across multiple copies that are constantly being modified
- people trying to cheat
- to mitigate these problems, the following rules are imposed:
- transactions must be signed
- nobody can be overdrawn at any time
- transactions are broadcast to everyone
- even with the above rules, multiple ledgers can and will exist at any given time
- solving this is the core issue of a viable distributed cryptocurrency
- we deal with this in terms of work
- a hash is the unit of work
- a ledger with the greatest expected work is considered the “correct” ledger
- since more hashes = more work, a ledger that represents more hashes is better
- individual transactions are grouped into blocks
- a certain amount of work (hash computations) is needed to validate a new block
- anyone can do the work to validate, but it is computationally expensive
- so this work is incentivized by rewarding cryptocurrency for finding a valid hash for a block
- people who compute hashes to search for one that validates a block are known as miners
- this generates new “money” similar to how physical minders find new gold from the ground
- a certain amount of work (hash computations) is needed to validate a new block
- we don’t want to revalidate each block at each step, so blocks are chained together
- to create a chain,
- the hash value of the previous block is put into the header of the current block
- any user can create new transactions, which are formed into blocks
- these blocks then get appended to the blockchain when a miner computes a validating hash
- to create a chain,
- since anyone can create blocks and compute hashes, there can be multiple blockchains at any time
- but the blockchain representing more work (hashes) wins
- what happens in a tie?
- user must wait until there is a longer blockchain to break the tie
Varying Aspects of Cryptocurrency Approaches
- additional refinements to cryptocurrency approach:
- may want to adjust the expected number of hashes as the computing power in the network grows
- e.g. Bitcoin’s threshold is adjusted repeatedly to maintain an expected time of 10 minutes for each new block to be validated
- may want to limit the total amount of currency that will every exist
- since source of new currency is mining,
- the mining reward can be reduced over time
- when it reaches 0, there will be no incentive to mine for new coins
- e.g. Bitcoin is limited to 21,000,000 bitcoins
- but there must be an incentive for miners to continue to validate transactions
- accomplished by adding transaction fees
- can be allowed to vary or even be optional
- the greater the transaction fee, the greater the incentive to include the transaction in a block, and the sooner it will be validated
- accomplished by adding transaction fees
- since source of new currency is mining,
- using Merkle trees
- consists of hashing the individual transactions in a block and then computing the hashes of these hashes, and so on, resulting in a tree
- advantage is that only the root hash of the Merkle tree is needed in each block computation
- which greatly reduces the amount of data that must be hashed
- privacy
- cryptocurrency outlined above requires digital certificates
- these identify the user
- but the identity within the cryptocurrency network does not need to be the users actual identity
- thus cryptocurrencies like Bitcoin are pseudonymous
- cryptocurrency outlined above requires digital certificates
- may want to adjust the expected number of hashes as the computing power in the network grows