Bitcoin

来自Jack's Lab
跳转到: 导航, 搜索

目录

1 wallet

1.1 Create

1.1.1 bitaddress.org

https://github.com/pointbiz/bitaddress.org

推荐使用 bitaddress.org 离线生成公钥私钥对 (钱包),选 'Paper Wallet',勾上 'BIP38 Encrypt',Passphrase 框内输入密码, 方便说明我们用 'mypasswd' 作为密码,这个要妥善保管,相当于你的取款密码:

Bitcoin-paper-wallet.png


Bitcoin Address 用来收钱,实际就是公钥,此处为:18SbZ9aCs1ARNcxrm5JQfNbK2t3KkBM6WZ

Private key 就是加密的私钥,用于花比特币。钱包并不存储余额,余额存储在全网节点上,索引地址就是 Bitcoin Address,转账交易就得需要私钥去签名确认。此处为 6PnWqY2ejimWXWgJPrwoZqKjWKo5VjmiQRY6eC2pzhDCj95MaYHSH8uFTZ


如要获取解密后的密钥,花比特币,可用如下 bx 命令 (bx 为 libbitcoin-explorer 的命令行工具) 解码,解密后的密钥切勿公开,否则就是公开您的取款密码:

$ bx ek-to-ec mypasswd 6PnWqY2ejimWXWgJPrwoZqKjWKo5VjmiQRY6eC2pzhDCj95MaYHSH8uFTZ
dcfd891ffaca487b5526de46a1074883c50cb247cd3b97aceb92a4ab65f66c6d

私钥可以算得唯一对应的公钥:

$ bx ec-to-public dcfd891ffaca487b5526de46a1074883c50cb247cd3b97aceb92a4ab65f66c6d
025cbe10eafeeb4aadb4bb81fbd49e7694885496280288601a5698f64c276686ba

公钥亦可编码成 Bitcoin Address:

$ bx ec-to-address 025cbe10eafeeb4aadb4bb81fbd49e7694885496280288601a5698f64c276686ba
18SbZ9aCs1ARNcxrm5JQfNbK2t3KkBM6WZ


亦或直接从加密的私钥算得 Bitcoin Address:

$ bx ek-to-address mypasswd 6PnWqY2ejimWXWgJPrwoZqKjWKo5VjmiQRY6eC2pzhDCj95MaYHSH8uFTZ
18SbZ9aCs1ARNcxrm5JQfNbK2t3KkBM6WZ


1.1.2 pycoin

comcat@xps15:/work/coin$ sudo pip install pycoin
comcat@xps15:/work/coin$ ku create
gpg: directory '/home/comcat/.gnupg' created
gpg: new configuration file '/home/comcat/.gnupg/dirmngr.conf' created
gpg: new configuration file '/home/comcat/.gnupg/gpg.conf' created
gpg: keybox '/home/comcat/.gnupg/pubring.kbx' created

input                        : create
network                      : Bitcoin mainnet
netcode                      : BTC
wallet key                   : xprv9s21ZrQH143K3eYnNZPGPTQxUXz4JUt6ynpeZpSosdw2bevCb3fYvpkxrGYa1K\
                                 iqwZhk4TCmignSa2LL4hmjd8LV9fMpBBXfnipJc8Fkeuw
public version               : xpub661MyMwAqRbcG8dFUavGkbMh2ZpYhwbxM1kFNCrRRyU1UTFM8ayoUd5ShXdnXH\
                                 BdxS2yjxam5kongm9mrF3v3X6oTqJ81cmC99aC3r2udxP
tree depth                   : 0
fingerprint                  : decb3057
parent f'print               : 00000000
child index                  : 0
chain code                   : 9fa72bb56cfe66f1f92a5636b83ec2306a2bf2cbc6d928ab23d504da7bfcf364
private key                  : yes
secret exponent              : 82902340507199256560026235348918883145729502157292179925434486035357787095677
 hex                         : b7490fd92828448238280bad6fce1059b59187771d53683728007c11d3d6027d
wif                          : L3MzbD841KgnsE67LffhhCnGmC9feauGjJaFS9o3CoNiQ5bJ7vjo
 uncompressed                : 5KD1MtgfHqe7KBDVAtoqBvRJcqkCUYhPbWMg4tPDHGVUxan8EML
public pair x                : 86445147116400495678746956661327120328051805207685816234033626146720138134070
public pair y                : 69896803574570377446502361864240867831009585041269668476112443813897322527316
 x as hex                    : bf1e3829cff40657962b9f4199544eb083ff67be3c5e794f269eac9ba9400236
 y as hex                    : 9a8830595266100812bd1caededcc140c2021060ee1564638bc9f664b18a7a54
y parity                     : even
key pair as sec              : 02bf1e3829cff40657962b9f4199544eb083ff67be3c5e794f269eac9ba9400236
 uncompressed                : 04bf1e3829cff40657962b9f4199544eb083ff67be3c5e794f269eac9ba9400236\
                                 9a8830595266100812bd1caededcc140c2021060ee1564638bc9f664b18a7a54
hash160                      : decb30575edcbd280cb739d03631c41d714b1a42
 uncompressed                : ba87314459722b1d9ad4cfd8479f393721bdc290
Bitcoin address              : 1MK2RPrMuzyQkJRNgh5VTJmFamg5BtM7SX
Bitcoin address uncompressed : 1J1Ge1xWz2UfLad8jdpeQWmmS2FvsehBpS
Bitcoin segwit address       : bc1qmm9nq467mj7jsr9h88grvvwyr4c5kxjzxjrc8z
p2sh segwit                  : 38hBYiNxsga98BBEGGiBF3XbwW6Dd4PwHd
 corresponding p2sh script   : 0014decb30575edcbd280cb739d03631c41d714b1a42



1.2 Query

购买或者挖到 bitcoin 后,查询钱包余额:

$ bx fetch-balance 18SbZ9aCs1ARNcxrm5JQfNbK2t3KkBM6WZ
balance
{
    address 18SbZ9aCs1ARNcxrm5JQfNbK2t3KkBM6WZ
    received 0
    spent 0
}

$ bx fetch-balance 1JziqzXeBPyHPeAHrG4DCDW4ASXeGGF6p6
balance
{
    address 1JziqzXeBPyHPeAHrG4DCDW4ASXeGGF6p6
    received 100000
    spent 100000
}

这个命令需要联到 bitcoin P2P 网查询,因此需要互联网连接



1.3 Spend

Refer to: https://github.com/libbitcoin/libbitcoin-explorer/wiki/How-to-Spend-Bitcoin



2 BTC



3 zcash



4 BCH



5 Exchange

coinbase, gdax, bitfinex, Bitstamp















个人工具
名字空间

变换
操作
导航
工具箱