{"id":9646,"date":"2023-04-20T06:21:58","date_gmt":"2023-04-20T06:21:58","guid":{"rendered":"https:\/\/www.bitnovo.com\/blog\/?p=9646"},"modified":"2022-05-16T18:36:13","modified_gmt":"2022-05-16T18:36:13","slug":"what-is-timelock-the-bitcoin-clause","status":"publish","type":"post","link":"https:\/\/www.bitnovo.com\/blog\/en\/what-is-timelock-the-bitcoin-clause","title":{"rendered":"What is TimeLock? The Bitcoin Clause"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Alternar tabla de contenidos\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #ffffff;color:#ffffff\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #ffffff;color:#ffffff\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-timelock-the-bitcoin-clause\/#what_is_timelock\" >What is TimeLock?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-timelock-the-bitcoin-clause\/#types_of_locks\" >Types of locks<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-timelock-the-bitcoin-clause\/#nlocktime\" >nLocktime<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-timelock-the-bitcoin-clause\/#nsequence\" >nSequence<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-timelock-the-bitcoin-clause\/#checklocktimeverify_cltv\" >Checklocktimeverify (CLTV)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-timelock-the-bitcoin-clause\/#checksequenceverify_csv\" >Checksequenceverify (CSV)<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-timelock-the-bitcoin-clause\/#what_are_the_advantages_and_disadvantages\" >What are the advantages and disadvantages?<\/a><\/li><\/ul><\/nav><\/div>\n<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Tiempo de lectura:<\/span> <span class=\"rt-time\"> 4<\/span> <span class=\"rt-label rt-postfix\">minutos<\/span><\/span><p>Centralized methods, essentially banks, have their own times and procedures for handling money, which are already controlled and regulated.<\/p>\n<p>Therefore, before making a transaction, we know that it will take hours or days to transfer money from one bank to another bank.<\/p>\n<p>Of course,\u00a0<strong>before disbursing any money, they pass our data through different mechanisms, entities and bank<\/strong>\u00a0officials to know if the money is real, is legal and our account is in order. Without any of that, it cannot be transferred.<\/p>\n<p>So far, so good and we know it very well. However,<strong>\u00a0it is different for the world of cryptos, as they are decentralized.<\/strong><\/p>\n<p>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.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"what_is_timelock\"><\/span><strong>What is TimeLock?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Timelock is a clause or a primitive smart contract that\u00a0<strong>serves to establish under what conditions transactions on a blockchain will be validated<\/strong>. They were developed by\u00a0<a href=\"https:\/\/www.bitnovo.com\/blog\/en\/who-is-satoshi-nakamoto\/\">Satoshi Nakamoto<\/a>\u00a0and are applied in bitcoin purchases.<\/p>\n<p><strong>Its function is that transactions are only processed in a period already established by us,\u00a0<\/strong>in which certain preconditions must already be resolved.<\/p>\n<p>This process is as if, for example, you had a clothing store. After a customer arrives and chooses the clothes he will buy,\u00a0<strong>you start making a checklist of the aspects you must take into account in order to make the purchase effective,<\/strong>\u00a0such as that his money is not fake, his ID card is real, his signature matches his ID, among others.<\/p>\n<p><strong>Commonly, they are used in\u00a0<a href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-a-hash\/\">hash contracts<\/a>, in the payment channels that occur in a\u00a0<a href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-a-smart-contract\/\">smart contract<\/a>\u00a0and in postage or shipping fees\u00a0<\/strong>and there are two ways for it to be added to a blockchain:<\/p>\n<ul>\n<li><strong>According to the height of the block,<\/strong>that is, the position in the block chain of the block in which the transaction will be included. Ex. The transaction is added within 10 blocks.<\/li>\n<li><strong>According to a time parameter\u00a0<\/strong>(minutes, hours, days, months, etc.). The transaction is recorded in 12 hours.<\/li>\n<\/ul>\n<div id=\"image_1277236124\" class=\"img has-hover x md-x lg-x y md-y lg-y\">\n<div class=\"img-inner dark\"><img fetchpriority=\"high\" decoding=\"async\" class=\"attachment-large size-large lazyloaded\" src=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/Que-es-TimeLock1.jpg\" sizes=\"(max-width: 768px) 100vw, 768px\" srcset=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/Que-es-TimeLock1.jpg 768w, https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/Que-es-TimeLock1-300x205.jpg 300w\" alt=\"Qu\u00e9 es TimeLock Bitnovo\" width=\"768\" height=\"526\" data-srcset=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/Que-es-TimeLock1.jpg 768w, https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/Que-es-TimeLock1-300x205.jpg 300w\" data-src=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/Que-es-TimeLock1.jpg\" data-sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/div>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"types_of_locks\"><\/span>Types of locks<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"nlocktime\"><\/span><b>nLocktime<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>It is a type of full\u00a0<strong>time lock that acts on transactions. It was the first one created<\/strong>\u00a0and the one available in Satoshi Nakamoto\u2019s original Bitcoin software.<\/p>\n<p><strong>It specifies the earliest time in UNIX time<\/strong>\u00a0\u2013 or milliseconds elapsed since midnight on January 1, 1970, so each day is treated as having 86400 seconds \u2013\u00a0<strong>or the lowest block height at which a transaction can be added to a valid block<\/strong>. If this time does not elapse, a block cannot be accepted.<\/p>\n<p>An example of this could be that we decide to send a gift to a person who is in another part of Spain.\u00a0<strong>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.<\/strong><\/p>\n<ul>\n<li><strong>If it is less than 500 million,\u00a0<\/strong>the block number after which the transaction can be included in the block is specified.<\/li>\n<li><strong>If greater than 500 million,\u00a0<\/strong>the UNIX timestamp after which this transaction can be included in the block is determined.<\/li>\n<\/ul>\n<p>In the past, they worked with 32 bits without signs, but nowadays they are more complex\u00a0<strong>and can block a transaction for more than 9000 years with block numbers or 2000 years if it is with timestamps.<\/strong><\/p>\n<h3><span class=\"ez-toc-section\" id=\"nsequence\"><\/span><b>nSequence<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>This type of blockchain is part time<\/strong>\u00a0and was introduced in 2016 in the BIP 68 soft fork.\u00a0<strong>It is a parameter that is applied to each transaction entry<\/strong>, as it sets an earlier or nearer time to add to some of the blocks in the blockchain.<\/p>\n<p>It looks the same as an nLockTime, but their distinction is that\u00a0<strong>this earlier or nearer time is much shorter than that of an nLocktime,<\/strong>\u00a0since they use 18 of the 32 bits and are limited to 65,535 block units and only 18 hours (64,800 in seconds).<\/p>\n<p>Following the example of sending a package, with nSequence we would no longer be able to send the gift so far in advance.\u00a0<strong>In this case, we would send it the day before.<\/strong><\/p>\n<h3><span class=\"ez-toc-section\" id=\"checklocktimeverify_cltv\"><\/span><b>Checklocktimeverify (CLTV)<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>In late 2015, in the BIP65 soft fork, the NOP2\u00a0<a href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-an-op_code-quick-guide-for-your-blockchain\/\">opcode<\/a>\u00a0was redefined as the CheckLockTimeVerify (CLTV) transaction code.<strong>\u00a0It acts at the script level and locks transaction outputs so that they cannot be spent before a certain time\/date.<\/strong><\/p>\n<p>It has two possible functions:<\/p>\n<ul>\n<li>Set in advance the specific day on which the transactions will take place.<\/li>\n<li>Change the authentication parameters used by multi-signature addresses, allowing funds to be retrieved if a return is necessary.<\/li>\n<\/ul>\n<p>So far, it is understandable.<strong>\u00a0But how does it work if there is an active nLocktime?<\/strong>\u00a0What the nLocktime does is to add the transaction we are performing to the block.<\/p>\n<p>However,\u00a0<strong>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<\/strong>\u00a0has expired and the transaction can be included in a valid block.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"checksequenceverify_csv\"><\/span><b>Checksequenceverify (CSV)<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>It is also part of the BIP68 soft fork and it is the CheckSequenceVerify\u00a0<a href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-an-op_code-quick-guide-for-your-blockchain\/\">opcode<\/a>\u00a0that\u00a0<strong>provides a relative blocking time.\u00a0<\/strong><\/p>\n<p>The difference is that, instead of looking at time, it blocks transaction outputs so that<strong>\u00a0they cannot be spent before a certain number of blocks have been mined.<\/strong><\/p>\n<p>This Timelock operates at the script level. CheckSequenceVerify\u00a0<strong>can block transactions in a range of more than 65,000 blocks.<\/strong>\u00a0In time measure, we are talking about almost 460 days.<\/p>\n<div id=\"image_609540589\" class=\"img has-hover x md-x lg-x y md-y lg-y\">\n<div class=\"img-inner dark\"><img decoding=\"async\" class=\"attachment-large size-large lazyloaded\" src=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/Que-es-TimeLock.jpg\" sizes=\"(max-width: 768px) 100vw, 768px\" srcset=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/Que-es-TimeLock.jpg 768w, https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/Que-es-TimeLock-300x205.jpg 300w\" alt=\"que es timelock\" width=\"768\" height=\"526\" data-srcset=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/Que-es-TimeLock.jpg 768w, https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/Que-es-TimeLock-300x205.jpg 300w\" data-src=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/Que-es-TimeLock.jpg\" data-sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/div>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"what_are_the_advantages_and_disadvantages\"><\/span>What are the advantages and disadvantages?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Regarding its advantages,\u00a0<\/strong>it is very useful to\u00a0<strong>prevent attackers from accessing your assets<\/strong>\u00a0and to\u00a0<strong>provide Bitcoin with new programming capabilities<\/strong>\u00a0that allow the construction of new features such as\u00a0<a href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-the-lightning-network\/\">Lightning Network<\/a>.<\/p>\n<p><strong>Regarding its disadvantages,\u00a0<\/strong>because of the time locked, it is money that even\u00a0<strong>you cannot touch until a specific date or block number.<\/strong>\u00a0In addition, it\u00a0<strong>is complex<\/strong>, because it requires programming knowledge to be able to implement them.<\/p>\n<p>This is the end of our tour. If you are interested in\u00a0<a href=\"https:\/\/www.bitnovo.com\/blog\/en\/\">reading more articles<\/a>\u00a0associated 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.<\/p>\n<p>For the time being, see you in a future article!<\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Tiempo de lectura:<\/span> <span class=\"rt-time\"> 4<\/span> <span class=\"rt-label rt-postfix\">minutos<\/span><\/span>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,\u00a0before disbursing any money, they pass our data through different mechanisms, entities [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":9650,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[185],"tags":[],"class_list":["post-9646","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blockchain-en"],"_links":{"self":[{"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/posts\/9646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/comments?post=9646"}],"version-history":[{"count":0,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/posts\/9646\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/media\/9650"}],"wp:attachment":[{"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/media?parent=9646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/categories?post=9646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/tags?post=9646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}