pycoin -- Python Cryptocoin Utilities
=====================================
This is an implementation of a bunch of utility routines that may be useful when dealing with bitcoin and some
alt-coins. It has been tested with Python 2.7, 3.3 and 3.4.
High Level
==========
Keys & BIP32
------------
The class pycoin.key.Key contains a convenience Key class that will parse the base58 representation of a BIP 32
wallet [BIP0032] or a WIF or a bitcoin (or altcoin) address, and convert downwards.
WARNING: be extremely careful giving out public wallet keys. If someone has access to a private wallet key P, of
course they have access to all descendent wallet keys of P. But if they also have access to a public wallet key K
where P is a subkey of P, you can actually work your way up the tree to determine the private key that corresponds
to the public wallet key K (unless private derivation was used at some point between the two keys)! Be sure you
understand this warning before giving out public wallet keys!
pycoin.key.Key:
```Key(hierarchical_wallet=None, secret_exponent=None,
public_pair=None, hash160=None, prefer_uncompressed=None, is_compressed=True, netcode)```
Specify one of "hierarchical_wallet, secret_exponent, public_pair or hash160" to create a ```Key```.
Or
```Key.from_text(b58_text)``` accepts an address (bitcoin or other), a WIF, or a BIP32 wallet string and yield a Key.
```Key.from_sec(sec)``` creates a Key from the SEC bytestream encoding of a public pair.
pycoin.bip32.Wallet (formerly pycoin.wallet.Wallet) provides a BIP32 hierarchical wallet.
Much of this API is exposed in the ```ku``` command-line utility. See also COMMAND-LINE-TOOLS.md.
See ```BIP32.txt``` for more information.
Transactions
------------
pycoin.tx.Tx is a class that wraps a bitcoin transaction. You can create, edit, sign, or validate a transaction using
methods in this class.
You can also use ```pycoin.tx.tx_utils``` which has ```create_tx``` and ```create_signed_tx```, which gives you a
very easy way to create signed transactions.
The command-line utility ```tx``` is a Swiss Army knife of transaction utilities. See also COMMAND-LINE-TOOLS.md.
Services
--------
When signing or verifying signatures on a transaction, the source transactions are generally needed. If you set two
environment variables in your ```.profile``` like this:
PYCOIN_CACHE_DIR=~/.pycoin_cache
PYCOIN_SERVICE_PROVIDERS=BLOCKR_IO:BITEASY:BLOCKCHAIN_INFO:BLOCKEXPLORER
export PYCOIN_CACHE_DIR PYCOIN_SERVICE_PROVIDERS
and then ```tx``` will automatically fetch transactions from the web sites listed and cache the results in
```PYCOIN_CACHE_DIR``` when they are needed.
The module pycoin.services includes two functions ```spendables_for_address```, ```get_tx_db``` that look at the
environment variables set to determine which web sites to use to fetch the underlying information. The sites are
polled in the order they are listed in the environment variable.
Blocks
------
The command-line utility ```block``` will dump a block in a human-readable format. For further information, look at
```pycoin.block```, which includes the object ```Block``` which will parse and stream the binary format of a block.
Low Level
=========
ECDSA Signing and Verification
------------------------------
The module ```pycoin.ecdsa``` deals with ECDSA keys directly. Important structures include:
- the ```secret_exponent``` (a large integer that represents a private key)
- the ```public_pair``` (a pair of large integers x and y that represent a public key)
There are a handful of functions: you can do things like create a signature, verify a signature, generate the public
pair from the secret exponent, and flush out the public pair from just the x value (there are two possible values
for y of opposite even/odd parity, so you include a flag indicating which value for y you want).
Encoding
--------
The ```pycoin.encoding``` module declares some conversion utilities useful when dealing with Bitcoin. Important
structures include:
* base58 (the encoding used for Bitcoin addresses)
* hashed base58 (with a standard checksum)
* Bitcoin hashes (double sha256, ripemd160/sha256, known as "hash160")
* Bitcoin addresses
* WIF (Wallet import format)
* SEC (the gross internal format of public keys used by OpenSSL), both compressed and uncompressed
Users
-----
Here's a partial list of users of pycoin:
ChangeTip https://changetip.com/
CoinSafe https://coinsafe.com/
GreenAddress https://greenaddress.it/
Coinkite https://coinkite.com/
Email me at him@richardkiss.com to be added to this list.
Donate
------
Want to donate? Feel free. Send to 1KissFDVu2wAYWPRm4UGh5ZCDU9sE9an8T.
I'm also available for bitcoin consulting... him@richardkiss.com.
[BIP0032]: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
共66个文件
py:52个
txt:5个
md:2个
资源分类:Python库 所属语言:Python 资源全名:pycoin-0.41.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
收起资源包目录
pycoin-0.41.tar.gz (66个子文件)
pycoin-0.41
MANIFEST.in 43B
PKG-INFO 620B
CREDITS 479B
LICENSE 1KB
CHANGES 3KB
setup.cfg 59B
pycoin
key
Key.py 9KB
validate.py 3KB
bip32.py 14KB
__init__.py 22B
merkle.py 3KB
networks.py 2KB
tx
TxOut.py 3KB
tx_utils.py 8KB
__init__.py 1KB
Tx.py 15KB
script
tools.py 5KB
microcode.py 12KB
__init__.py 36B
der.py 4KB
vm.py 6KB
opcodes.py 4KB
solvers.py 5KB
TxIn.py 3KB
Spendable.py 2KB
convention
tx_fee.py 564B
__init__.py 656B
encoding.py 11KB
__init__.py 0B
serialize
bitcoin_streamer.py 2KB
__init__.py 563B
streamer.py 2KB
block.py 6KB
services
blockr_io.py 1KB
biteasy.py 1KB
blockexplorer.py 1KB
blockchain_info.py 2KB
providers.py 3KB
__init__.py 57B
env.py 469B
tx_db.py 2KB
bitcoind.py 952B
scripts
spend.py 8KB
fetch_unspent.py 731B
genwallet.py 6KB
tx.py 18KB
__init__.py 0B
block.py 1KB
bitcoin_utils.py 5KB
cache_tx.py 1KB
ku.py 10KB
ecdsa
intbytes.py 1KB
numbertheory.py 3KB
__init__.py 231B
ecdsa.py 6KB
secp256k1.py 571B
ellipticcurve.py 8KB
pycoin.egg-info
PKG-INFO 620B
SOURCES.txt 1KB
entry_points.txt 314B
top_level.txt 7B
dependency_links.txt 1B
setup.py 1KB
README.md 5KB
COMMAND-LINE-TOOLS.md 30KB
pip-req.txt 0B
共 66 条
- 1
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功