L1 How Bitcoin Works

How Bitcoin works [Mechanics]

 

Collective Entries of Records of Transaction Histories in a Ledger

(The Chain can be thought of as a Collective Memory of the Path of the Coins)

 

A transaction is just a is digital declaration of a party of its intent to transfer a certain number of bitcoins to another party, thus a completed transaction is when the assigned coins have been confirmed as owned by the receiving party on the chain.

 

  1. Technology
  2. Accounts
  3. Sending
  4. Receiving
  5. The Blocks

 

 

Technology

 

Bitcoin uses public-key cryptography, peer-to-peer networking, and proof-of-work to process and verify payments.

 

Authorization:

Bitcoin Uses an Ecliptic Curve Digital Signature Algorithm1 for its cryptography (ECDSA) & a

Peer to peer consensus system to validate accounts and transactions

 

An ECDSA Signature is a value that could only reasonably have been created by someone who has the private key that generated the public key. Bitcoin uses the secp256k1 curve to generate the public key pairing from a private key.2

 

 

Hash Functions:

++ Use in Digital Signatures

 

SHA 256 – Digest is Exactly 256 Bits in Length, Arbitrary Input Length

 

What Happens in a hash Function?

 

  1. Input: Message (Arbitrary, any size)
  2. Hash applies a mathematical transformation to it
  3. Produces a Digest as the Output (hash) – Fixed Length

 

 

 

 

 

Ideally there are Certain Design Goals for Cryptography Functions

 

  • Computationally Efficient

 

  • Collision Resistance, Hard to Find Colliding Pair of Inputs

 

  • Two distinct inputs that map to the same output
  • Trap Door Functions, Easy to Compute Hard to Decrypt
  • Output of M1 and M2 should always be different

 

  • Hide Information about the Outputs

 

  • Outputs should look random

 

 

Accounts

 

An Account can be thought of essentially as a distinguishable Identity that corresponds to a Public Verification Key and Private Secret Signing Key

 

 

Signature

A Digital Signature is a mathematical mechanism for combining a public sequence of numbers with a digital message

 

A method that binds a public verification key to the owner, and allows the owner to sign messages as valid using their private signing key.

 

  • Basically, you are affixing a sequence of numbers to bind your identity to a document (A process that binds an identity to an underlying message)

 

  • Ideally no one should be able to forge your signature

 

 

Keys

Create Two Keys with a Mathematical Relationship

 

SK: Signing Key (Private Key)

VK: Verification Key (Public Key)

 

Should be hard to come up with the Private Key if you only have the Public Key

 

 

RSA

Originally created by Rivest, Shamir and Adleman. RSA is an Asymmetric Cryptography Algorithm.3 Meaning that there are two keys used in the formula.

 

One Key to Encrypt (The Public Key: VK) and the other Key to Decrypt (The Private Key: SK)

 

It is based on the mathematical principle that multiplying large numbers is easy to do, but finding the factorials of large numbers is very difficult to do. AKA Prime Factorization4

 

 

Sending

 

A sending transaction is an entry in the blockchain ledger of assigning coins/tokens to another party.

 

The sending process also incurs a transaction fee as an incentive for others in the network to validate it

 

 

How it Works

Signing Process: M ^ SK -> SM

Verification Process: M + SM + VK -> Yes or No

 

The digital signature between the two parties:

 

Take the Msg (Transaction Details) then Hash it, then Sign the Hash

 

Transaction Details:

 

It includes the transaction records for the bitcoins Assigned to that account along with a cryptographic guarantee that the sending party actually has the bitcoins it is sending.

 

 

Process

  1. Sender takes the Digest of each of the past transactions (the inputs), the recipients of the coins being sent and the amount of them (the outputs), then signs the transaction as valid with their private signing key.

 

  1. It then gets broadcasted to the Bitcoin network that you are trying to send coins to this particular party as well as the fee you are willing to pay for it to be verified in a block.

 

  1. The bitcoins are sent (or signed over).

 

  1. Each payment transaction is broadcast to the network and included in the blockchain so that the included bitcoins cannot be spent twice in the future.

 

 

 

 

Pays to PubKey Hash (P2PKH)

Currently the most common way users exchange payment information.5

 

The standard Pay-To-Public-Key-Hash6 (P2PKH) transaction type lets you spend coin to a typical Bitcoin address, and then the receiver can further spend those coins using a simple cryptographic key pair.

 

 

TXID’s and UTXO’s

bitcoins sitting dormant in your wallet (or the amount of coin that is assigned to your account address) is called an Unspent Transaction Output (UTXO)

 

Every time you send bitcoin to another party you have to include a Transaction Identifier (TXID) to prove that the coin does in fact belong to you.

 

Essentially every transaction has to include all the bitcoin you have that is assigned to your address. Once spent the remaining balance from the transaction is re-assigned to you.

 

 

Receiving

 

Check the numbers work out correctly

Some mathematical assurance that the assigned value is correct

 

Doesn’t not know immediately if it double spent or not so waits for it to be confirmed as an immutable entry on the blockchain.

 

 

Blocks

 

If a transaction can be represented as an entry in the ledger

Then each block can be represented as a page in the ledger

 

All transactions are public and timestamped

 

The Genesis Block

The initial parameters for laws of the entire ecosystem

 

How is new Coin Minted?

Creating bitcoin _> Block Rewards

 

How is old Coin Burned?

Destroying bitcoin _> Technically can’t be destroyed

 

 

 

 

 

 

 

 

 

 

Introduction to Bitcoin: Assignments Pt. 1

L1 & L4: How Bitcoin Works & Bitcoin Mining

For Review

Proof-of-work (mining), blocks (timestamping), blockchains, and block-body data structures (Merkel trees) that were introduced in course 101.

This section deals with Bitcoin’s blockchain implementation details and the contents of its blocks.

 

Written assignments

  • What were the impracticalities of earlier cryptographic money schemes, and how does Bitcoin solve them?

 

  • What is the specific proof-of-work mechanism used by Bitcoin?

 

  • What is the “standard” format of a Bitcoin transaction? What can and can’t you do with Bitcoin transaction scripts? What financial ideas in b-money can and can’t Bitcoin implement? What were the security problems with non-standard transactions?

 

Assigned Readings

  1. Back: “Hashcash – a denial of service counter-measure” (2002)
    http://www.hashcash.org/papers/hashcash.pdf

 

  1. Nakamoto: “Bitcoin: A Peer-to-Peer Electronic Cash System” (2008)
    https://bitcoin.org/bitcoin.pdf

 

  1. The Bitcoin Developer Guide (current)
    https://bitcoin.org/en/developer-guide

 

Additional Supporting Material - References