使用私钥对交易进行签名处理,并且发送交易。
前期准备,向指定的账户地址 转入适当的测试代币 1BTC
mg1ZAJirgGotuBhoFVjnpJhYtQTvmxFJRn
Status: 0/unconfirmed, in memory pool
Date: 2019/8/15 09:54
To: 08-15-001 mg1ZAJirgGotuBhoFVjnpJhYtQTvmxFJRn
Debit: -1.00000000 BTC
Transaction fee: -0.00003360 BTC
Net amount: -1.00003360 BTC
Transaction ID: bd5b0f4bbdb477b1f73c18256114c7fcf80a07f85f25739c3f72a5d7e66c6420
Transaction total size: 249 bytes
Transaction virtual size: 168 bytes
Output index: 0
执行generate 6
转账:向mjFV5huR6ArRzzMP7ZPMYsEL5pQ54ULxKQ转账0.8 BTC
修改对应参数,并执行方法;
日志
Address from private key is: mg1ZAJirgGotuBhoFVjnpJhYtQTvmxFJRn
Aug 15, 2019 9:59:18 AM org.bitcoinj.core.Context getOrCreate
WARNING: Implicitly creating context. This is a migration step and this message will eventually go away.
Aug 15, 2019 9:59:18 AM org.bitcoinj.core.Context <init>
INFO: Creating bitcoinj 0.16-SNAPSHOT context.
Aug 15, 2019 9:59:18 AM org.bitcoinj.crypto.MnemonicCode toSeed
INFO: PBKDF2 took 231.7 ms
Aug 15, 2019 9:59:19 AM org.bitcoinj.core.AbstractBlockChain <init>
INFO: chain head is at height 0:
block:
hash: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
version: 1
previous block: 0000000000000000000000000000000000000000000000000000000000000000
time: 1296688602 (2011-02-02T23:16:42Z)
difficulty target (nBits): 545259519
nonce: 2
Aug 15, 2019 9:59:19 AM org.bitcoinj.core.PeerGroup6 go
INFO: Localhost peer detected, trying to use it instead of P2P discovery
Aug 15, 2019 9:59:19 AM org.bitcoinj.core.PeerGroup connectTo
INFO: Attempting connection to [127.0.0.1]:18444 (0 connected, 1 pending, 0 max)
Aug 15, 2019 9:59:19 AM org.bitcoinj.net.NioClientManager handleKey
INFO: Connected to localhost/127.0.0.1:18444
Aug 15, 2019 9:59:19 AM org.bitcoinj.core.Peer connectionOpened
INFO: Announcing to localhost/127.0.0.1:18444 as: /bitcoinj:0.16-SNAPSHOT/
Aug 15, 2019 9:59:19 AM org.bitcoinj.core.Peer processVersionMessage
INFO: Peer{[127.0.0.1]:18444, version=70015, subVer=/Satoshi:0.17.1/, services=1037 (NETWORK, BLOOM, WITNESS, NETWORK_LIMITED), time=2019-08-15 09:59:19, height=613}
Aug 15, 2019 9:59:19 AM org.bitcoinj.core.PeerGroup handleNewPeer
INFO: Peer{[127.0.0.1]:18444, version=70015, subVer=/Satoshi:0.17.1/, services=1037 (NETWORK, BLOOM, WITNESS, NETWORK_LIMITED), time=2019-08-15 09:59:19, height=613}: New peer (1 connected, 0 pending, 1 max)
Aug 15, 2019 9:59:19 AM org.bitcoinj.core.PeerGroup setDownloadPeer
INFO: Setting download peer: Peer{[127.0.0.1]:18444, version=70015, subVer=/Satoshi:0.17.1/, services=1037 (NETWORK, BLOOM, WITNESS, NETWORK_LIMITED), time=2019-08-15 09:59:19, height=613}
Aug 15, 2019 9:59:19 AM org.bitcoinj.core.listeners.DownloadProgressTracker startDownload
INFO: Downloading block chain of size 613.
INFO: Received tx for 1.00 BTC: bd5b0f4bbdb477b1f73c18256114c7fcf80a07f85f25739c3f72a5d7e66c6420 [1] in block 71afe4afe3e28ad2e23e0005d864fee90a0097f1513b416f579a732c62f0525a
Aug 15, 2019 9:59:19 AM org.bitcoinj.wallet.Wallet processTxFromBestChain
INFO: tx bd5b0f4bbdb477b1f73c18256114c7fcf80a07f85f25739c3f72a5d7e66c6420 ->unspent
Aug 15, 2019 9:59:19 AM org.bitcoinj.wallet.Wallet receive
INFO: Balance is now: 1.00 BTC
Aug 15, 2019 9:59:19 AM org.bitcoinj.core.AbstractBlockChain tryConnectingOrphans
INFO: Connected orphan 4f5e03f4517e066c48bf31dd993688978f16a5ad698e87aa6f1227b487ee2d11
Aug 15, 2019 9:59:19 AM org.bitcoinj.core.AbstractBlockChain tryConnectingOrphans
INFO: Connected 1 orphan blocks.
Aug 15, 2019 9:59:19 AM org.bitcoinj.core.listeners.DownloadProgressTracker progress
INFO: Chain download 100% done with 0 blocks to go, block date 2019-08-15T01:58:51Z
Claiming 1.00 BTC
Aug 15, 2019 9:59:19 AM org.bitcoinj.wallet.Wallet completeTx
INFO: Completing send tx with 1 outputs totalling 0.80 BTC and a fee of 0.001 BTC/vkB
Aug 15, 2019 9:59:19 AM org.bitcoinj.wallet.DeterministicKeyChain maybeLookAhead
INFO: 1 keys needed for M/0H/1 = 1 issued + 0 lookahead size + 0 lookahead threshold - 0 num children
Aug 15, 2019 9:59:19 AM org.bitcoinj.wallet.DeterministicKeyChain maybeLookAhead
INFO: Took 1.218 ms
Aug 15, 2019 9:59:19 AM org.bitcoinj.wallet.Wallet completeTx
INFO: with 0.199773 BTC change
Aug 15, 2019 9:59:19 AM org.bitcoinj.wallet.Wallet completeTx
INFO: completed: Transaction{86c0d3110fb15fb0518286f3d5daf6e03b655692bdc58e614372b9e7c2dffa1a
weight: 900 wu, 225 bytes
purpose: USER_PAYMENT
in PUSHDATA(71)[30440220407e159b585289908e9315bd3a4a49751874c73277a89f609ddb265029e360b002203885600407306dcfa2610b18109183f185988449de6443fd44ad2820b137365701] PUSHDATA(33)[02abc6ecceae5a6487a38551d69aed5b631229d7919ea5442df8ec0949115987bf] 1.00 BTC
P2PKH addr:mg1ZAJirgGotuBhoFVjnpJhYtQTvmxFJRn outpoint:bd5b0f4bbdb477b1f73c18256114c7fcf80a07f85f25739c3f72a5d7e66c6420:0
out DUP HASH160 PUSHDATA(20)[5b76039c649c75b878fae8c7cc97a9a500760454] EQUALVERIFY CHECKSIG 0.199773 BTC
P2PKH addr:morZAGsDS6cDb5KbYFvm87noXMghvgoSkx
out DUP HASH160 PUSHDATA(20)[28f38c2ab536ad0e4e5d2602297d8d73633f78cc] EQUALVERIFY CHECKSIG 0.80 BTC
P2PKH addr:mjFV5huR6ArRzzMP7ZPMYsEL5pQ54ULxKQ
fee 0.00025222 BTC/wu, 0.00100888 BTC/kB 0.000227 BTC
}
INFO: Stopping ...
Aug 15, 2019 9:59:24 AM org.bitcoinj.core.PeerGroup setDownloadPeer
INFO: Unsetting download peer: Peer{[127.0.0.1]:18444, version=70015, subVer=/Satoshi:0.17.1/, services=1037 (NETWORK, BLOOM, WITNESS, NETWORK_LIMITED), time=2019-08-15 09:59:19, height=613}