Centralized methods, essentially banks, have their own times and procedures for handling money, which are already controlled and regulated.
Therefore, before making a transaction, we know that it will take hours or days to transfer money from one bank to another bank.
Of course, before disbursing any money, they pass our data through different mechanisms, entities and bank officials to know if the money is real, is legal and our account is in order. Without any of that, it cannot be transferred.
So far, so good and we know it very well. However, it is different for the world of cryptos, as they are decentralized.
For this reason, there are timelocks which, although very similar to the common procedures, are different in their operation. Make yourself comfortable, today we will talk about a slightly more technical topic.
Timelock is a clause or a primitive smart contract that serves to establish under what conditions transactions on a blockchain will be validated. They were developed by Satoshi Nakamoto and are applied in bitcoin purchases.
Its function is that transactions are only processed in a period already established by us, in which certain preconditions must already be resolved.
This process is as if, for example, you had a clothing store. After a customer arrives and chooses the clothes he will buy, you start making a checklist of the aspects you must take into account in order to make the purchase effective, such as that his money is not fake, his ID card is real, his signature matches his ID, among others.
It is a type of full time lock that acts on transactions. It was the first one created and the one available in Satoshi Nakamoto’s original Bitcoin software.
It specifies the earliest time in UNIX time – or milliseconds elapsed since midnight on January 1, 1970, so each day is treated as having 86400 seconds – or the lowest block height at which a transaction can be added to a valid block. If this time does not elapse, a block cannot be accepted.
An example of this could be that we decide to send a gift to a person who is in another part of Spain. We determine and pay so that, in 864000 seconds (10 days in UNIX time), it will be at the house of the person we want.
In the past, they worked with 32 bits without signs, but nowadays they are more complex and can block a transaction for more than 9000 years with block numbers or 2000 years if it is with timestamps.
This type of blockchain is part time and was introduced in 2016 in the BIP 68 soft fork. It is a parameter that is applied to each transaction entry, as it sets an earlier or nearer time to add to some of the blocks in the blockchain.
It looks the same as an nLockTime, but their distinction is that this earlier or nearer time is much shorter than that of an nLocktime, since they use 18 of the 32 bits and are limited to 65,535 block units and only 18 hours (64,800 in seconds).
Following the example of sending a package, with nSequence we would no longer be able to send the gift so far in advance. In this case, we would send it the day before.
In late 2015, in the BIP65 soft fork, the NOP2 opcode was redefined as the CheckLockTimeVerify (CLTV) transaction code. It acts at the script level and locks transaction outputs so that they cannot be spent before a certain time/date.
It has two possible functions:
So far, it is understandable. But how does it work if there is an active nLocktime? What the nLocktime does is to add the transaction we are performing to the block.
However, the transaction cannot be recorded on the blockchain, without being disbursed, so the nLocktime, must be, primarily, after the CTLV to ensure that the CTLV has expired and the transaction can be included in a valid block.
It is also part of the BIP68 soft fork and it is the CheckSequenceVerify opcode that provides a relative blocking time.
The difference is that, instead of looking at time, it blocks transaction outputs so that they cannot be spent before a certain number of blocks have been mined.
This Timelock operates at the script level. CheckSequenceVerify can block transactions in a range of more than 65,000 blocks. In time measure, we are talking about almost 460 days.
Regarding its advantages, it is very useful to prevent attackers from accessing your assets and to provide Bitcoin with new programming capabilities that allow the construction of new features such as Lightning Network.
Regarding its disadvantages, because of the time locked, it is money that even you cannot touch until a specific date or block number. In addition, it is complex, because it requires programming knowledge to be able to implement them.
This is the end of our tour. If you are interested in reading more articles associated with the news of the crypto universe and its basic concepts, you can click on the topics below. We know that they will be very useful for you.
For the time being, see you in a future article!