{"id":1114,"date":"2020-05-22T13:50:02","date_gmt":"2020-05-22T05:50:02","guid":{"rendered":"https:\/\/www.btse.com\/blog\/?p=1114"},"modified":"2023-03-08T06:22:10","modified_gmt":"2023-03-08T06:22:10","slug":"bitcoin-timelocks","status":"publish","type":"post","link":"https:\/\/www.btse.com\/blog\/bitcoin-timelocks\/","title":{"rendered":"What are Bitcoin Timelocks?"},"content":{"rendered":"<h2><span style=\"color: #000000;\"><strong>Timelocks are Bitcoin\u2019s basic yet effective smart contract feature.<\/strong> <\/span><\/h2>\n<p><span style=\"color: #000000;\">Timelocks are code that tells the entire network when a certain amount of coins can be spent. The time can be defined in both days (the real world\u2019s time reference) or block heights (the Bitcoin network\u2019s time reference). Until the specified moment, the Bitcoin network freezes the funds so they can\u2019t be moved by any party.<\/span><\/p>\n<p><span style=\"color: #000000;\">Thanks to Timelocks, lots of one-time financial contracts can be utilized. Bitcoin is not Turing-complete, so it doesn\u2019t enable recurring payments according to complex conditions. However, the simplicity of its smart contracts also guarantees a greater amount of security \u2013 and just in case Ethereum users want to port their contracts to the Bitcoin blockchain, they can find promising projects like <span style=\"text-decoration: underline;\"><a href=\"https:\/\/www.rsk.co\/\" target=\"_blank\" rel=\"noopener noreferrer\">RSK<\/a><\/span>. <\/span><\/p>\n<p><span style=\"color: #000000;\">So what are the use cases of Timelocks? Well, they range from making savings unspendable for a few years (self-imposed HODLing), setting up payment escrows, creating<\/span> <span style=\"text-decoration: underline;\"><span style=\"color: #0432ff;\"><a href=\"https:\/\/en.bitcoin.it\/wiki\/Payment_channels\" target=\"_blank\" rel=\"noopener noreferrer\">payment channels<\/a><\/span><\/span><span style=\"color: #000000;\"> (the pillars of the Lightning Network), and<\/span> <span style=\"text-decoration: underline;\"><span style=\"color: #0432ff;\"><a href=\"https:\/\/en.bitcoin.it\/wiki\/Techniques_to_reduce_transaction_fees#Pre-computed_fee_bumping\" target=\"_blank\" rel=\"noopener noreferrer\">bumping fees in future blocks<\/a><\/span><\/span><span style=\"color: #000000;\">.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><span style=\"color: #000000;\"><strong>Signing Bitcoin smart contracts with nLockTime<\/strong> <\/span><\/h2>\n<p><span style=\"color: #000000;\">Timelocks are conditional payments that are broadcast at specified times. The original Bitcoin client published by Satoshi Nakamoto allowed for<\/span> <span style=\"text-decoration: underline;\"><span style=\"color: #0432ff;\"><a href=\"https:\/\/en.bitcoin.it\/wiki\/NLockTime\" target=\"_blank\" rel=\"noopener noreferrer\">nLockTime<\/a><\/span><\/span><span style=\"color: #000000;\"> transactions to be sent. This means that users could set a minimum amount of time that needs to pass before a transaction is broadcast to network nodes. <\/span><\/p>\n<p><span style=\"color: #000000;\">In \u201cnLockTime\u201d, \u201cn\u201d allows users to set their time preference (in block height or <span style=\"text-decoration: underline;\"><a href=\"https:\/\/en.wikipedia.org\/wiki\/Unix_time\" target=\"_blank\" rel=\"noopener noreferrer\">unix time<\/a><\/span>) before sending bitcoin. It should be noted that the instruction basically says \u201cyou can spend the coins after this block has been mined or this moment has passed\u201d and doesn\u2019t guarantee that the transaction will be included in a specific block without paying the required fee. Therefore, the transaction may be further delayed until the fee that the sender is willing to pay matches the cost of block space.<\/span><\/p>\n<p><span style=\"color: #000000;\">Though nLockTime isn\u2019t a very popular feature and requires Bitcoin users to change parameters on their nodes through command line instructions, it was still <span style=\"text-decoration: underline;\"><a href=\"https:\/\/txstats.com\/dashboard\/db\/blocks-statistics?panelId=4&amp;fullscreen&amp;orgId=1\" target=\"_blank\" rel=\"noopener noreferrer\">used in roughly 23%<\/a><\/span><\/span><span style=\"color: #000000;\"> of transactions broadcast between April 20th and May 20, 2020. <\/span><\/p>\n<p><span style=\"color: #000000;\">In July 2015,<\/span> <span style=\"text-decoration: underline;\"><span style=\"color: #0432ff;\"><a href=\"https:\/\/bitcoin.org\/en\/release\/v0.11.0#downgrade-warning\" target=\"_blank\" rel=\"noopener noreferrer\">Bitcoin Core 0.11.0<\/a><\/span><\/span><span style=\"color: #000000;\"> was released and it included a special wallet feature that discourages fee snipping with nLockTime. Network fees are expected to become the main source of income for miners further down the <span style=\"text-decoration: underline;\"><a href=\"https:\/\/nakamotoinstitute.org\/mempool\/hyperbitcoinization\/\" target=\"_blank\" rel=\"noopener noreferrer\">hyperbitcoinization<\/a><\/span><\/span><span style=\"color: #000000;\"> road, so it was important to prevent the smart contract feature from cheating network incentives. This also proves that nLockTime is a powerful component of the Bitcoin network, whose potential should not be underestimated.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><strong><span style=\"color: #000000;\">Bitcoin Timelocks \u2013 from temporarily freezing funds to Lightning payment channels<\/span><\/strong><\/h2>\n<p><span style=\"color: #000000;\">How did a basic condition like \u201cdon\u2019t make coins spendable until this moment\u201d evolve into a primitive of Bitcoin\u2019s highly scalable second layer? Well, it all happened thanks to years of contributions from Bitcoin Core developers.<\/span><\/p>\n<p><span style=\"color: #000000;\">In 2015, Mark Fliesenbach, BtcDrak, Nicolas Dorier, and Kiyoshi Tajona created <span style=\"text-decoration: underline;\"><a href=\"https:\/\/github.com\/bitcoin\/bips\/blob\/master\/bip-0068.mediawiki\" target=\"_blank\" rel=\"noopener noreferrer\">relative time-locks<\/a><\/span><\/span><span style=\"color: #000000;\">. This is basically a more complex way of defining the moment when a transaction can be written into a block, by specifying the earliest time it can be added and for how long the bitcoin has been recorded in the ledger prior to being spent.<\/span><\/p>\n<p><span style=\"color: #000000;\">A few months later, Peter Todd introduced the <span style=\"text-decoration: underline;\"><a href=\"https:\/\/github.com\/bitcoin\/bips\/blob\/master\/bip-0065.mediawiki\" target=\"_blank\" rel=\"noopener noreferrer\">BIP65<\/a><\/span><\/span><span style=\"color: #000000;\"> soft fork. This refinement added CheckLockTimeVerify, a feature that allows for transaction outputs to become part of the time lock. Before BIP65, only whole transactions could be used in this smart contract setup. <\/span><\/p>\n<p><span style=\"color: #000000;\">Last but not least, we have CheckSequenceVerify. These are the Timelocks that are used on the Lightning Network, which were introduced in 2015 through <span style=\"text-decoration: underline;\"><a href=\"https:\/\/github.com\/bitcoin\/bips\/blob\/master\/bip-0112.mediawiki\" target=\"_blank\" rel=\"noopener noreferrer\">BIP112<\/a><\/span><\/span><span style=\"color: #000000;\">. Eric Lombrozo, BrcDrak, and Mark Friedenbach are responsible for creating the CHECKSEQUENCEVERIFY opcode, which restricts contract execution clauses according to the age of the spent output.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><strong><span style=\"color: #000000;\">The Takeaway<\/span><\/strong><\/h2>\n<p><span style=\"color: #000000;\">The sum of these inventions has made Bitcoin smart contracts much more suitable for common needs, while also enabling great scalability solutions like <span style=\"text-decoration: underline;\"><a href=\"https:\/\/www.academy.btse.com\/post\/how-does-a-federated-sidechain-work\" target=\"_blank\" rel=\"noopener noreferrer\">pegged sidechains<\/a><\/span><\/span><span style=\"color: #000000;\"> and <span style=\"text-decoration: underline;\"><a href=\"https:\/\/www.academy.btse.com\/post\/lightning-network\" target=\"_blank\" rel=\"noopener noreferrer\">second layers<\/a><\/span><\/span><span style=\"color: #000000;\">. In spite of their relative simplicity, the contracts have proven to be much more robust than their buggy Ethereum counterparts. In the future, Bitcoin might just also become the world\u2019s largest network for smart contracts.<\/span><\/p>\n<p>&nbsp;<\/p>\n<div>\n<div>\n<hr \/>\n<\/div>\n<p><em>Our aim is to create a platform that offers users the most enjoyable trading experience. If you have any feedback, please reach out to us at\u00a0feedback@btse.com or on Twitter @BTSE_Official.<\/em><\/p>\n<p><em>Note: BTSE Blog contents are intended solely to provide varying insights and perspectives. Unless otherwise noted, they do not represent the views of BTSE and should in no way be treated as investment advice. Markets are volatile, and trading brings rewards and risks. Trade with caution.<\/em><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Timelocks are Bitcoin\u2019s basic yet effective smart contract feature. Timelocks are code that tells the entire network when a certain amount of coins can be spent. The time can be defined in both days (the real world\u2019s time reference) or block heights (the Bitcoin network\u2019s time reference). Until the specified moment, the Bitcoin network freezes [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5198,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[8],"tags":[],"class_list":["post-1114","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-education"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>What are Bitcoin Timelocks?<\/title>\n<meta name=\"description\" content=\"Timelocks are an important feature of Bitcoin. When you add the dynamic of time into Bitcoin smart contracts, interesting things can be acheived.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.btse.com\/blog\/bitcoin-timelocks\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What are Bitcoin Timelocks?\" \/>\n<meta property=\"og:description\" content=\"Timelocks are an important feature of Bitcoin. When you add the dynamic of time into Bitcoin smart contracts, interesting things can be acheived.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.btse.com\/blog\/bitcoin-timelocks\/\" \/>\n<meta property=\"og:site_name\" content=\"BTSE Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-22T05:50:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-08T06:22:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.btse.com\/blog\/wp-content\/uploads\/2023\/03\/f33f9f_aceb37bc770f417997737c41b993a5ce-mv2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"BTSE\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@BTSE_Official\" \/>\n<meta name=\"twitter:site\" content=\"@BTSE_Official\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"BTSE\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"What are Bitcoin Timelocks?","description":"Timelocks are an important feature of Bitcoin. When you add the dynamic of time into Bitcoin smart contracts, interesting things can be acheived.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.btse.com\/blog\/bitcoin-timelocks\/","og_locale":"en_US","og_type":"article","og_title":"What are Bitcoin Timelocks?","og_description":"Timelocks are an important feature of Bitcoin. When you add the dynamic of time into Bitcoin smart contracts, interesting things can be acheived.","og_url":"https:\/\/www.btse.com\/blog\/bitcoin-timelocks\/","og_site_name":"BTSE Blog","article_published_time":"2020-05-22T05:50:02+00:00","article_modified_time":"2023-03-08T06:22:10+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/www.btse.com\/blog\/wp-content\/uploads\/2023\/03\/f33f9f_aceb37bc770f417997737c41b993a5ce-mv2.png","type":"image\/png"}],"author":"BTSE","twitter_card":"summary_large_image","twitter_creator":"@BTSE_Official","twitter_site":"@BTSE_Official","twitter_misc":{"Written by":"BTSE","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.btse.com\/blog\/bitcoin-timelocks\/#article","isPartOf":{"@id":"https:\/\/www.btse.com\/blog\/bitcoin-timelocks\/"},"author":{"name":"BTSE","@id":"https:\/\/www.btse.com\/blog\/#\/schema\/person\/46ad80e1bffe6cf5d79938127822f2ca"},"headline":"What are Bitcoin Timelocks?","datePublished":"2020-05-22T05:50:02+00:00","dateModified":"2023-03-08T06:22:10+00:00","mainEntityOfPage":{"@id":"https:\/\/www.btse.com\/blog\/bitcoin-timelocks\/"},"wordCount":768,"publisher":{"@id":"https:\/\/www.btse.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.btse.com\/blog\/bitcoin-timelocks\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.btse.com\/blog\/wp-content\/uploads\/2023\/03\/f33f9f_aceb37bc770f417997737c41b993a5ce-mv2.png?fit=1920%2C1080&quality=75&ssl=1","articleSection":["Education"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.btse.com\/blog\/bitcoin-timelocks\/","url":"https:\/\/www.btse.com\/blog\/bitcoin-timelocks\/","name":"What are Bitcoin Timelocks?","isPartOf":{"@id":"https:\/\/www.btse.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.btse.com\/blog\/bitcoin-timelocks\/#primaryimage"},"image":{"@id":"https:\/\/www.btse.com\/blog\/bitcoin-timelocks\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.btse.com\/blog\/wp-content\/uploads\/2023\/03\/f33f9f_aceb37bc770f417997737c41b993a5ce-mv2.png?fit=1920%2C1080&quality=75&ssl=1","datePublished":"2020-05-22T05:50:02+00:00","dateModified":"2023-03-08T06:22:10+00:00","description":"Timelocks are an important feature of Bitcoin. When you add the dynamic of time into Bitcoin smart contracts, interesting things can be acheived.","breadcrumb":{"@id":"https:\/\/www.btse.com\/blog\/bitcoin-timelocks\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.btse.com\/blog\/bitcoin-timelocks\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.btse.com\/blog\/bitcoin-timelocks\/#primaryimage","url":"https:\/\/i0.wp.com\/www.btse.com\/blog\/wp-content\/uploads\/2023\/03\/f33f9f_aceb37bc770f417997737c41b993a5ce-mv2.png?fit=1920%2C1080&quality=75&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.btse.com\/blog\/wp-content\/uploads\/2023\/03\/f33f9f_aceb37bc770f417997737c41b993a5ce-mv2.png?fit=1920%2C1080&quality=75&ssl=1","width":1920,"height":1080,"caption":"What are Bitcoin Timelocks?"},{"@type":"BreadcrumbList","@id":"https:\/\/www.btse.com\/blog\/bitcoin-timelocks\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.btse.com\/blog\/"},{"@type":"ListItem","position":2,"name":"What are Bitcoin Timelocks?"}]},{"@type":"WebSite","@id":"https:\/\/www.btse.com\/blog\/#website","url":"https:\/\/www.btse.com\/blog\/","name":"BTSE Blog","description":"Navigating the Crypto Frontier - Insights, Analysis, and Strategies","publisher":{"@id":"https:\/\/www.btse.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.btse.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.btse.com\/blog\/#organization","name":"BTSE","url":"https:\/\/www.btse.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.btse.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.btse.com\/blog\/wp-content\/uploads\/2023\/03\/btse-logo.png","contentUrl":"https:\/\/www.btse.com\/blog\/wp-content\/uploads\/2023\/03\/btse-logo.png","width":1007,"height":306,"caption":"BTSE"},"image":{"@id":"https:\/\/www.btse.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/BTSE_Official","https:\/\/discord.com\/invite\/btse","https:\/\/www.linkedin.com\/company\/btsecom\/","https:\/\/t.me\/btsecom"]},{"@type":"Person","@id":"https:\/\/www.btse.com\/blog\/#\/schema\/person\/46ad80e1bffe6cf5d79938127822f2ca","name":"BTSE","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/dc01110861deb9c4a6b15c6c841e4457320749d7c005164340fbf8d4eacefc5d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/dc01110861deb9c4a6b15c6c841e4457320749d7c005164340fbf8d4eacefc5d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dc01110861deb9c4a6b15c6c841e4457320749d7c005164340fbf8d4eacefc5d?s=96&d=mm&r=g","caption":"BTSE"},"sameAs":["https:\/\/www.btse.com\/blog"],"url":"https:\/\/www.btse.com\/blog\/author\/btseadmin\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.btse.com\/blog\/wp-content\/uploads\/2023\/03\/f33f9f_aceb37bc770f417997737c41b993a5ce-mv2.png?fit=1920%2C1080&quality=75&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.btse.com\/blog\/wp-json\/wp\/v2\/posts\/1114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.btse.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.btse.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.btse.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.btse.com\/blog\/wp-json\/wp\/v2\/comments?post=1114"}],"version-history":[{"count":2,"href":"https:\/\/www.btse.com\/blog\/wp-json\/wp\/v2\/posts\/1114\/revisions"}],"predecessor-version":[{"id":5975,"href":"https:\/\/www.btse.com\/blog\/wp-json\/wp\/v2\/posts\/1114\/revisions\/5975"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.btse.com\/blog\/wp-json\/wp\/v2\/media\/5198"}],"wp:attachment":[{"href":"https:\/\/www.btse.com\/blog\/wp-json\/wp\/v2\/media?parent=1114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.btse.com\/blog\/wp-json\/wp\/v2\/categories?post=1114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.btse.com\/blog\/wp-json\/wp\/v2\/tags?post=1114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}