Python
Bitcoin

pybitcointoolsをインストールして使ってみた

使ってみた

pybitcointoolsをインストールして
bitcoin wikiのここの例と同じアドレスを導出できるか検証してみた。

~/git/pybitcointools$ python
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from bitcoin import *
>>> pub = privtopub('18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725')
>>> pub
'0450863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b23522cd470243453a299fa9e77237716103abc11a1df38855ed6f2ee187e9c582ba6'
>>> addr = pubtoaddr(pub)
>>> addr
'16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM'

インストール手順

簡単だった。

前提:python2.7がインストールされていること。

GitHubからソースの取得

$ git clone git@github.com:vbuterin/pybitcointools.git
Cloning into 'pybitcointools'...
Enter passphrase for key '/home/shin/.ssh/id_rsa':
remote: Counting objects: 1096, done.
remote: Total 1096 (delta 0), reused 0 (delta 0), pack-reused 1096
Receiving objects: 100% (1096/1096), 333.23 KiB | 321.00 KiB/s, done.
Resolving deltas: 100% (703/703), done.
Checking connectivity... done.

ビルド

~/git/pybitcointools$ python setup.py build
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/bitcoin
copying bitcoin/__init__.py -> build/lib.linux-x86_64-2.7/bitcoin
copying bitcoin/bci.py -> build/lib.linux-x86_64-2.7/bitcoin
copying bitcoin/blocks.py -> build/lib.linux-x86_64-2.7/bitcoin
copying bitcoin/composite.py -> build/lib.linux-x86_64-2.7/bitcoin
copying bitcoin/deterministic.py -> build/lib.linux-x86_64-2.7/bitcoin
copying bitcoin/main.py -> build/lib.linux-x86_64-2.7/bitcoin
copying bitcoin/mnemonic.py -> build/lib.linux-x86_64-2.7/bitcoin
copying bitcoin/py2specials.py -> build/lib.linux-x86_64-2.7/bitcoin
copying bitcoin/py3specials.py -> build/lib.linux-x86_64-2.7/bitcoin
copying bitcoin/ripemd.py -> build/lib.linux-x86_64-2.7/bitcoin
copying bitcoin/stealth.py -> build/lib.linux-x86_64-2.7/bitcoin
copying bitcoin/transaction.py -> build/lib.linux-x86_64-2.7/bitcoin
running egg_info
creating bitcoin.egg-info
writing bitcoin.egg-info/PKG-INFO
writing top-level names to bitcoin.egg-info/top_level.txt
writing dependency_links to bitcoin.egg-info/dependency_links.txt
writing manifest file 'bitcoin.egg-info/SOURCES.txt'
reading manifest file 'bitcoin.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'bitcoin.egg-info/SOURCES.txt'
copying bitcoin/english.txt -> build/lib.linux-x86_64-2.7/bitcoin
running build_scripts
creating build/scripts-2.7
copying and adjusting pybtctool -> build/scripts-2.7
changing mode of build/scripts-2.7/pybtctool from 666 to 777
~/git/pybitcointools$ sudo python setup.py install
[sudo] XXXX のパスワード:
running install
running bdist_egg
running egg_info
writing bitcoin.egg-info/PKG-INFO
writing top-level names to bitcoin.egg-info/top_level.txt
writing dependency_links to bitcoin.egg-info/dependency_links.txt
reading manifest file 'bitcoin.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'bitcoin.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/bitcoin
copying build/lib.linux-x86_64-2.7/bitcoin/__init__.py -> build/bdist.linux-x86_64/egg/bitcoin
copying build/lib.linux-x86_64-2.7/bitcoin/bci.py -> build/bdist.linux-x86_64/egg/bitcoin
copying build/lib.linux-x86_64-2.7/bitcoin/blocks.py -> build/bdist.linux-x86_64/egg/bitcoin
copying build/lib.linux-x86_64-2.7/bitcoin/composite.py -> build/bdist.linux-x86_64/egg/bitcoin
copying build/lib.linux-x86_64-2.7/bitcoin/deterministic.py -> build/bdist.linux-x86_64/egg/bitcoin
copying build/lib.linux-x86_64-2.7/bitcoin/english.txt -> build/bdist.linux-x86_64/egg/bitcoin
copying build/lib.linux-x86_64-2.7/bitcoin/main.py -> build/bdist.linux-x86_64/egg/bitcoin
copying build/lib.linux-x86_64-2.7/bitcoin/mnemonic.py -> build/bdist.linux-x86_64/egg/bitcoin
copying build/lib.linux-x86_64-2.7/bitcoin/py2specials.py -> build/bdist.linux-x86_64/egg/bitcoin
copying build/lib.linux-x86_64-2.7/bitcoin/py3specials.py -> build/bdist.linux-x86_64/egg/bitcoin
copying build/lib.linux-x86_64-2.7/bitcoin/ripemd.py -> build/bdist.linux-x86_64/egg/bitcoin
copying build/lib.linux-x86_64-2.7/bitcoin/stealth.py -> build/bdist.linux-x86_64/egg/bitcoin
copying build/lib.linux-x86_64-2.7/bitcoin/transaction.py -> build/bdist.linux-x86_64/egg/bitcoin
byte-compiling build/bdist.linux-x86_64/egg/bitcoin/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/bitcoin/bci.py to bci.pyc
byte-compiling build/bdist.linux-x86_64/egg/bitcoin/blocks.py to blocks.pyc
byte-compiling build/bdist.linux-x86_64/egg/bitcoin/composite.py to composite.pyc
byte-compiling build/bdist.linux-x86_64/egg/bitcoin/deterministic.py to deterministic.pyc
byte-compiling build/bdist.linux-x86_64/egg/bitcoin/main.py to main.pyc
byte-compiling build/bdist.linux-x86_64/egg/bitcoin/mnemonic.py to mnemonic.pyc
byte-compiling build/bdist.linux-x86_64/egg/bitcoin/py2specials.py to py2specials.pyc
byte-compiling build/bdist.linux-x86_64/egg/bitcoin/py3specials.py to py3specials.pyc
byte-compiling build/bdist.linux-x86_64/egg/bitcoin/ripemd.py to ripemd.pyc
byte-compiling build/bdist.linux-x86_64/egg/bitcoin/stealth.py to stealth.pyc
byte-compiling build/bdist.linux-x86_64/egg/bitcoin/transaction.py to transaction.pyc
installing package data to build/bdist.linux-x86_64/egg
running install_data
copying LICENSE -> build/bdist.linux-x86_64/egg/
creating build/bdist.linux-x86_64/egg/EGG-INFO
installing scripts to build/bdist.linux-x86_64/egg/EGG-INFO/scripts
running install_scripts
running build_scripts
creating build/bdist.linux-x86_64/egg/EGG-INFO/scripts
copying build/scripts-2.7/pybtctool -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts
changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/pybtctool to 777
copying bitcoin.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying bitcoin.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying bitcoin.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying bitcoin.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
bitcoin.mnemonic: module references __file__
creating dist
creating 'dist/bitcoin-1.1.42-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing bitcoin-1.1.42-py2.7.egg
creating /usr/local/lib/python2.7/dist-packages/bitcoin-1.1.42-py2.7.egg
Extracting bitcoin-1.1.42-py2.7.egg to /usr/local/lib/python2.7/dist-packages
Adding bitcoin 1.1.42 to easy-install.pth file
Installing pybtctool script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/bitcoin-1.1.42-py2.7.egg
Processing dependencies for bitcoin==1.1.42
Finished processing dependencies for bitcoin==1.1.42
shin@DESKTOP-Q6225PA:~/git/pybitcointools$ ls
LICENSE README.md bitcoin.egg-info dist setup.py test_stealth.py
MANIFEST.in bitcoin build pybtctool test.py