7

My search on this website did not reveal a single answer that comprehensively explores nSequence and how it has evolved since inception. They either address a particular query or are dated like this. If you can find a better/older answer, mark this question as duplicate. Original meaning of nSequence in transactions nSequence is a 4 byte input level ...


6

OP_CHECKSEQUENCEVERIFY (a.k.a OP_RELATIVECHECKLOCKTIMEVERIFY) can do Relative lock times (used for sidechains and lightning). It basically checks, if a inputs sequence number is smaller then the sequence threshold (1 << 31 = 2147483648), and if, it will compare the nLockTime against the sequence number of the input. More info: https://github.com/...


4

They do not serve the same function. Putting a relative locktime in the nSequence value means "this transaction cannot be mined until its input is at least that old". Putting a relative locktime with OP_CSV in the script means "Require that the transaction spending this sets an nSequence of at least this value". The reason why they are split up is to make ...


3

This is because CSV and CLTV are NOP opcodes that were redefined in a softfork. As a softfork can only change the validity of transactions from valid to invalid, the only effect this redefinition was allowed to have is making the script abort in some conditions, and keep acting like NOP otherwise. NOP does not pop anything off the stack, and as a result, ...


3

If you're creating a version 2 transaction with the disable flag not set, then by definition the whole nSequence value will be less than 0xFFFFFFFE (because it will be at most 0x7FFFFFFF). This implies that a transaction with an active relative locktime will always be replacable according to BIP125. This is intentional. Nonreplacable transactions attempt ...


3

Yes, testnet3 supports SegWit as of block 834624. Yes, testnet3 supports both OP_CSV and OP_CLTV. You might also be interested to know that there is a segnet test network on another port number. See https://bitcointalk.org/index.php?topic=1453392.0 for more details.


2

CSV is not a stop-gap solution. Before you can say that, you first need to define what the problem is. CSV solves the problem that you can't use CLTV in contracts that need a spending delay where the output itself will not be broadcast for an unknown amount of time. This is a very abstract problem, but it does occur as a primitive inside more complex ...


1

i manage to find answer for myself. OP_CSV date consensus is based on median time past (mtp), not block's confirmed date. once funding tx above has been confirmed, it is located in block#1609592 with block MTP is 2019-11-24 09:05:26 (UTC 0). At same time, chain's MTP is 2019-11-24 09:25:27 (UTC 0) now come to spending tx, since utxo's confirmed date i ...


1

The sequence number is always 4 bytes, it is a fixed size, little endian, 32 bit integer which makes it always 4 bytes. What you are missing is the scriptSig. The scriptSig always begins with the size of the script (as a compact size unsigned integer). If the scriptSig is empty, then the size must still be there to say that it is a 0 length byte. So the ...


1

If you look at https://blockstream.info/address/bc1qdv0fk4c73fem89s708pzdny8q25d7k5nrckckp87c8alwaw803fq3mqrpz you will see that there are two transactions. The first one https://blockstream.info/tx/943f18e17aa2ba716f2d13785268a1bd6b25c39d2718f3b4785559a5eeaba883 is the funding TX to open the payment channel included in block 587093 (at least according to ...


1

The error gets resolved when I use OP_10 instead of 030a0000 to push the number 10 on the stack. It appears that the bitcoin optimizes the size of the scripts. So to push any number from 2 to 16, OP_2 - OP_16 should be used and for numbers greater than 16 we should give minimum required bytes in the script. E.g. OP_10 (5a) -> Correct 01 0a -> non-...


1

Note: Although this answer is written for testnet, it is absolutely valid for the mainnet as well. The script will be similar, just the address encoding will be different (P2PKH start with 1 vs m for testnet as we use 0x00 as prefix in address base58check in mainnet). I tried to make transaction with Locktime on bitcoin testnet. I am not able to broadcast ...


1

First of all, the Bitcoin network does not have a time granularity of minutes. At best, you can expect things to be within hours of what you want the time to be. So timelocking something for 10 minutes is useless and not very helpful as the "network time" updates only every 10 minutes. The time that you set does not correspond to real time, it corresponds to ...


1

Whereas it seems, that this is not directly possible, cause bitcoin script does not allow to reference a transaction "within last 30 days", one could think about a "workaround" with a business logic watching the P2SH address. An approach could be the nested "if", which is allowed in bitcoin script. If ever within last 30 days there was a payment, the 30 days ...


1

So turns out the sender has to set the same number in the nSequence that is in the script. In the case above 10 will be interpreted as 10 blocks because I was using bitcoinJS lib which converts the decimal 10 to a 32 bit integer which would be 00000000000000000000000000001010 according to bip68 https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki ...


Only top voted, non community-wiki answers of a minimum length are eligible