What is a Blockchain?
- Bitcoin was the first one to take blockchain mainstream
- Bitcoin is like a digital gold
- Ethereum allows for Smart contract
- Chainlink provides data and external computation to smart contracts.
- Hybrid Smart contracts combine on-chain and off-chain components ~ Smart contract
- ETH and BTC are Proof of Work(at the time of recording)
- ETH 2.0 will be Proof of Stake Sharded Blockchain
- PoW & Pos are sybil resistance mechanisms
- Consensus is how blockchains decide what the state of the chain is
- Strictly Speaking, Nakamoto Consensus(Combination of PoW and longest chain Rule) as opposed the PoW is the consensus used by BTC and ETH
- Sharding and rollups are solutions to scalability issues on layer1s
- Layer1 is any Base Layer blockchain implementation, BTC or ETH
- Only so many transactions can fit into a block, leading to high gas prices
- Gas Prices represent how much it costs to perform executions on-chain
Features of Blockchain
- Decentralized: Not controlled by a single centralized entity. Run by a network of independent users.
- Transparency: Rules & transactions. That does not mean whatever you do will be tracked. Your privacy will still be protected
- Speed: Blockchain is verified by a decentralized collective. 10mins to seconds
- Immutable: Security, cannot be tempered with or corrupted
- Remove counter-party risk: Agreement for every one to execute. i.e., insurance company.
- Allow for Trust Minimized Agreements: Math-based Agreement. Freedom and Trust. Self-executing
- Hybrid Smart Contracts combine on and off-chain: Bring data into and make external computation
- DAOs: Decentralized Autonomous Organization
- Testnets are free and for testing smart contract, 常见的有Rinkeby, Kovan这些
- Mainnet cost money and are considered "live"
- Faucet is an application that gives us free test tokens, like free test Rinkeby Ethereum.
- The amount of "gas" used and how much you pay
- Etherscan is an example of Block Explorer, an application that allows us to view transactions that happen on a blockchain.
- Gas is a unit of computational measure. The more computation a transaction uses, the more "gas" you have to pay for. Every transaction that happens on-chain pays a "gas fee" to node operators. 一般Gas Fee以Gwei为单位
- The amount of "gas" used and how much you pay depends on how "computationally expensive" your transaction is. Sending ETH to 1 address would be "cheaper" than sending ETH to 1,000 addresses.
- Gas: Measure of Computation use
- Gas Price: How much is costs per unit of gas
- Gas Limit: Max amount of gas in a transaction
- Transaction fee = Gas used * Gas Price (GWEI)
- Gas price is based off the "Demand" of the blockchain
- ASAS, <2m, <5m, <30m, Highly Volatile
- The more people wanna make transactions, the higher the gas price, and therefore the higher the transaction fees.
- Hash: A unique fixed length string, meant to identify a piece of data. They are created by placing said data into a "hash function"
- Genesis Block: the first block in a blockchain, the prev of which goes like 000000
- Blockchain: is Immutable since every time you change one thing, all the .chains after will be ruined. 在节点足够长的时候全部Redo一遍需要很大的运算量，但理论上来说只要是Blockchain controller, 还是可以一个一个mine更改回去的
- Block: A list of transactions mined together. Decentralized having no single point of authority
- Mining: The process of finding the "solution" to the blockchain "problem". In our example, the "problem" was to find a hash that starts with four zeros. Nodes get paid for mining blocks.
- Nonce: A "number used once" to find the "solution" to the blockchain problem. It is also used to define the transaction number for an account/address.
- Private Key: Only known to the key holder，it's used to digitally "sign" transactions. (Secret Password) and people can VERIFY this Private Key using Public Key.
- 只能使用Private Key才能签字并将Message导出为Message Signature,但使用Private Key就可以Examine Message Signature是不是你签字的。Transaction同理
Signing a transaction: A "one way" process. Someone with a private key sings a transaction by their private key being hashed with their transaction data. Anyone can then verify this new transaction hash with your public key.
Consensus is the mechanism used to agree on the state/single value of a blockchain, especially in a decentralized system
1.Sybil Resistance 女巫阻力 (Proof of work, Ethereum and Bitoin)
- PoW(Proof of Work): Miners. Block Time 与 Solution的复杂程度成反比 To figure out who the block author is. The first node to figure out the answer to the block chain rule is gonna get both Block Reward(such as Bitcoin, ETH) and Transaction Fees
- Pos(Proof of Stake): Validators, put up collateral(连带，你乱来就会失去链上的资产) as a sybil resistance mechanism, 相比Pow更加环保，因为就指定一个node去验证，剩下的只要监督它一个，例如Avalanche, ETH2.0...
- Nakamoto Consensus[严格意义上目前以太坊和比特币真正基于的Consensus，但很多时候会和PoW混用]: Combination of PoW and longest chain Rule. 使用最长的链条
- Block Confirmations: 在最长链中，这个Block前面有多少个Block
- Sybil Attack
- 51% Attack: ETH Classic is not ETH, 把其他链强行嫁接？
Proof of Work uses a lot of energy
Scalability: 可延展性，不能因为节点变多就使得Gas Price变得超级高。解决方案是Sharding
Sharding: Block chain of Block chain,主链协调各链
Layer1: Base Layer blockchain implementation
Layer2: Any Application built on top of a layer1