วันศุกร์ที่ 16 มิถุนายน พ.ศ. 2560

bitcoin & blockchain

Bitcoin is a digital asset and a payment system. The system is peer-to-peer and transactions take place between users directly, without an intermediary i.e. banks. These transactions are recorded in a distributed ledger (สมุดบัญชี) called blockchain. Bitcoin miners verify bitcoin transactions to get awarded as bitcoins. (https://youtu.be/C_sYagsr014)

Blockchain is a secure distributed immutable database shared by all parties in a distributed network.
https://medium.com/@Francesco_AI/the-convergence-of-ai-and-blockchain-whats-the-deal-60c618e3accc

To summarize, a blockchain is a decentralized database which logs records by grouping transactions (data) into blocks. These records are unchangeable, append-only and can be used to create and document a history of lots of different things.
https://medium.com/blockchain-review/whats-the-difference-between-blockchain-distributed-ledger-technology-19407f2c2216

A blockchain is a distributed public ledger that is secured by a peer-to-peer network and registers transactions and maintains assets without the need for centralized authority. The records on the blockchain are grouped in a logical block structure. These blocks are linked sequentially one after the other, and the entire chain is referred to as a blockchain. Blocks placed anywhere on the blockchain cannot be changed without changing other blocks.

In the step 3 of the below picture, account owner uses his/her own private key to encrypt transaction (e.g. money transfer). In the step 4, bitcoin miners uses public key of that guy to approve the transaction. In the step 5, the miners hash the transaction and store in blockchain. For more details, please see the second picture.










Cf. https://www.weforum.org/agenda/2017/06/blockchain-is-stalling-but-whats-holding-it-up?utm_content=buffer867c2&utm_medium=social&utm_source=facebook.com&utm_campaign=buffer












3 miner ต้องใช้ PK ถอดคำสั่งโอนเงินเพื่อตรวจสอบว่ามาจากเจ้าของ pk ตัวจริง จึง เอา transaction ดังกล่าวของ Alice ใส่ block แล้วเริ่มขุดบิทซึ่งเป็นการแข่งกันหา nounce เพื่อสร้างค่า hash (ของ previous hash+transaction+nounce) ที่ตรงตาม prefix format ของ bitcoin ก่อนก็จะได้รับรางวัลเป็น bitcoin จากนั้นก็จะส่ง nounce ที่ hash ได้ก่อนนั้นไปให้คนอื่นๆ ลอง hash ว่าถูกต้องไหมก่อนเอาใส่ blockchain ของแต่ละคน กระบวนการตั้งแต่เริ่มขุดจนทุกคนยอมรับนี้เรียกว่า consensus protocol หรือ proof of work (PoW) ซึ่งช่วยป้องกันไม่ให้การแอบแก้ไขทำได้โดยรวดเร็วทุกโหนด เพราะการขุดเพื่อ append แต่ละ block ใช้เวลาประมาณ 10 นาที จึงไม่รองรับการ read จาก chain แบบ real-time ข้อมูล transactions ทั้งหมดจะถูก replicated ไว้ทุกโหนด

https://nuuneoi.com/blog/blog.php?read_id=933

http://staging.spectrum.ieee.org/static/how-a-bitcoin-transaction-works

Bitcoin values in many aspects
https://www.quora.com/How-is-the-value-of-Bitcoin-calculated

Original price of bitcoin is just like that of orange
https://www.luno.com/learn/en/article/how-is-the-price-of-bitcoin-calculated

More about bitcoin
https://bitcoin.org/
http://www.imponderablethings.com/

แท่นทำเหมือนเงินคริปโต (cryptocurrency mining rig) คือ computer ปกติแต่มี GPU หลายตัวหน่อย เช่น

  • MINING Motherboard intel
  • Integrated Intel CPU
  • 4Gb of RAM DDR3
  • 8 GPU NVIDIA P-104
  • SERVER MiningCave BOX
  • YOU NEED TO CHOOSE POWERSUPPLY IN OPTION
  • YOU NEED TO CHOOSE YOUR OS IN OPTION

(https://miningcave.com/product/8-gpu-box-8x-p-104/)


Blockchain platforms:
https://www.ibm.com/cloud/blockchain-platform/developer

https://www.ethereum.org/

https://libra.org/en-US/open-source-developers/

Blockchain is good for logging digital assets with high incentive to rob.

Ethereum development VM (เป็น service แล้ว connect ด้วย Chrome extension) : https://www.trufflesuite.com/

Remix เป็น IDE สำหรับภาษา solidity ที่ใช้กับ Ethereum

===PoW vs Proof of Stake (PoS)===
Two popular consensus mechanisms in blockchain technology.

1. Proof of Work (PoW):
Mechanism: PoW is a consensus algorithm used by blockchains like Bitcoin. In PoW, miners compete to solve complex mathematical problems to validate and add a new block to the blockchain. Solving the problem requires computational power and energy, making it a costly process.
Advantages: PoW is highly secure due to the difficulty and cost involved in solving the problems, making it hard for any single entity to take control.
Drawbacks: PoW is criticized for its energy consumption, as miners use significant computational resources, which has environmental implications.

2. Proof of Stake (PoS):
Mechanism: PoS relies on validators who are selected based on the number of coins they hold and are willing to "stake" as collateral. These validators are then allowed to create new blocks and validate transactions based on their stake. The larger the stake, the higher the chance of being selected as a validator.
Advantages: PoS is much more energy-efficient than PoW, as it doesn’t require extensive computation. Additionally, it encourages long-term investment in the blockchain, as validators benefit by holding and staking coins.
Drawbacks: PoS can be seen as less decentralized since wealthier participants (those with more coins staked) have more influence in block validation, potentially leading to centralization.
In essence, PoW relies on computational effort, while PoS relies on the financial stake validators have in the system. The choice of PoW or PoS affects the blockchain's energy consumption, security model, and degree of decentralization.