Blockchain and Crypto
Published: 2022-11-28 03:47:12

Alchemy University Ethereum Developer Bootcamp Week one course begins with an overview of blockchain and crypto.

*Disclaimer: Most of the content below is a general summary and retelling of the information from the course.*

# Blockchain Network
The blockchain is the protocol connecting a network of machines. Each network machine or "node" will run the written code.

The blockchain enforces these rules or codes, a "smart contract".

# Purpose of the Blockchain
"The purpose of the blockchain is to have **a network of computers agree upon a common state of data**". A person or organization may participate in this process, but they can't control it.

A generally used term, **consensus**, describes a network agreeing on the state of the data.

The most common use case for blockchains is **cryptocurrency**.

# Bitcoin: The First
Bitcoin was the first successful blockchain and cryptocurrency.

Bitcoin works by using all these components together:

- Proof of Work (Security)
- Mining Rewards (Financial Incentives)
- Public Key Cryptography (Authentication)
- Linked Data Structure (Chronology)
- Peer-to-Peer Network (Permissionless)

## Why is blockchain needed for cryptocurrency?
When exchanging money between individuals, trust is usually needed to ensure the money is given/received. The blockchain was invented as a solution for trust between individuals or groups. 

In 2008, an unknown person or persons under the pseudonym Satoshi Nakamoto released a whitepaper on Bitcoin. It described "a system that would create a peer-to-peer network for exchanging value". 

The paper describes a chain of blocks tied together cryptographically, or blockchain.

# Smart Contract Blockchains
Smart contract blockchains allows developers to decentralize where the code runs.

Decentralization isn't about the code, but how the code is executed. When the code is compiled and deployed to a decentralized blockchain, it is a smart contract. The code becomes publicly available on the blockchain, and the network nodes will enforce the code logic through the financial incentives of the blockchain protocol.

# Crypto
Before cryptocurrency, there was crypto.

Two key primitives to keep in mind for blockchain development are Cryptographic Hashes and Public Key Cryptography.

# Cryptographic Hash Functions
"A hash function is a function which takes an input of any size and turns it into a fixed size output."

The input can be any data type: number, image, video, string, etc.

Cryptographic hash functions need five specific properties:

1. Deterministic - One specific input always maps to the same specific output
2. Pseudorandom - It is not possible to guess the output based on the output of similar inputs
3. One-way - If someone gives you a new output, you could not determine an input without guessing
4. Fast to Compute - It must be a quick calculation for a computer
5. Collision-resistant - The chance of a collision should be infinitesimally small

Two important use cases for Hash functions for blockchain developers are Commitments (Protocol & Smart Contracts) and Proof of Work.

For blockchains, having a unique, fixed-sized representation of output regardless of input size is critical for saving space.

# Resource:
[Alchemy University](https://university.alchemy.com/): Ethereum Developer Bootcamp