自己做一些讓自己讀得懂的筆記
1.Bitcoin History
In 2008, a person under the pseudonym Satoshi Nakamoto published a paper Bitcoin: A Peer-to-Peer Electronic Cash System. Bitcoin software was released in January 2009 and the mining of the Bitcoin cryptocurrentcy officially started. The genesis block included the
“The Times” headline: “Chancellor on brink of second bailout for banks”. The article was about the state of the British financial system following the 2007–2008 financial crisis, and many believe that this is a hint to the purpose of Bitcoin: to create a more stable financial system. Satoshi Nakamoto vanished from the digital space shortly after releasing the code
for Bitcoin, and it is unknown who this person (or possibly a group of people) is. The first known commercial transaction using bitcoin happened in 2010 - two pizzas were bought for 10000 bitcoin.
直接引用了一下教材,簡單的解釋就是:
比特幣是一種加密貨幣,是一種數(shù)字資產(chǎn),使用密碼學(xué)來控制其創(chuàng)建和管理,而不是依靠中央機(jī)關(guān)。所以它具有去中心化。"比特幣 "一詞是在2008年10月31日發(fā)表的一份白皮書中定義的。
創(chuàng)立比特幣的原因是為了創(chuàng)造一種不受政府或金融機(jī)構(gòu)控制的數(shù)字貨幣。比特幣被設(shè)計(jì)成一種點(diǎn)對點(diǎn)的貨幣,意味著它可以直接從一個用戶發(fā)送到另一個用戶,而不需要第三方中介。
1.1 一個關(guān)于bitcoin的時間線
- 2008: Satoshi Nakamoto publishes the Bitcoin white paper.
- 2009: The first Bitcoin block is mined.
- 2010: The first known commercial transaction using Bitcoin takes place.
- 2011: The Bitcoin price reaches $1 for the first time.
- 2013: The Bitcoin price reaches $1,000 for the first time.
- 2017: The Bitcoin price reaches $20,000 for the first time.
- 2018: The Bitcoin price crashes to $3,000.
- 2021: The Bitcoin price reaches $65,000 for the first time.
關(guān)于區(qū)塊鏈要讀的一些文獻(xiàn)這里給個傳送門:http://t.csdn.cn/5F64K
(后續(xù)如果我看了我也會做筆記寫出來的)
關(guān)于區(qū)塊鏈的學(xué)習(xí)
這里推薦b站肖臻老師的《區(qū)塊鏈技術(shù)與應(yīng)用》,下面是他講的有關(guān)密碼學(xué)方面的筆記,后面應(yīng)該也會挑著密碼學(xué)的部分做筆記
2. Crytography of the Blockchain
bitcoin is a crypto-currency(比特幣是一種加密貨幣),但是其實(shí)區(qū)塊鏈(blockchain) 上所有的數(shù)據(jù)都是公開的,轉(zhuǎn)賬的金額都是公開的。
區(qū)塊鏈密碼學(xué)知識上涉及的一個是哈希函數(shù),另外一個是簽名。
2.1 the Hash function
2.1.1 collision resistance
其他的說法是collision free不過他不是很喜歡
if x ! =y
then H(x) = H(y)
哈希碰撞是客觀存在的,不能人為的去制造哈希碰撞,沒有高效的方法
暴力遍歷尋找,但是這種方法也不實(shí)際,考慮到輸入空間比較大的情況
(brute-force)
用來對信息求摘要 (message->digest)
H(m) 用來檢測對m的篡改
MD5( 淘汰,因?yàn)橐呀?jīng)知道如何人為制造哈希碰撞)
2.1.2 Hiding
哈希函數(shù)是單向不可逆的
由前得到后,得到后推不到前
前提條件是:輸入空間要足夠大,分布要比較均勻
x -> H(x)
digital commitment / digital equivalent of a sealed envelope(數(shù)字等效的密封信封)
兩個特性collision resistance 和 hiding 來實(shí)現(xiàn)
預(yù)測結(jié)果不能提前公開
可以把預(yù)測結(jié)果作為輸入,算出一個哈希值
可以公布出哈希值,作為sealed envelope,第二天收盤之后在公布結(jié)果
但是這樣輸入的結(jié)果很有限,容易預(yù)測出結(jié)果,股票就那么點(diǎn)
常用的方法是輸入后面拼接一個隨機(jī)數(shù),之后再一起取哈希
這里引入了nonce(在挖礦miner 后面也會出現(xiàn))
H(x|| nonce) 保證了輸入足夠隨機(jī),分布均勻
2.1.3 puzzle friendly
哈希值的計(jì)算,事先是不可預(yù)測的,不能猜測出結(jié)果,如果你希望你的哈希值的落在某個范圍內(nèi),只能一個一個輸入去試。
比如你可以嘗試得到下面這個proof:
前面20位都是0 (總共是256位)
H(x) -> 000000000(20個零)XXXXXX
(其實(shí)已經(jīng)有點(diǎn)挖礦的概念了)
miner‘s task is to find a nonce
nonce 是你可以尋找的隨機(jī)數(shù),通過改變它進(jìn)行哈希得到你想要的結(jié)果
比特幣是區(qū)塊鏈,區(qū)塊鏈就是一個一個區(qū)塊(block)組成的鏈表(chain),每個區(qū)塊有一個塊頭(block header),塊頭里面有很多域(domain)
其實(shí)后面會知道的就是 (XX|| XX|| nonce)
挖礦的目的就是對這個塊頭求哈希,使得整個
H(block header)<= target‘s space
在目標(biāo)的范圍內(nèi),其實(shí)也就是proof of work,是你工作量的證明
概念在這里:
Proof of Work (PoW) is a consensus mechanism used in blockchain networks, including Bitcoin. It is a computational puzzle that requires a significant amount of computational power to solve. The purpose of PoW is to ensure the security and integrity of the network by making it difficult and resource-intensive for malicious actors to manipulate the blockchain.
In PoW, miners compete to solve a complex mathematical problem, typically a cryptographic hash function, by repeatedly hashing different inputs until they find a solution that meets certain criteria. This solution is known as the "proof" and serves as evidence that the miner has expended a significant amount of computational effort.
第一段是proof of work的概念,第二段是礦工們的工作以及通過這個指標(biāo)來進(jìn)行工作量的證明。
“difficult to solve, but easy to verify”
雖然找到一個合適的nonce需要很大的工作量,但是一旦找到之后發(fā)布(broadcast)出去,其他人要驗(yàn)證(validate its valid)是不是符合要求是很容易的,只需要算一次哈希值來判斷。
比特幣中用的哈希函數(shù)叫做 SHA-256 (secure hash algorithm)
2.2 Signature
因?yàn)楸忍貛攀侨ブ行幕模鼪]有第三方進(jìn)行管理,是P2P結(jié)構(gòu),所以在比特幣中如果你要注冊,就只需要個人開戶,創(chuàng)立公鑰和私鑰一對
(public key and private key)
這就代表了一個賬戶,比特幣的信息
Bitcoin: local generate public(address) privacy(password)
- 不理解的自己可以去了解非對稱加密算法(加密用的是公鑰,解密用的是私鑰(但是這樣不能保證identification 身份認(rèn)證))
比特幣是反過來,先用私鑰進(jìn)行簽名 verifiied key,驗(yàn)證簽名用的是這個人的公鑰,因?yàn)槲乙靼椎氖沁@個人給我轉(zhuǎn)錢
- 公私鑰對產(chǎn)生的相同怎么辦?
實(shí)際當(dāng)中不可行,位數(shù)為256,為什么要做這種暴力拆解的事情
他說比地球爆炸的概率還要小。
前提是有一個好的隨機(jī)源
a good source of randomness文章來源:http://www.zghlxwxcb.cn/news/detail-615641.html
每一次簽名都需要好的隨機(jī)源,防止泄露私鑰文章來源地址http://www.zghlxwxcb.cn/news/detail-615641.html
到了這里,關(guān)于區(qū)塊鏈學(xué)習(xí)筆記(一)——比特幣概念以及密碼學(xué)相關(guān)的知識的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!