Bitcoin Forum
November 06, 2024, 01:38:40 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How does BIP0068 work?  (Read 968 times)
Ilsk (OP)
Legendary
*
Offline Offline

Activity: 834
Merit: 1015



View Profile
January 26, 2017, 03:41:35 PM
Last edit: January 26, 2017, 11:59:22 PM by Ilsk
 #1

I am trying to create a transaction with relative lock time using BIP 68, but I have some problem setting the sequence number correctly.

I tried to leave the bit (1<<31) not set to have the sequence number interpreted as relative lock time, the bit (1<<22) not set so the relative lock-time specifies a number of blocks and not a timespan, and then since the BIP only interprets 16 bits of the sequence number as relative lock-time, I applied the mask 0x0000ffff to the sequence field, trying to set some very large number such as 0x0000afff.

I did some tests on both testnet and mainnet and every time the transaction was immediately recognised as valid, instead of remaining invalid until the number of blocks specified in the nsequence were passed.

Is there someone who can explain me what did I do wrong, or have an example of a correctly set relative lock time?

NB: At the moment I am not interested in the CSV, I'm just trying to understand how the relative lock time specified in BIP68 works.
MattWin
Newbie
*
Offline Offline

Activity: 10
Merit: 0


View Profile
February 15, 2017, 01:22:49 AM
 #2

I'm interested as well. Does anybody on this forum know?
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3542
Merit: 6885


Just writing some code


View Profile WWW
February 15, 2017, 01:45:26 AM
 #3

Were your transactions Version 2 transactions?

Ilsk (OP)
Legendary
*
Offline Offline

Activity: 834
Merit: 1015



View Profile
February 15, 2017, 02:49:38 AM
 #4

Were your transactions Version 2 transactions?

That was exactly my mistake, even if the BIP clearly says to do so I didn't noticed it. Now I tried a test transaction and the client gave me the following error when the sequence number was too high:

Code:
64: non-BIP68-final (code -26) 

Then I decreased the sequence number and the transaction has been correctly broadcasted.

Thank you so much for you help, much appreciated, I spent a lot of time trying to figure out what I was doing wrong
cygan
Legendary
*
Offline Offline

Activity: 3332
Merit: 8837


Crypto Swap Exchange


View Profile WWW
August 05, 2023, 04:18:07 PM
Merited by ABCbits (5), Cricktor (1)
 #5

how bip68 works and how the relative lock-time using nsequence actually looks like can be seen very well in the 4 following slides



█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!