Title: Question regarding BIP-112, BIP68 CSV and nSequence Post by: mandelduck on January 03, 2018, 02:45:01 PM Hi
I have a question about BIP112 and BIP68 (I am using bitcoin-js lib to implement) I locked up an output using csv and set the lock time to decimal 169, if I understand correctly this should be around 1 day (as 512 * 169 is the num of seconds in a day roughly) bitcoin.script.number.encode(169), bitcoin.opcodes.OP_NOP3, bitcoin.opcodes.OP_DROP I understand in the tx that spends the utxo I need to set the nSequence number according to bip68 Here I get a little confused, but I created the following decimal number 4194473 to set the nSequence based on the following logic create a string to represent the 32 byte sequence and set the disable flag to 0 and the version flag to 1 (to interpret as time and not blocks) 0xxxxxxxx1xxxxxx convert the lock number of 169 into binary 10101001 pad some zeros at the end to make it 16 bits long 0000000010101001 append it to the end of the first binary number with disable and version flag 00000000010000000000000010101001 convert to decimal so I can set the number easily in bitcoin-js input["sequence"]=4194473 I guess I will find out if I can redeem in a day but is this the correct understanding of BIP 112 and BIP 68? Thanks Title: Re: Question regarding BIP-112, BIP68 CSV and nSequence Post by: achow101 on January 03, 2018, 07:06:16 PM convert the lock number of 169 into binary Bitcoin uses little endian numbers, so these need to be reversed.10101001 pad some zeros at the end to make it 16 bits long 0000000010101001 Otherwise, that looks correct. Title: Re: Question regarding BIP-112, BIP68 CSV and nSequence Post by: mandelduck on January 11, 2018, 08:20:03 AM thanks for the reply I seem to have gotten it working and also found a bip68 lib for bitcoinjs as well
|