Who Actually Drives Bitcoin Locktime? Users or Miners?

20 replies 43 views
Posts: 252 · Reputation: 12
#1Sep 30, 2022, 11:57 PM
Stumbling upon Bitcoin terms is wild. Just learned about Locktime. What even is it? Turns out it stops a transaction from being mined until a certain time or block is hit. Why would anyone want that?
5 Reply Quote Share
0xNodeMember
Posts: 671 · Reputation: 80
#2Oct 1, 2022, 03:25 PM
Locktime is set right at the end of the transaction. But here’s the kicker: you need one of the inputs to be locked too. Just slapping on a locktime isn’t enough. The sequence value must be set to 0xfffffffe or lower to even make it work.
1 Reply Quote Share
Ba5edGuruFull Member
Posts: 92 · Reputation: 349
#3Oct 4, 2022, 01:34 AM
Quick question though... if you set a locktime but later wanna change it, can you? Or is it locked in once it’s set?
5 Reply Quote Share
0x4lphaFull Member
Posts: 519 · Reputation: 509
#4Oct 4, 2022, 06:58 AM
You can definitely cancel a transaction before your locktime hits. Just cancel and create a new one. But if you wanna change the amount or details, nope, can’t do that.
3 Reply Quote Share
0xNodeMember
Posts: 671 · Reputation: 80
#5Oct 4, 2022, 10:05 AM
So there are two types of locktime, right? One based on time and the other on block height. If it's a low value, it’s height. High value? It's UTC time. Simple as that.
1 Reply Quote Share
alexsatNewbie
Posts: 278 · Reputation: 15
#6Oct 4, 2022, 12:33 PM
For a clearer example, imagine set a locktime for a child’s savings until they turn 18. You set that date and boom, they can access it then. But nodes might not keep it in their mempool for far future dates. Weird.
2 Reply Quote Share
im_foxMember
Posts: 92 · Reputation: 57
#7Oct 4, 2022, 03:37 PM
Locktime is actually super useful for things like inheritance. You can plan gifts ahead of time. Default is 0, but you can set it anywhere from 0 to 500 million.
4 Reply Quote Share
wizard_2016Full Member
Posts: 127 · Reputation: 575
#8Oct 4, 2022, 08:06 PM
Using nLockTime is like saying, ‘Hey, cash this check later’. It stops the transaction until a certain point. Some wallets use it to prevent miners from messing with the chain.
1 Reply Quote Share
0xLaserFull Member
Posts: 252 · Reputation: 641
#9Oct 4, 2022, 11:48 PM
What if you create a transaction with a crazy high fee? If miners see that, they could redo a block just to grab those fees. Risky business.
0 Reply Quote Share
Posts: 252 · Reputation: 12
#10Oct 5, 2022, 12:07 AM
So, just one locktime per transaction, right? It can either be a date or block height, but not both?
0 Reply Quote Share
mr_apeNewbie
Posts: 401 · Reputation: 35
#11Oct 5, 2022, 04:07 AM
Exactly, there’s only one nLocktime for each transaction. It can represent either a date or a block height, depending on the value.
2 Reply Quote Share
max2013Newbie
Posts: 99 · Reputation: 24
#12Oct 5, 2022, 04:38 AM
But how does the network agree on time? Seems messy without consensus on time itself. Mixing datetime and block height in one field feels wrong.
3 Reply Quote Share
mr_apeNewbie
Posts: 401 · Reputation: 35
#13Oct 5, 2022, 06:00 AM
Actually, there is a way. Block headers have timestamps. Not super exact, but it works. 4 bytes for locktime is enough. The numbers range is enough to cover a long time.
3 Reply Quote Share
0xChadNewbie
Posts: 513 · Reputation: 3
#14Oct 6, 2022, 12:33 PM
Transactions with future locktimes get flagged as non-final and won’t make it to the mempool. They stay in your wallet or get stored somewhere else.
3 Reply Quote Share
0xLaserFull Member
Posts: 252 · Reputation: 641
#15Oct 6, 2022, 04:30 PM
Kinda true, but there are sites that accept time-locked transactions briefly. They later drop them if they stay unconfirmed. Odd, huh?
0 Reply Quote Share
0xChadNewbie
Posts: 513 · Reputation: 3
#16Oct 6, 2022, 09:41 PM
I think certain nodes may not enforce those rules, allowing some flexibility. But generally, it’s for safety, especially against DDOS.
6 Reply Quote Share
0xLaserFull Member
Posts: 252 · Reputation: 641
#17Oct 7, 2022, 08:04 AM
If a block with your locktime gets reorged, your transaction might just disappear. Better keep it safe if there’s a risk of being overlooked.
2 Reply Quote Share
max2013Newbie
Posts: 99 · Reputation: 24
#18Oct 7, 2022, 11:13 AM
How much of a risk is that? Sounds sketchy. This feel like a hacky solution to me. Just make separate fields for time and block height!
5 Reply Quote Share
0xLaserFull Member
Posts: 252 · Reputation: 641
#19Oct 8, 2022, 02:44 PM
Exactly. Having them mixed in one field just feels like poor design. It’s gonna be a nightmare in 2106 and beyond.
2 Reply Quote Share
max2013Newbie
Posts: 99 · Reputation: 24
#20Oct 9, 2022, 10:52 AM
Totally agree on that. Satoshi definitely took some shortcuts. It’s not pretty and there’s a lot to fix. What’ll happen then?
0 Reply Quote Share

Related topics