#1 - Blockchain
Miguel Palhas / Hugo Gonçalves
@hgg
@naps62
Metamask
https://metamask.io/
Etherscan
https://etherscan.io/
Uniswap
https://uniswap.org/
Hardhat
https://hardhat.org/
Ganache
https://www.trufflesuite.com/ganache
Remix
https://remix.ethereum.org/
A storage system, similar to a database, with additional guarantees on security, censorship-resistance, decentralization & trust.
Security: Data is immutable and cryptographically trustworthy;
Censorship Resistance: Impossible to impose restrictions beyond the protocol rules
Decentralization: No need to rely and trust on a third party;
Trust: The system itself enforces the rules, not its creator/host or any individual entity.
Bitcoin's scientific breakthrough was not in inventing a new technology, but in combining existing fields of research to build something new:
Distributed Systems: where no central authority exists who can unilaterally manipulate the system
Cryptography: Public/Private key pairs allow establishing identity and mathematical proofs
Economics: Using economical principles to incentivize good behavior while deterring bad behavior (cryptoeconomics)
An append-only database
Each entry is a block, containing transactions;
Each transaction is cryptographically signed;
Nodes process transactions in blocks, and publish them to other nodes;
Every node validates incoming blocks;
If majority of nodes are good actors, the system ensures all the rules, without any central authority
Infeasible to hack the system (e.g.: a 51% attack)
{
from: "origin_account",
to: "destination_account",
value: "1 BTC",
fee: "0.0001 BTC",
timestamp: "2021-01-01 12:00:00"
...
}
It's hard for a decentralized system to reach agreement on a single truth.
A video that explains it much better than I ever could:
The ability to message and agree on something, without needing to trust the other participants, or the means of communication.
Block 1
tx 1
tx 2
tx 3
Block 2
tx 4
tx 5
tx 6
Node 1
Node 2
Candidate block 3a
tx 7 (alice's)
tx 8
tx 9
Block 1
tx 1
tx 2
tx 3
Block 2
tx 4
tx 5
tx 6
Candidate block 3b
tx 7 (alice's)
tx 10
Block 1
tx 1
tx 2
tx 3
Block 2
tx 4
tx 5
tx 6
Node 1 wins the race, creates block 3
Node 2 is still unaware of it
Candidate block 4
...
Block 1
tx 1
tx 2
tx 3
Block 2
tx 4
tx 5
tx 6
Candidate block 3b
tx 7 (alice's)
tx 10
Block 3
tx 7
tx 8
tx 9
Block 1
tx 1
tx 2
tx 3
Block 2
tx 4
tx 5
tx 6
Candidate block 4a
...
Candidate block 4b
...
Block 3
tx 7
tx 8
tx 9
After a small broadcast delay, both nodes get in sync again
Block 1
tx 1
tx 2
tx 3
Block 2
tx 4
tx 5
tx 6
Block 3
tx 7
tx 8
tx 9
(or why Proof-of-Work is important)
Alice has 1 BTC in her account
What if she submits a transaction sending "1 BTC to Bob", but also another sending "1 BTC to Charlie"?
A centralized authority (bank) would catch that, and refuse to process the 2nd transaction.
But without centralization, who is the police?
Miners want transaction fees.
They're economically incentivized to accept as many transactions as possible
Proof-of-work ensures they need work, which will be peer-reviewed by everyone else.
It ensures everyone polices everyone else.
It's a consensus mechanism (one of many)
Blockchain capacity is finite and time sensitive
A supply-demand problem is created
Proof-of-work creates both security and fairness in the system:
A real problem in Bitcoin and others, but not an inherent problem with blockchain, or proof-of-work.
Consensus protocol require a form of value to be staked by miners. That value is turned into protocol security.
In PoW, the value is given by forcing miners to spend computational power:
sha256 is compute-bound
more computational power ➔more mining power ➔ more profits
This causes overall network power (Hashrate) to escalate.
But PoW can also be memory-bound, latency-bound, etc, which does not scale as well.
What if two nodes broadcast a block at the same time?
To revert Block #3, we need to:
- Create a new Block #3b
- Send it to everyone, before someone else creates Block #4
Not easy, but statistically doable
(happens all the time, by accident)
To revert Block #2, we need to:
- Create a new Block #2b
- Create a new Block #3b as well
- Send them to everyone, before someone else creates Block #4 is created
Twice as hard, but might still be doable
To revert Block #1, we need to:
- Create a new Block #1b
- Create a new Block #2b
- Create a new Block #3b
- Send them to everyone, before someone else creates Block #4
Probably 99% unlikely, or something
Not real math
By adding work on top of it
#1 - Blockchain
Miguel Palhas / Hugo Gonçalves