Upgrade to Pro — share decks privately, control downloads, hide ads and more …

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

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

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

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

More Decks by Ippo Matsui / 令和トラベル

Other Decks in Programming

Transcript

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

    Matsui) ɾ࠷ۙ͸΢ΥϨοτͷ։ൃΛ͍ͯ͠Δ ɾϒϩοΫνΣʔϯʹڵຯΛ࣋ͪ࢝Ίͯ ɹ̍೥͘Β͍ ɾલճ͸*05"ʹ͍ͭͯൃද͠·ͨ͠
  2. BlockChips #3 2017/10/12 IPPO MATSUI 9 ൿີ伴͔Β&$%4"Λ༻͍ͯɺެ։伴ͷಋग़ ൿີ伴ɿόΠτ Y999999999999999999 ඇѹॖܗࣜͷެ։伴ɿόΠτ

    ϓϨϑΟοΫεόΠτ  Y99999999999999999999999999999999999999999999 &$%4" ύϥϝʔλɿTFDQL Yɿඇѹॖܗࣜͷެ։伴Λද͢ϓϨϑΟοΫε
  3. BlockChips #3 2017/10/12 IPPO MATSUI 11 ެ։伴Λ,FDDBLʹ௨͠ެ։伴ϋογϡͷੜ੒ ඇѹॖܗࣜͷެ։伴ɿόΠτ ϓϨϑΟοΫεόΠτ 

    Y99999999999999999999999999999999999999999999 ϋογϡؔ਺ɿ,FDDBL ެ։伴ϋογϡɿόΠτ Y9999999999999999999999
  4. 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-----
  5. BlockChips #3 2017/10/12 IPPO MATSUI 16 ൿີ伴͔Β&$%4"Λ༻͍ͯɺެ։伴ͷಋग़ ൿີ伴ɿόΠτ Y999999999999999999 ඇѹॖܗࣜͷެ։伴ɿόΠτ

    ϓϨϑΟοΫεόΠτ  Y99999999999999999999999999999999999999999999 &$%4" ύϥϝʔλɿTFDQL Yɿඇѹॖܗࣜͷެ։伴Λද͢ϓϨϑΟοΫε
  6. 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
  7. BlockChips #3 2017/10/12 IPPO MATSUI 18 ެ։伴Λ,FDDBLʹ௨͠ެ։伴ϋογϡͷੜ੒ ඇѹॖܗࣜͷެ։伴ɿόΠτ ϓϨϑΟοΫεόΠτ 

    Y99999999999999999999999999999999999999999999 ϋογϡؔ਺ɿ,FDDBL ެ։伴ϋογϡɿόΠτ Y9999999999999999999999
  8. 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
  9. 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Ͱ࢖ͬͨϥΠϒϥϦ
  10. BlockChips #3 2017/10/12 IPPO MATSUI 22 ެ։伴ϋογϡͷޙόΠτΛൈ͖ग़͢ ❯❯❯ cat pubHash

    e8814fc9d1265ca4cc1b111b8b5d4078bc122cb300e667b3cd64b1fd5d841240 ❯❯❯ cat pubHash | tail -c 41 8b5d4078bc122cb300e667b3cd64b1fd5d841240
  11. 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