Last active
June 3, 2018 06:10
-
-
Save planethouki/ca0dc7d3d427fdecbb11cde9a33b982c to your computer and use it in GitHub Desktop.
Bitcoinトランザクション作成手順 秘密の値でロックするP2SH ref: https://qiita.com/planethouki/items/6d8db3d880e8b2c21db6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OP_SHA256 <SecretHash> OP_EQUAL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<root> | |
└─bitcoin-0.15.1 | |
├─bin | |
├─data | |
│ └─regtest | |
│ ├─blocks | |
│ │ └─index | |
│ ├─chainstate | |
│ └─database | |
├─include | |
├─lib | |
└─share | |
└─man | |
└─man1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bx-windows-x64-icu.exe bitcoin160 a8209335595211f33e762838007a614887a518fd7bf8434654e1bfe12a7eba6a27f887 | |
aada77d31171bf21f262ea066ed7bc8b0f3aa734 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bx-windows-x64-icu.exe base58check-encode -v 196 aada77d31171bf21f262ea066ed7bc8b0f3aa734 | |
2N8pcaKeeCwHq1F6DQc3XTAueAjPjhPMu74 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bitcoin-cli sendtoaddress 2N8pcaKeeCwHq1F6DQc3XTAueAjPjhPMu74 1 | |
3be9910eb7b38fa494cd4937d517c6246a7f106e6f791f3a20993f9bc3123aab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bitcoin-cli generate 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bitcoin-cli gettransaction 3be9910eb7b38fa494cd4937d517c6246a7f106e6f791f3a20993f9bc3123aab | |
{ | |
"amount": -1.00000000, | |
"fee": -0.00004480, | |
"confirmations": 1, | |
"blockhash": "3dd604840ade8e56ca9c6f7f3ae233f7079a0a08dfee93cc57a1cd90d9ae4818", | |
"blockindex": 1, | |
"blocktime": 1527920143, | |
"txid": "3be9910eb7b38fa494cd4937d517c6246a7f106e6f791f3a20993f9bc3123aab", | |
"walletconflicts": [ | |
], | |
"time": 1527920133, | |
"timereceived": 1527920133, | |
"bip125-replaceable": "no", | |
"details": [ | |
{ | |
"account": "", | |
"address": "2N8pcaKeeCwHq1F6DQc3XTAueAjPjhPMu74", | |
"category": "send", | |
"amount": -1.00000000, | |
"vout": 1, | |
"fee": -0.00004480, | |
"abandoned": false | |
} | |
], | |
"hex": "0200000001e8b328e217914c76fcdaf2f92ad2899225d432c9be2d62d74f0dccdac4b493db000000006b48304502210087c63ba58e46c23a6a9ecfe29d77624abd5c55728606ebd3743be9273e4e2dc902205bcbc0fac0ab1727dc9e5baf10b68b8e99c74c2ac38efdb3724171aeb482f667012102f3b361c78b4a8b7aaeac77bbb1dcad4de6671a8b630a74d2e50348400d07dabafeffffff02a80f1a1e010000001976a9149c34642af476cc95780f6073cd6afd33bb85c9dd88ac00e1f5050000000017a914aada77d31171bf21f262ea066ed7bc8b0f3aa7348766000000" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bitcoin-cli decoderawtransaction 0200000001e8b328e217914c76fcdaf2f92ad2899225d432c9be2d62d74f0dccdac4b493db000000006b48304502210087c63ba58e46c23a6a9ecfe29d77624abd5c55728606ebd3743be9273e4e2dc902205bcbc0fac0ab1727dc9e5baf10b68b8e99c74c2ac38efdb3724171aeb482f667012102f3b361c78b4a8b7aaeac77bbb1dcad4de6671a8b630a74d2e50348400d07dabafeffffff02a80f1a1e010000001976a9149c34642af476cc95780f6073cd6afd33bb85c9dd88ac00e1f5050000000017a914aada77d31171bf21f262ea066ed7bc8b0f3aa7348766000000 | |
{ | |
"txid": "3be9910eb7b38fa494cd4937d517c6246a7f106e6f791f3a20993f9bc3123aab", | |
"hash": "3be9910eb7b38fa494cd4937d517c6246a7f106e6f791f3a20993f9bc3123aab", | |
"version": 2, | |
"size": 224, | |
"vsize": 224, | |
"locktime": 102, | |
"vin": [ | |
{ | |
"txid": "db93b4c4dacc0d4fd7622dbec932d4259289d22af9f2dafc764c9117e228b3e8", | |
"vout": 0, | |
"scriptSig": { | |
"asm": "304502210087c63ba58e46c23a6a9ecfe29d77624abd5c55728606ebd3743be9273e4e2dc902205bcbc0fac0ab1727dc9e5baf10b68b8e99c74c2ac38efdb3724171aeb482f667[ALL] 02f3b361c78b4a8b7aaeac77bbb1dcad4de6671a8b630a74d2e50348400d07daba", | |
"hex": "48304502210087c63ba58e46c23a6a9ecfe29d77624abd5c55728606ebd3743be9273e4e2dc902205bcbc0fac0ab1727dc9e5baf10b68b8e99c74c2ac38efdb3724171aeb482f667012102f3b361c78b4a8b7aaeac77bbb1dcad4de6671a8b630a74d2e50348400d07daba" | |
}, | |
"sequence": 4294967294 | |
} | |
], | |
"vout": [ | |
{ | |
"value": 47.99991720, | |
"n": 0, | |
"scriptPubKey": { | |
"asm": "OP_DUP OP_HASH160 9c34642af476cc95780f6073cd6afd33bb85c9dd OP_EQUALVERIFY OP_CHECKSIG", | |
"hex": "76a9149c34642af476cc95780f6073cd6afd33bb85c9dd88ac", | |
"reqSigs": 1, | |
"type": "pubkeyhash", | |
"addresses": [ | |
"muktUBwtsrdKT4iERXAP9AVYrYoPFHwQoY" | |
] | |
} | |
}, | |
{ | |
"value": 1.00000000, | |
"n": 1, | |
"scriptPubKey": { | |
"asm": "OP_HASH160 aada77d31171bf21f262ea066ed7bc8b0f3aa734 OP_EQUAL", | |
"hex": "a914aada77d31171bf21f262ea066ed7bc8b0f3aa73487", | |
"reqSigs": 1, | |
"type": "scripthash", | |
"addresses": [ | |
"2N8pcaKeeCwHq1F6DQc3XTAueAjPjhPMu74" | |
] | |
} | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bitcoin-cli getaccountaddress "" | |
muGQPeUuHbUfigatjysh9wRxLv4zbCP9bz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bitcoin-cli createrawtransaction "[{\"txid\":\"3be9910eb7b38fa494cd4937d517c6246a7f106e6f791f3a20993f9bc3123aab\",\"vout\":1}]" "{\"muGQPeUuHbUfigatjysh9wRxLv4zbCP9bz\":0.99}" | |
0200000001ab3a12c39b3f99203a1f796f6e107f6a24c617d53749cd94a48fb3b70e91e93b0100000000ffffffff01c09ee605000000001976a91496d14e45a09d77a0fa3eca7392c8d01e633a9c2d88ac00000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bitcoin-cli decoderawtransaction 0200000001ab3a12c39b3f99203a1f796f6e107f6a24c617d53749cd94a48fb3b70e91e93b0100000000ffffffff01c09ee605000000001976a91496d14e45a09d77a0fa3eca7392c8d01e633a9c2d88ac00000000 | |
{ | |
"txid": "f5496c4011538543e056558cad30b81624ddbab51725dffb01c4add51787212d", | |
"hash": "f5496c4011538543e056558cad30b81624ddbab51725dffb01c4add51787212d", | |
"version": 2, | |
"size": 85, | |
"vsize": 85, | |
"locktime": 0, | |
"vin": [ | |
{ | |
"txid": "3be9910eb7b38fa494cd4937d517c6246a7f106e6f791f3a20993f9bc3123aab", | |
"vout": 1, | |
"scriptSig": { | |
"asm": "", | |
"hex": "" | |
}, | |
"sequence": 4294967295 | |
} | |
], | |
"vout": [ | |
{ | |
"value": 0.99000000, | |
"n": 0, | |
"scriptPubKey": { | |
"asm": "OP_DUP OP_HASH160 96d14e45a09d77a0fa3eca7392c8d01e633a9c2d OP_EQUALVERIFY OP_CHECKSIG", | |
"hex": "76a91496d14e45a09d77a0fa3eca7392c8d01e633a9c2d88ac", | |
"reqSigs": 1, | |
"type": "pubkeyhash", | |
"addresses": [ | |
"muGQPeUuHbUfigatjysh9wRxLv4zbCP9bz" | |
] | |
} | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Secret> <RedeemScript> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> cd bitcoin-0.15.1 | |
> mkdir data | |
> cd bin | |
> bitcoind -datadir="..\data" -regtest -printtoconsole -rpcuser=<user> -rpcpassword=<password> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bx-windows-x64-icu.exe script-encode "[666ba935d6ac853b77cae59f180085b3] [a8209335595211f33e762838007a614887a518fd7bf8434654e1bfe12a7eba6a27f887]" | |
10666ba935d6ac853b77cae59f180085b323a8209335595211f33e762838007a614887a518fd7bf8434654e1bfe12a7eba6a27f887 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bitcoin-cli sendrawtransaction 0200000001ab3a12c39b3f99203a1f796f6e107f6a24c617d53749cd94a48fb3b70e91e93b010000003510666ba935d6ac853b77cae59f180085b323a8209335595211f33e762838007a614887a518fd7bf8434654e1bfe12a7eba6a27f887ffffffff01c09ee605000000001976a91496d14e45a09d77a0fa3eca7392c8d01e633a9c2d88ac00000000 | |
3efcdc86c5665892ab74c5a40696f36c2d7b600467a6c2ed563486804f910d9a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bitcoin-cli generate 1 | |
[ | |
"2465bb4f8a833fbe112a645189fbb43b9a5b0783b8492cbb250a6abba7952a96" | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bitcoin-cli getblock 2465bb4f8a833fbe112a645189fbb43b9a5b0783b8492cbb250a6abba7952a96 | |
{ | |
"hash": "2465bb4f8a833fbe112a645189fbb43b9a5b0783b8492cbb250a6abba7952a96", | |
"confirmations": 1, | |
"strippedsize": 365, | |
"size": 365, | |
"weight": 1460, | |
"height": 104, | |
"version": 536870912, | |
"versionHex": "20000000", | |
"merkleroot": "6c4762260057d1ec4dbc3a1ed9fc8566d89ab6fb1adfb74214b0e07a3edbe833", | |
"tx": [ | |
"0976c13963e050b6878a44644393f3f2c506372bed4f8ee5b0d07c71849d565b", | |
"3efcdc86c5665892ab74c5a40696f36c2d7b600467a6c2ed563486804f910d9a" | |
], | |
"time": 1527920432, | |
"mediantime": 1527912456, | |
"nonce": 0, | |
"bits": "207fffff", | |
"difficulty": 4.656542373906925e-010, | |
"chainwork": "00000000000000000000000000000000000000000000000000000000000000d2", | |
"previousblockhash": "3dd604840ade8e56ca9c6f7f3ae233f7079a0a08dfee93cc57a1cd90d9ae4818" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OP_HASHxxx <SecretHash> OP_EQUALVERIFY OP_DUP OP_HASH160 <PubKeyHash> OP_EQUALVERIFY OP_CHECKSIG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bitcoin-cli -regtest -rpcuser=<user> -rpcpassword=<password> help | |
== Blockchain == | |
getbestblockhash | |
getblock "blockhash" ( verbosity ) | |
getblockchaininfo | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> notepad.exe %AppData%\Bitcoin\bitcoin.conf | |
rpcuser=<user> | |
rpcpassword=<password> | |
regtest=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bitcoin-cli generate 101 | |
> bitcoin-cli getbalance | |
50.00000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bx-windows-x64-icu.exe help | |
Usage: bx COMMAND [--help] | |
Version: 3.2.0 | |
Info: The bx commands are: | |
address-decode | |
address-embed | |
address-encode | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bx-windows-x64-icu.exe seed -b 128 | |
666ba935d6ac853b77cae59f180085b3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bx-windows-x64-icu.exe sha256 666ba935d6ac853b77cae59f180085b3 | |
9335595211f33e762838007a614887a518fd7bf8434654e1bfe12a7eba6a27f8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bx-windows-x64-icu.exe script-encode "SHA256 [9335595211f33e762838007a614887a518fd7bf8434654e1bfe12a7eba6a27f8] EQUAL" | |
a8209335595211f33e762838007a614887a518fd7bf8434654e1bfe12a7eba6a27f887 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment