Categories
Bitcoin Cryptocurrency Mastering Development

What happens if 2 transaction spend to the same output?

I’m looking though the blockchain, and I’ve found 2 transactions in different blocks, which have the same hash: block 91812: "result": { "hash": "00000000000af0aed4792b1acee3d966af36cf5def14935db8de83d6f9306f2f", "confirmations": 545294, "strippedsize": 616, "size": 616, "weight": 2464, "height": 91812, "version": 1, "versionHex": "00000001", "merkleroot": "49991d7653bec6efebee7d11f27ca2dffcc35ebe95ee5eebd602916b2f2fa665", "tx": [ { "txid": "d5d27987d2a3dfc724e359870c6644b40e497bdc0589a033220fe15429d88599", "hash": "d5d27987d2a3dfc724e359870c6644b40e497bdc0589a033220fe15429d88599", "version": 1, "size": 133, "vsize": 133, "weight": 532, […]

Categories
Bitcoin Cryptocurrency Mastering Development

Retrieve address when create a channel lightning network

I have two nodes in regtest. the first one is: $ l1-cli getinfo { "id": "02c3f99e70c8da59e428dd119d36c0a1317e5cd85218a760355b5f9b4f822f6109", "alias": "ALICE", "color": "ddff06", "num_peers": 0, "num_pending_channels": 0, "num_active_channels": 0, "num_inactive_channels": 0, "address": [], "binding": [ { "type": "ipv4", "address": "127.0.0.1", "port": 6060 } ], "version": "v0.8.2-269-g6014644", "blockheight": 1, "network": "regtest", "msatoshi_fees_collected": 0, "fees_collected_msat": "0msat", "lightning-dir": "/tmp/l1-regtest/regtest" } $ […]

Categories
Bitcoin Cryptocurrency Mastering Development

How does `createrawtransaction` and `fundrawtransaction` work with Elements?

I know how to create and fund bitcoin transactions using createrawtransaction and fundrawtransaction methods. I tried to use the same methods in Elements to create a transaction on regtest and I’m a bit confused now. What I’m trying to do precisely is having a node who only have a watch-only wallet creates and funds transactions […]

Categories
Bitcoin Cryptocurrency Mastering Development

Sequence valid before time

I’m studying sequence, and I set a transaction valid after 512 seconds. First of all I use regtest and I start from clean blockchain, after that I mine 114 blocks. At this point miner creates a transaction and tries to send it My decode transaction { “txid”: “59ff4adafb47a5b22c6434af38f6e138c9008356778ed8b308c48029d7d4032f”, “hash”: “1bef48f96d18f1c78021b7e4b0a7d5285f6f7d2cc8c7adc31671820e367c3d70”, “version”: 2, “size”: 191, “vsize”: […]

Categories
Bitcoin Cryptocurrency Mastering Development

Bitcoin Cash error: mandatory-script-verify-flag-failed

I use my own script to build and broadcast a Bitcoin Cash tx. A week ago I had no problem at all. Now I got this error when I try to broadcast my tx: mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation) (code 16)”,”code”:-26,”name”:”RpcError” I checked that the input in the tx is not […]

Categories
Bitcoin Cryptocurrency Mastering Development

nSequence doesn’t block my transaction

I’m studying how Timelock works. I’m able to create transaction with absolute time, nLocktime and OP_CLTV. Now I want to understand the relative part, and I start with nSequence. At the moment I use createrawtransaction to create my raw transaction, where bitcoin-cli createrawtransaction ‘[{“txid”:”‘$TXID'”,”vout”:’$VOUT’,”sequence”:’$TIME’}]’ ‘[{“‘$ADDR_DEST'”:’$AMOUNT’}]’ Where $TIME is: $ gdate –date ‘now + 512 seconds’ […]

Categories
Bitcoin Cryptocurrency Mastering Development

OP_CHECKLOCKTIMEVERIFY non-mandatory-script-verify-flag

I have two addresses in my regtest. A address is the P2SH-P2PKH. (sender) B address is the P2SH-P2PKH, but with OP_CHECKLOCKTIMEVERIFY block height 201. (receiver) My regtest doesen’t have any block before it, Then I create some blocks (101) for A and transfer some bitcoins to B. A Wants that the UTXO is available after […]

Categories
Bitcoin Cryptocurrency Mastering Development

Decodescript for a Testnet pubkey hash address

This is the address information: bitcoin-cli validateaddress n35oDVMPNkHRzBKy7q9RDB7r5e8qbVa9SW { “isvalid”: true, “address”: “n35oDVMPNkHRzBKy7q9RDB7r5e8qbVa9SW”, “scriptPubKey”: “76a914ec90ca28c0ec302e991fb1c8171bf49c0d3d05be88ac”, “isscript”: false, “iswitness”: false } bitcoin-cli decodescript 76a914ec90ca28c0ec302e991fb1c8171bf49c0d3d05be88ac { “asm”: “OP_DUP OP_HASH160 ec90ca28c0ec302e991fb1c8171bf49c0d3d05be OP_EQUALVERIFY OP_CHECKSIG”, “reqSigs”: 1, “type”: “pubkeyhash”, “addresses”: [ “n35oDVMPNkHRzBKy7q9RDB7r5e8qbVa9SW” ], “p2sh”: “2NFyoZJJuWpvyiHFirFqsQnPXXna6mtf4Li”, “segwit”: { “asm”: “0 ec90ca28c0ec302e991fb1c8171bf49c0d3d05be”, “hex”: “0014ec90ca28c0ec302e991fb1c8171bf49c0d3d05be”, “reqSigs”: 1, “type”: “witness_v0_keyhash”, “addresses”: [ “tb1qajgv52xqasczaxglk8ypwxl5nsxn6pd7307tfg” ], […]

Categories
Bitcoin Cryptocurrency Mastering Development

What is the link between address and use of the UTXO?

I state that I’m still a beginner. I need some clarification. I am using the Testnet. This is the information regarding the address I used to receive funds from a Faucet bitcoin-cli validateaddress 2N7MaihNErbNH8XTkuZWtJYPzMQAWMPVKHd { “isvalid”: true, “address”: “2N7MaihNErbNH8XTkuZWtJYPzMQAWMPVKHd”, “scriptPubKey”: “a9149ac58ff47e27214b158b38da04bc8cbf72def14387”, “isscript”: true, “iswitness”: false } bitcoin-cli decodescript a9149ac58ff47e27214b158b38da04bc8cbf72def14387 { “asm”: “OP_HASH160 9ac58ff47e27214b158b38da04bc8cbf72def143 OP_EQUAL”, “reqSigs”: […]

Categories
Bitcoin Cryptocurrency Mastering Development

Sign manually P2SH-P2WPKH with openssl

I have a very similar problem of my last post before post again, I tried a lot of time but whitout success. I studied this link but I don’t find solution. I have 50 bitcoins (total Amount) and I want to move 49.999991 It’s my compressed public key 02c142cea1c25689d233b35c0021c47194ebc99cbc6154f7de66f2c078c1e773f3 And It’s my transaction data { […]