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

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

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

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

Error 26: mandatory-script-verify-flag-failed (Data push larger than necessary)

I’ve created a raw transaction, and I get this error when I try to send it with sendrawtransaction to my local bitcoin regtest. { “error”: { “code”: -26, “message”: “mandatory-script-verify-flag-failed (Data push larger than necessary)” }, “id”: “1”, “result”: null } This is the transaction from which I want to spend: { “error”: null, “id”: […]

Categories
Bitcoin Cryptocurrency Mastering Development

Sign manually P2WSH native with Openssl

I’m studying the segwit part, and I want to sign P2WSH (native) manually (openssl). I just read the BIP0143 and I see the new transaction digest. Double SHA256 of the serialization of: 1. nVersion of the transaction (4-byte little endian) 2. hashPrevouts (32-byte hash) 3. hashSequence (32-byte hash) 4. outpoint (32-byte hash + 4-byte little […]

Categories
Bitcoin Cryptocurrency Development

Bech32 Multisig error: Witness requires empty scriptSig (code 64)

I’ve been able to do multisig between two addresses from electrum and one from bitcoind. [root@test bin]# bitcoin-cli -testnet getnewaddress n3JewuY82cprdRvxHdRNG8C3iTkJBKeLbz [root@test bin]# bitcoin-cli -testnet getaddressinfo n3JewuY82cprdRvxHdRNG8C3iTkJBKeLbz { “address”: “n3JewuY82cprdRvxHdRNG8C3iTkJBKeLbz”, “scriptPubKey”: “76a914eeff4b7b1c133c7f72c1b28c4d3c45fdf377c38788ac”, “ismine”: true, “solvable”: true, “desc”: “pkh([55e0eacd/0’/0’/23′]0361ac153cfc0c5cefb74fa904ca83105ccdcbaa3c1ebb8266a03212619ae1006a)#egqffv76”, “iswatchonly”: false, “isscript”: false, “iswitness”: false, “pubkey”: “0361ac153cfc0c5cefb74fa904ca83105ccdcbaa3c1ebb8266a03212619ae1006a”, “iscompressed”: true, “label”: “”, “ischange”: false, “timestamp”: 1576329907, “hdkeypath”: […]