Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1169

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176
8000 GitHub - unaeat/blockchain
Nothing Special   »   [go: up one dir, main page]

Skip to content

unaeat/blockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Outline


Usage

  • Run node server
# build source code
cd cmd/node
go build

# run node grpc server (default port: 5566)
./node run -p ${PORT}
  • Run node client
# run node grpc client related cmd (default server: "127.0.0.1:5566")

# add tx (default from/to: random string)
./node addtx -h
./node addtx -s ${SERVER} -from ${FROM} -to ${TO} -v ${VALUE}


# list related status 
./node list -h
./node status -h

# more info
./node -h
  • (optional) Run node grpc gateway
# run node grpc gateway
cd cmd/node_gateway
go build
./node_gateway -grpc ${SERVER} -p ${PORT}

# add tx
curl --location --request POST 'http://localhost:7788/tx/add' \
--header 'Content-Type: application/json' \
--data-raw '{
        "from": "0x71a0DF94Dd9c9390Cf5e0BD87190F111cd55C325",
        "to": "0x0F86Cd82Ff4BA6FbB1655F44EA26b93d150E11E0",
        "value": 100
}'
# list balances
curl http://127.0.0.1:7788/balance/list
# list blocks
curl http://127.0.0.1:7788/block/list
# get node status
curl http://127.0.0.1:7788/node/status

Basic terms

  1. 什麼是公私鑰? 公鑰私鑰運作場景是什麼? 什麼是簽名?

    • 公鑰(Public key): 能被廣泛的發佈與流傳
    • 私鑰(Private key): 不公開, 被妥善保管
    • 運作場景:
      運作原理是傳送方與接收方在傳送之前,先把彼此的公鑰傳給對方,當傳送方要傳送時,就用接收方的公鑰將訊息加密,接收方收到加密訊息後,再用自己的密鑰解開,這樣即使有心人拿到公鑰,只要沒拿到接收方的私鑰,也還是無法解密訊息。
    • 數位簽章(Digital Signature):
      • 由來: 假設有人在網路上找到了接收方的公鑰,假造一封有病毒的訊息,再用接收方公鑰加密傳過去,這樣接收方一打開不就傻傻中計了嗎?!
      • 用途: Double Confirm了,也就是傳送方除了使用接收方的公鑰加密外,也使用自己的私鑰對該封加密訊息的Hash簽名
  2. 對稱式與非對稱式加密有何不同?

    • 對稱式加密- 傳送方與接收方的加解密皆使用一把密鑰
    • 非對稱式加密- 傳送方與接收方加解密用不同密鑰, 雙方皆存在一鑰匙 (公鑰+私鑰)
  3. 什麼是 Challenge-Response Authentication?

    • 其中一方提出問題,另一方必須提供有效答案才能進行身份驗證
  4. 什麼是多簽 (Multisignature)? 比特幣的多簽地址是什麼?

    • 多簽 Multisignature
      一種特定類型的數位簽章,而此類型的簽名將允許兩個以上用戶作為一組來簽署文檔。因此,多重簽名則通過多個單一簽名的組合來產生。

    • Creating a Multisignature Address with Bitcoin-Qt

      1. Gather (or generate) 3 bitcoin addresses (RPC cmd: getnewaddress or getaccountaddress)
      2. Get their public keys. (RPC cmd: validateaddress)
      3. Then create a 2-of-3 multisig address using addmultisigaddress; e.g.
      # addmultisigaddress returns the multisignature address. 
      > bitcoind addmultisigaddress 2 '["1st pubkey","2nd pubkey","3rd pubkey."]'
  5. 什麼是 Hash 函數? 有什麼特性? 什麼是 Proof of Work (PoW)?

    • Hash Function
      主要是將不定長度訊息的輸入,演算成固定長度雜湊值的輸出,且所計算出來的值必須符合兩個主要條件:
      • 由雜湊值是無法反推出原來的訊息
      • 雜湊值必須隨明文改變而改變
    • Proof of Work (PoW)
      一種對應服務與資源濫用、或是阻斷服務攻擊的經濟對策。一般是要求使用者進行一些耗時適當的複雜運算,並且答案能被服務方快速驗算,以此耗用的時間、裝置與能源做為擔保成本,以確保服務與資源是被真正的需求所使用

FAQ

  1. Compare the difference between account/UTXO based models.
Account UTXO (Unspent Transaction Output)
原理 保存了世界狀態,鏈的狀態一般在區塊中以 StateRoot 和 ReceiptRoot 等形式進行共識交易只是事件本身,不包含結果,交易的共識和狀態的共識本質上可以隔離的. 交易只是代表了 UTXO 集合的變更. 每個交易消耗之前交易生成的 UTXO 然後生成新的 UTXO, 帳戶的餘額即所有屬於該地址的未花費 UTXO 集合.
優點 * 擁有自身狀態
* 批量交易的成本較低
*交易無法被重放
* 無狀態的,更容易並發處理
缺點 * 交易之間沒有依賴性,需解決重放問題.
* 對於實現閃電網絡/雷電網絡,Plasma 等,用戶舉證需要更複雜的 Proof 證明機制,子鏈向主鏈進行狀態遷移需要更複雜的協議 (?!)
* 當 Input 較多時,見證腳本也會增多。而簽名本身是比較消耗 CPU 和存儲空間的
  1. How to ensure transaction order in an account based model?
    • Ethereum 使用了在 Account 中增加 nonce 的方式,每筆交易對應一個 nonce,nonce 每次遞增。這種方式雖然意在解決重放的問題,但是同時引入了順序性問題,同時使得交易無法並行。例如在 Ethereum中,用戶發送多筆交易,如果第一筆交易打包失敗,將引起後續多筆交易都打包不成功。
  2. What is transaction/block?
  3. Why is setting block generation time necessary?
  4. When to update the account balance?

Reference

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0