開発環境
- macOS Mojave - Apple (OS)
 - Emacs (Text Editor)
 - Windows 10 Pro (OS)
 - Visual Studio Code (Text Editor)
 - Python 3.7 (プログラミング言語)
 
Programming Bitcoin: Learn How to Program Bitcoin from Scratch (Jimmy Song(著)、O'Reilly Media)のChapter 4(Serialization)、Address Format、Exercises 5(84)の解答を求めてみる。
コード
Python 3
#!/usr/bin/env python3
from ecc import PrivateKey
secrets = [(5002, False, True),
           (2020**5, True, True),
           (0x12345deadbeef, True, False)]
for secret, compressed, testnet in secrets:
    private_key = PrivateKey(secret)
    point = private_key.point
    print(f'address: {point.address(compressed, testnet)}')
入出力結果(cmd(コマンドプロンプト)、Terminal、Jupyter(IPython))
C:\Users\...>py sample5.py address: mmTPbXQFxboEtNRkwfh6K51jvdtHLxGeMA address: mopVkxp8UhXqRYbCYJsbeE1h1fiF64jcoH address: 1F1Pn2y6pDb68E5nYJJeba4TLg2U7B6KF1 C:\Users\...>
0 コメント:
コメントを投稿