Ethereumのアドレス生成アルゴリズム

 Ethereumのアドレス生成アルゴリズム

BlockChips #5 登壇資料
https://blockchips.connpass.com/event/72382/

Ethereumのアドレス生成アルゴリズム
https://qiita.com/ippo012/items/c64a2c4d873c0faf187c

D5b8a6f0d80d14bb5e24b95ed1afb56c?s=128

Ippo Matsui / Ginco

December 19, 2017
Tweet

Transcript

  1. BlockChips #5 2017/12/19 IPPO MATSUI &UIFSFVNͷ ΞυϨεੜ੒ΞϧΰϦζϜ

  2. ࣗݾ঺հ 2 BlockChips #3 2017/10/12 IPPO MATSUI

  3. BlockChips #3 2017/10/12 IPPO MATSUI 3 ࣗݾ঺հ দҪҰา #MPDLDIBJOJ04ΤϯδχΞ (Ippo

    Matsui) ɾ࠷ۙ͸΢ΥϨοτͷ։ൃΛ͍ͯ͠Δ ɾϒϩοΫνΣʔϯʹڵຯΛ࣋ͪ࢝Ίͯ ɹ̍೥͘Β͍ ɾલճ͸*05"ʹ͍ͭͯൃද͠·ͨ͠
  4. ࠓ೔͸&UIFSFVNͷΞυϨεΛ ੜ੒ͯ͠ΈΑ͏ͱࢥ͍·͢ 4 BlockChips #3 2017/10/12 IPPO MATSUI

  5. BlockChips #3 2017/10/12 IPPO MATSUI 5 ΞυϨεੜ੒ͷྲྀΕ ɾϥϯμϜͳൿີ伴ͷੜ੒ ɾൿີ伴͔Β&$%4"Λ༻͍ͯɺެ։伴ͷಋग़ ɾެ։伴ϋογϡͷޙΖόΠτΛൈ͖ग़͠ΞυϨεͱ͢Δ

    ɾެ։伴Λ,FDDBLʹ௨͠ެ։伴ϋογϡͷੜ੒
  6. ਤʹͯ͠Έ·͢ 6 BlockChips #3 2017/10/12 IPPO MATSUI

  7. BlockChips #3 2017/10/12 IPPO MATSUI 7 ϥϯμϜͳൿີ伴ͷੜ੒ ൿີ伴ɿόΠτ Y999999999999999999 ཚ਺ੜ੒ػ

    Yɿਐ਺දࣔ ஫ɿܻ਺͸ద౰Ͱ͢
  8. BlockChips #3 2017/10/12 IPPO MATSUI 8 ൿີ伴͔Β&$%4"Λ༻͍ͯɺެ։伴ͷಋग़ &$%4"ʢପԁۂઢ%4"ʣ ɾσδλϧॺ໊ͷͨΊͷެ։伴҉߸ٕज़ ɾ&UIFSFVN΍#JUDPJOͰ͸σδλϧॺ໊ͷଞʹɺ

    ɹ҉߸伴ͷੜ੒ʹ΋ར༻͞Ε͍ͯΔ TFDQL ɾପԁۂઢͷύϥϝʔλ
  9. BlockChips #3 2017/10/12 IPPO MATSUI 9 ൿີ伴͔Β&$%4"Λ༻͍ͯɺެ։伴ͷಋग़ ൿີ伴ɿόΠτ Y999999999999999999 ඇѹॖܗࣜͷެ։伴ɿόΠτ

    ϓϨϑΟοΫεόΠτ  Y99999999999999999999999999999999999999999999 &$%4" ύϥϝʔλɿTFDQL Yɿඇѹॖܗࣜͷެ։伴Λද͢ϓϨϑΟοΫε
  10. BlockChips #3 2017/10/12 IPPO MATSUI 10 ެ։伴Λ,FDDBLʹ௨͠ެ։伴ϋογϡͷੜ੒ ,FDDBL ɾ4)"ʹબఆ͞Ε͍ͯΔϋογϡؔ਺ΞϧΰϦζϜ ɾ&UIFSFVNͰ࢖ΘΕ͍ͯΔ΋ͷ͸ɺ4)"ඪ४ͱ

    ɹΞϧΰϦζϜ͕ҟͳΔ
  11. BlockChips #3 2017/10/12 IPPO MATSUI 11 ެ։伴Λ,FDDBLʹ௨͠ެ։伴ϋογϡͷੜ੒ ඇѹॖܗࣜͷެ։伴ɿόΠτ ϓϨϑΟοΫεόΠτ 

    Y99999999999999999999999999999999999999999999 ϋογϡؔ਺ɿ,FDDBL ެ։伴ϋογϡɿόΠτ Y9999999999999999999999
  12. BlockChips #3 2017/10/12 IPPO MATSUI 12 ެ։伴ϋογϡͷޙόΠτΛൈ͖ग़͢ ެ։伴ϋογϡલɿόΠτ Y999999999999 ެ։伴ϋογϡޙɿόΠτ

    Y99999999999999999999999999999 &UIFSFVNΞυϨεɿόΠτ Y99999999999999999999999999999
  13. 0QFO44-Ͱ࣮૷ͯ͠Έ·͢ 13 BlockChips #3 2017/10/12 IPPO MATSUI

  14. BlockChips #3 2017/10/12 IPPO MATSUI 14 ϥϯμϜͳൿີ伴ͷੜ੒ ൿີ伴ɿόΠτ Y999999999999999999 ཚ਺ੜ੒ػ

  15. BlockChips #3 2017/10/12 IPPO MATSUI 15 ϥϯμϜͳൿີ伴ͷੜ੒ ❯❯❯ openssl ecparam

    -name secp256k1 -genkey > privkey.pem ❯❯❯ cat privkey.pem -----BEGIN EC PARAMETERS----- BgUrgQQACg== -----END EC PARAMETERS----- -----BEGIN EC PRIVATE KEY----- MHQCAQEEIPcpcx7I4sgaM0+oadEvaGhx2M2ZuhbxWlqEzH9LHZN6oAcGBSuBBAAK oUQDQgAE9pSf3D/Zbvgo78JVwVK509nVyrrWI1oa9sx1UEox6hsvsLKjiJ3WO/Sb 9E97BhCcqz8j78zmxTnOosbT1OLZmA== -----END EC PRIVATE KEY-----
  16. BlockChips #3 2017/10/12 IPPO MATSUI 16 ൿີ伴͔Β&$%4"Λ༻͍ͯɺެ։伴ͷಋग़ ൿີ伴ɿόΠτ Y999999999999999999 ඇѹॖܗࣜͷެ։伴ɿόΠτ

    ϓϨϑΟοΫεόΠτ  Y99999999999999999999999999999999999999999999 &$%4" ύϥϝʔλɿTFDQL Yɿඇѹॖܗࣜͷެ։伴Λද͢ϓϨϑΟοΫε
  17. BlockChips #3 2017/10/12 IPPO MATSUI 17 ൿີ伴͔Β&$%4"Λ༻͍ͯɺެ։伴ͷಋग़ ❯❯❯ openssl ec

    < privkey.pem -text -noout > Key ❯❯❯ cat Key read EC key Private-Key: (256 bit) priv: 00:f7:29:73:1e:c8:e2:c8:1a:33:4f:a8:69:d1:2f: 68:68:71:d8:cd:99:ba:16:f1:5a:5a:84:cc:7f:4b: 1d:93:7a pub: 04:f6:94:9f:dc:3f:d9:6e:f8:28:ef:c2:55:c1:52: b9:d3:d9:d5:ca:ba:d6:23:5a:1a:f6:cc:75:50:4a: 31:ea:1b:2f:b0:b2:a3:88:9d:d6:3b:f4:9b:f4:4f: 7b:06:10:9c:ab:3f:23:ef:cc:e6:c5:39:ce:a2:c6: d3:d4:e2:d9:98 ASN1 OID: secp256k1
  18. BlockChips #3 2017/10/12 IPPO MATSUI 18 ެ։伴Λ,FDDBLʹ௨͠ެ։伴ϋογϡͷੜ੒ ඇѹॖܗࣜͷެ։伴ɿόΠτ ϓϨϑΟοΫεόΠτ 

    Y99999999999999999999999999999999999999999999 ϋογϡؔ਺ɿ,FDDBL ެ։伴ϋογϡɿόΠτ Y9999999999999999999999
  19. BlockChips #3 2017/10/12 IPPO MATSUI 19 ެ։伴Λ,FDDBLʹ௨͠ެ։伴ϋογϡͷੜ੒ ❯❯❯ cat Key

    | grep pub -A 5 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^04//' > pub ❯❯❯ cat pub f6949fdc3fd96ef828efc255c152b9d3d9d5cabad6235a1af6cc75504a31ea1b 2fb0b2a3889dd63bf49bf44f7b06109cab3f23efcce6c539cea2c6d3d4e2d998
  20. BlockChips #3 2017/10/12 IPPO MATSUI 20 ެ։伴Λ,FDDBLʹ௨͠ެ։伴ϋογϡͷੜ੒ ❯❯❯ cat pub

    | keccak-256sum -x -l | tr -d ' -' > pubHash ❯❯❯ cat pubHash e8814fc9d1265ca4cc1b111b8b5d4078bc122cb300e667b3cd64b1fd5d841240 https://github.com/maandree/sha3su maandree/sha3sum ,FDDBLͰ࢖ͬͨϥΠϒϥϦ
  21. BlockChips #3 2017/10/12 IPPO MATSUI 21 ެ։伴ϋογϡͷޙόΠτΛൈ͖ग़͢ ެ։伴ϋογϡલɿόΠτ Y999999999999 ެ։伴ϋογϡޙɿόΠτ

    Y99999999999999999999999999999 &UIFSFVNΞυϨεɿόΠτ Y99999999999999999999999999999
  22. BlockChips #3 2017/10/12 IPPO MATSUI 22 ެ։伴ϋογϡͷޙόΠτΛൈ͖ग़͢ ❯❯❯ cat pubHash

    e8814fc9d1265ca4cc1b111b8b5d4078bc122cb300e667b3cd64b1fd5d841240 ❯❯❯ cat pubHash | tail -c 41 8b5d4078bc122cb300e667b3cd64b1fd5d841240
  23. &UIFSFVNͷΞυϨε͕Ͱ͖·ͨ͠ʂ 0x8b5d4078bc122cb300e667b3cd64b1fd5d841240 23 BlockChips #3 2017/10/12 IPPO MATSUI ஫ɿαϯϓϧͰ͢

  24. BlockChips #3 2017/10/12 IPPO MATSUI 24 (FUIͰ֬ೝͯ͠ΈΔ ❯❯❯ cat Key

    | grep priv -A 3 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^00//' > priv ❯❯❯ cat priv f729731ec8e2c81a334fa869d12f686871d8cd99ba16f15a5a84cc7f4b1d937a ❯❯❯ geth account import priv Your new account is locked with a password. Please give a password. Do not forget this password. Passphrase: Repeat passphrase: Address: {8b5d4078bc122cb300e667b3cd64b1fd5d841240} ❯❯❯ cat pubHash | tail -c 41 8b5d4078bc122cb300e667b3cd64b1fd5d841240
  25. BlockChips #3 2017/10/12 IPPO MATSUI 25 ͓ΘΓʹ ɾ&UIFSFVNͷΞυϨεΛੜ੒͠·ͨ͠ ɾ&UIFSFVNʹ΋#JUDPJOͷΑ͏ʹ ɹΞυϨεΛΤϯίʔυ͢Δ࢓༷ʢ*$"1ʣ͕ଘࡏ͠·͢

    #JUDPJO %D$6RV"6US+R'369L/)FXBD(") &UIFSFVN JCBO9&08"$92(3'-$+%3(),:$0+