[C#] 理解以太坊 HD 錢包生成:解密 BIP39 規範與單字驗證,無效助憶詞

2024-01-16

最近在搞事情,然後遇到一個之前我沒有發現的問題,以前在產生錢包的時候,我以為只要符合 BIP39 規範任選 12 or 24 單字就可以了

事實上,如果當你要把這隨便亂取的 12 的單字放入 MetaMask 或是其他 Web3 錢包的時候,就會出現

因為我之前測試都是使用 cat 重複 12 次,後來研究 一下才知道,原來最後一個單字是一個 驗證的動作,所以沒有過的原因是因為最後一個字不對

最後一個字,會取決於你前面11個字,所以不是每個字都是可以用的,如果你是用 12 個單字的助記詞,則最後一個單字應該會有 128 個可能

其實在程式上面是沒有阻擋你最後一個單字,但是現在 MetaMask 還有 其他 Web3 或是硬體錢包都有阻擋,所以你還是得按照規則來

今天就延續這一篇 Ethereum 以太坊產生高清錢包 (HD Wallet) 繼續寫 


1. 安裝 Nethereum.HdWallet

2. 因為其實可以不用去理解它的原理直接用列舉法把所有的  wordlist 撈出來 加入比對即可


Result:

cat cat cat cat cat cat cat cat cat cat cat abstract ,True

cat cat cat cat cat cat cat cat cat cat cat acquire ,True

cat cat cat cat cat cat cat cat cat cat cat affair ,True

cat cat cat cat cat cat cat cat cat cat cat alter ,True

cat cat cat cat cat cat cat cat cat cat cat amused ,True

cat cat cat cat cat cat cat cat cat cat cat apple ,True

cat cat cat cat cat cat cat cat cat cat cat arrow ,True

cat cat cat cat cat cat cat cat cat cat cat audit ,True

cat cat cat cat cat cat cat cat cat cat cat bachelor ,True

cat cat cat cat cat cat cat cat cat cat cat because ,True

cat cat cat cat cat cat cat cat cat cat cat beyond ,True

cat cat cat cat cat cat cat cat cat cat cat blind ,True

cat cat cat cat cat cat cat cat cat cat cat blush ,True

cat cat cat cat cat cat cat cat cat cat cat brief ,True

cat cat cat cat cat cat cat cat cat cat cat brown ,True

cat cat cat cat cat cat cat cat cat cat cat cabbage ,True

cat cat cat cat cat cat cat cat cat cat cat camera ,True

cat cat cat cat cat cat cat cat cat cat cat carry ,True

cat cat cat cat cat cat cat cat cat cat cat cave ,True

cat cat cat cat cat cat cat cat cat cat cat chapter ,True

cat cat cat cat cat cat cat cat cat cat cat citizen ,True

cat cat cat cat cat cat cat cat cat cat cat clog ,True

cat cat cat cat cat cat cat cat cat cat cat coffee ,True

cat cat cat cat cat cat cat cat cat cat cat congress ,True

cat cat cat cat cat cat cat cat cat cat cat coyote ,True

cat cat cat cat cat cat cat cat cat cat cat crane ,True

cat cat cat cat cat cat cat cat cat cat cat crystal ,True

cat cat cat cat cat cat cat cat cat cat cat daring ,True

cat cat cat cat cat cat cat cat cat cat cat december ,True

cat cat cat cat cat cat cat cat cat cat cat demise ,True

cat cat cat cat cat cat cat cat cat cat cat devote ,True

cat cat cat cat cat cat cat cat cat cat cat dignity ,True

cat cat cat cat cat cat cat cat cat cat cat divorce ,True

cat cat cat cat cat cat cat cat cat cat cat drill ,True

cat cat cat cat cat cat cat cat cat cat cat easily ,True

cat cat cat cat cat cat cat cat cat cat cat eight ,True

cat cat cat cat cat cat cat cat cat cat cat else ,True

cat cat cat cat cat cat cat cat cat cat cat envelope ,True

cat cat cat cat cat cat cat cat cat cat cat essay ,True

cat cat cat cat cat cat cat cat cat cat cat evolve ,True

cat cat cat cat cat cat cat cat cat cat cat expect ,True

cat cat cat cat cat cat cat cat cat cat cat father ,True

cat cat cat cat cat cat cat cat cat cat cat fence ,True

cat cat cat cat cat cat cat cat cat cat cat fit ,True

cat cat cat cat cat cat cat cat cat cat cat flat ,True

cat cat cat cat cat cat cat cat cat cat cat fortune ,True

cat cat cat cat cat cat cat cat cat cat cat frequent ,True

cat cat cat cat cat cat cat cat cat cat cat game ,True

cat cat cat cat cat cat cat cat cat cat cat genre ,True

cat cat cat cat cat cat cat cat cat cat cat glance ,True

cat cat cat cat cat cat cat cat cat cat cat gospel ,True

cat cat cat cat cat cat cat cat cat cat cat grit ,True

cat cat cat cat cat cat cat cat cat cat cat harvest ,True

cat cat cat cat cat cat cat cat cat cat cat health ,True

cat cat cat cat cat cat cat cat cat cat cat hole ,True

cat cat cat cat cat cat cat cat cat cat cat hunt ,True

cat cat cat cat cat cat cat cat cat cat cat ice ,True

cat cat cat cat cat cat cat cat cat cat cat income ,True

cat cat cat cat cat cat cat cat cat cat cat into ,True

cat cat cat cat cat cat cat cat cat cat cat jewel ,True

cat cat cat cat cat cat cat cat cat cat cat kangaroo ,True

cat cat cat cat cat cat cat cat cat cat cat kit ,True

cat cat cat cat cat cat cat cat cat cat cat ladder ,True

cat cat cat cat cat cat cat cat cat cat cat leader ,True

cat cat cat cat cat cat cat cat cat cat cat like ,True

cat cat cat cat cat cat cat cat cat cat cat live ,True

cat cat cat cat cat cat cat cat cat cat cat lunch ,True

cat cat cat cat cat cat cat cat cat cat cat mammal ,True

cat cat cat cat cat cat cat cat cat cat cat mass ,True

cat cat cat cat cat cat cat cat cat cat cat media ,True

cat cat cat cat cat cat cat cat cat cat cat midnight ,True

cat cat cat cat cat cat cat cat cat cat cat mixture ,True

cat cat cat cat cat cat cat cat cat cat cat mountain ,True

cat cat cat cat cat cat cat cat cat cat cat near ,True

cat cat cat cat cat cat cat cat cat cat cat nest ,True

cat cat cat cat cat cat cat cat cat cat cat nut ,True

cat cat cat cat cat cat cat cat cat cat cat october ,True

cat cat cat cat cat cat cat cat cat cat cat onion ,True

cat cat cat cat cat cat cat cat cat cat cat over ,True

cat cat cat cat cat cat cat cat cat cat cat ozone ,True

cat cat cat cat cat cat cat cat cat cat cat pass ,True

cat cat cat cat cat cat cat cat cat cat cat pen ,True

cat cat cat cat cat cat cat cat cat cat cat pioneer ,True

cat cat cat cat cat cat cat cat cat cat cat polar ,True

cat cat cat cat cat cat cat cat cat cat cat popular ,True

cat cat cat cat cat cat cat cat cat cat cat pride ,True

cat cat cat cat cat cat cat cat cat cat cat proof ,True

cat cat cat cat cat cat cat cat cat cat cat pyramid ,True

cat cat cat cat cat cat cat cat cat cat cat rally ,True

cat cat cat cat cat cat cat cat cat cat cat rebuild ,True

cat cat cat cat cat cat cat cat cat cat cat reflect ,True

cat cat cat cat cat cat cat cat cat cat cat require ,True

cat cat cat cat cat cat cat cat cat cat cat rigid ,True

cat cat cat cat cat cat cat cat cat cat cat robust ,True

cat cat cat cat cat cat cat cat cat cat cat rubber ,True

cat cat cat cat cat cat cat cat cat cat cat sand ,True

cat cat cat cat cat cat cat cat cat cat cat scheme ,True

cat cat cat cat cat cat cat cat cat cat cat section ,True

cat cat cat cat cat cat cat cat cat cat cat shell ,True

cat cat cat cat cat cat cat cat cat cat cat shrug ,True

cat cat cat cat cat cat cat cat cat cat cat similar ,True

cat cat cat cat cat cat cat cat cat cat cat slide ,True

cat cat cat cat cat cat cat cat cat cat cat slush ,True

cat cat cat cat cat cat cat cat cat cat cat soda ,True

cat cat cat cat cat cat cat cat cat cat cat special ,True

cat cat cat cat cat cat cat cat cat cat cat spoon ,True

cat cat cat cat cat cat cat cat cat cat cat stereo ,True

cat cat cat cat cat cat cat cat cat cat cat strong ,True

cat cat cat cat cat cat cat cat cat cat cat sunset ,True

cat cat cat cat cat cat cat cat cat cat cat swim ,True

cat cat cat cat cat cat cat cat cat cat cat talent ,True

cat cat cat cat cat cat cat cat cat cat cat tattoo ,True

cat cat cat cat cat cat cat cat cat cat cat this ,True

cat cat cat cat cat cat cat cat cat cat cat toddler ,True

cat cat cat cat cat cat cat cat cat cat cat tourist ,True

cat cat cat cat cat cat cat cat cat cat cat train ,True

cat cat cat cat cat cat cat cat cat cat cat trophy ,True

cat cat cat cat cat cat cat cat cat cat cat twin ,True

cat cat cat cat cat cat cat cat cat cat cat unaware ,True

cat cat cat cat cat cat cat cat cat cat cat unusual ,True

cat cat cat cat cat cat cat cat cat cat cat utility ,True

cat cat cat cat cat cat cat cat cat cat cat viable ,True

cat cat cat cat cat cat cat cat cat cat cat visual ,True

cat cat cat cat cat cat cat cat cat cat cat walnut ,True

cat cat cat cat cat cat cat cat cat cat cat weasel ,True

cat cat cat cat cat cat cat cat cat cat cat width ,True

cat cat cat cat cat cat cat cat cat cat cat witness ,True

cat cat cat cat cat cat cat cat cat cat cat yard ,True

Total:128


參考資料:

https://www.blockplate.com/blogs/blockplate/the-special-last-word-of-a-seed-phrase

https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt



當麻許的超技八 2014 | Donma Hsu Design.