Bitcoin Forum
June 26, 2024, 09:29:39 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: lock time: big endian or little endian ?  (Read 1373 times)
redPanda (OP)
Member
**
Offline Offline

Activity: 65
Merit: 16


View Profile
April 21, 2015, 05:59:25 PM
 #1

I want to create a raw transaction

If the lock time is not 00 00 00 00
should I write it as big endian or little endian ?
Darkblock
Full Member
***
Offline Offline

Activity: 124
Merit: 100


photo taken by ESSA-7 satelite. 1968


View Profile
April 26, 2015, 09:01:21 AM
 #2

I want to create a raw transaction

If the lock time is not 00 00 00 00
should I write it as big endian or little endian ?

I always use little endian format for locktime coding in my raw transactions. haven't you tested it for your case?? 
redPanda (OP)
Member
**
Offline Offline

Activity: 65
Merit: 16


View Profile
April 28, 2015, 02:21:04 AM
 #3

Not yet, I will have to find a transaction somewhere with a non-zero value
to make some tests. But now I still have problems with my script to find
the way to verify the validity of a signature...
samson
Legendary
*
Offline Offline

Activity: 2097
Merit: 1070


View Profile
April 28, 2015, 12:22:21 PM
 #4

i can't say with confrimation but i always use little eldian raw time to protect the essential timing of a transation for bitcion to made it easy.
I need to make a zero value transcation to checkout whether the lock time shoud be big edian or little endiain but as i think you shoud go with little endian.

You could always check the source code to see where / how the value is used during transaction processing.

Maube read this then follow from there : http://bitcoin.stackexchange.com/questions/5914/how-is-locktime-enforced-in-the-standard-client
cjp
Full Member
***
Offline Offline

Activity: 210
Merit: 124



View Profile WWW
May 02, 2015, 08:38:55 AM
 #5

Or you can check it the stupid way: make a lock time which is in the past when interpreted as little endian, but in the future when interpreted as big endian. Then make two transactions, which spend the same output, but with opposite endianness of the lock time. Broadcast both, and check which one ends up in the block chain.

Beware that if you make any mistakes, you might draw the wrong conclusion from such a test. For instance, don't forget to make one of the input sequence numbers non-equal to UINT_MAX, and don't forget, when choosing your lock time values, that there are two ranges of lock time values: one part is block height, and the other part is timestamp.

What you can also do is search the block chain for existing transactions that use the lock time, and analyze these.

Donate to: 1KNgGhVJx4yKupWicMenyg6SLoS68nA6S8
http://cornwarecjp.github.io/amiko-pay/
davec
Newbie
*
Offline Offline

Activity: 39
Merit: 0


View Profile
May 07, 2015, 04:07:32 AM
 #6

Little endian:  https://github.com/btcsuite/btcd/blob/master/wire/msgtx.go#L307

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!