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
Mastering Development

all adjacent list combinations which start from an index; reorder based on dictionary keys (speed, python)

Given this: import re from itertools import islice, chain from numpy import resize def adj(l): ln = len(l) yield l for n in range(ln -1, 0, -1): yield from (tuple(islice(l, i, n + i)) for i in range(ln – n % ln+1)) lexicon = {(‘a’,): 12, (‘a’, ‘n’): 2, (‘h’,): 3, (‘h’, ‘i’): 5, (‘h’, […]

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

OP_CHECKLOCKTIMEVERIFY generates non standard transaction

I create a transaction in my regtest enviroment with OP_CHECKLOCKTIMEVERIFY it’s my transaction data: 0200000001b949410322a4af7c5b24d367aad9ac186902d4aa15b79ced3f821ae772aaabf70000000085483045022100ded7ee34b12e829a0957a852049546ff909d33129c8c1d3769db227cafffcbdd022033b1e9ed37682470b77450d791c8b5dde67f4de2d14b772d2bbcfbe22b3a453b012103f99b855c961eb142cc237d37db22ae67b4a80f2d2f178762110087c1e54f90c51976a914d1d03865cf22d10d9d1ed68889be6bc99513cd6d88ACfeffffff016036f829010000001E04ACFCD95EB175a9141a759e10e92cd4d855ba8bee9cd4f4a276033d1087ACFCD95E { “txid”: “55bfb3b57ad2fe3d3c70d5696e3a7cd0fd4e25c8bf41d7bfa3ab57a457b31776”, “hash”: “55bfb3b57ad2fe3d3c70d5696e3a7cd0fd4e25c8bf41d7bfa3ab57a457b31776”, “version”: 2, “size”: 223, “vsize”: 223, “weight”: 892, “locktime”: 1591344300, “vin”: [ { “txid”: “f7abaa72e71a823fed9cb715aad4026918acd9aa67d3245b7cafa422034149b9”, “vout”: 0, “scriptSig”: { “asm”: “3045022100ded7ee34b12e829a0957a852049546ff909d33129c8c1d3769db227cafffcbdd022033b1e9ed37682470b77450d791c8b5dde67f4de2d14b772d2bbcfbe22b3a453b[ALL] 03f99b855c961eb142cc237d37db22ae67b4a80f2d2f178762110087c1e54f90c5 76a914d1d03865cf22d10d9d1ed68889be6bc99513cd6d88ac”, “hex”: “483045022100ded7ee34b12e829a0957a852049546ff909d33129c8c1d3769db227cafffcbdd022033b1e9ed37682470b77450d791c8b5dde67f4de2d14b772d2bbcfbe22b3a453b012103f99b855c961eb142cc237d37db22ae67b4a80f2d2f178762110087c1e54f90c51976a914d1d03865cf22d10d9d1ed68889be6bc99513cd6d88ac” }, “sequence”: 4294967294 } ], “vout”: [ { “value”: 49.991, […]

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 { […]