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?
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.
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.
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.
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.
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.
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.
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.