<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://en.zaoniao.it/index.php?action=history&amp;feed=atom&amp;title=Timelock</id>
	<title>Timelock - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://en.zaoniao.it/index.php?action=history&amp;feed=atom&amp;title=Timelock"/>
	<link rel="alternate" type="text/html" href="http://en.zaoniao.it/index.php?title=Timelock&amp;action=history"/>
	<updated>2026-05-15T08:01:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.32.0</generator>
	<entry>
		<id>http://en.zaoniao.it/index.php?title=Timelock&amp;diff=7214&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;{{#seo: |title= Timelock. All about cryptocurrency - zaoniaoWiki |keywords=blockchain projects, timelock, smart contract, hashed, contract |description=Timelock is a type of s...&quot;</title>
		<link rel="alternate" type="text/html" href="http://en.zaoniao.it/index.php?title=Timelock&amp;diff=7214&amp;oldid=prev"/>
		<updated>2019-07-27T06:55:00Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{#seo: |title= Timelock. All about cryptocurrency - zaoniaoWiki |keywords=blockchain projects, timelock, smart contract, hashed, contract |description=Timelock is a type of s...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{#seo:&lt;br /&gt;
|title= Timelock. All about cryptocurrency - zaoniaoWiki&lt;br /&gt;
|keywords=blockchain projects, timelock, smart contract, hashed, contract&lt;br /&gt;
|description=Timelock is a type of smart contract primitive that restricts the spending of some bitcoins until a specified future time or block height. Timelocks feature prominently in many Bitcoin smart contracts, including payment channels and hashed timelock contracts.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[File:timelock.png|430px|right|Timelock smart contract scheme]]&lt;br /&gt;
A '''Timelock''' is a type of smart contract primitive that restricts the spending of some bitcoins until a specified future time or block height. Timelocks feature prominently in many Bitcoin [[Smart contract|smart contracts]], including [[payment channels]] and [[Hashed Timelock Contracts|hashed timelock contracts]]. It can also be used to lock-up bitcoins held as an investment for a period of months or years. Time lock is also used to make fee sniping less profitable.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
{{#ev:youtube|v2Gz6d-xaVU|500|right|TimeLock + What are payment channels? (eg. the Lightning Network)}}&lt;br /&gt;
=== nLockTime ===&lt;br /&gt;
A part of the original Bitcoin implementation, [[nLockTime]] is a field that specifies the earliest time a transaction may be added to a valid block. A later Bitcoin soft fork allowed nLockTime to alternatively specify the lowest block height a transaction may be added to a valid block.&lt;br /&gt;
&lt;br /&gt;
Although every transaction contains the nLockTime field, every wallet up until recently set nLockTime to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;, meaning the transaction was valid in any block. Starting with [[Bitcoin Core]] 0.11.0, every normal transaction automatically generated by began including an nLockTime set to a recent block height as a way to make hypothesized fee sniping less profitable&amp;lt;ref name=&amp;quot;anti_fee_sniping&amp;quot;/&amp;gt;; other wallets are recommended to do the same.&lt;br /&gt;
&lt;br /&gt;
=== CheckLockTimeVerify ===&lt;br /&gt;
In late 2015, the BIP65 soft fork&amp;lt;ref name=&amp;quot;bip65&amp;quot;/&amp;gt; redefined the NOP2 opcode as the CheckLockTimeVerify (CLTV) opcode, allowing transaction outputs (rather than whole transactions) to be encumbered by a timelock. When the CLTV opcode is called, it will cause the script to fail unless the nLockTime on the transaction is equal to or greater than the time parameter provided to the CLTV opcode. Since a transaction may only be included in a valid block if its nLockTime is in the past, this ensures the CLTV-based timelock has expired before the transaction may be included in a valid block. CLTV is currently used in CLTV-style payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Relative locktime ===&lt;br /&gt;
In mid-2016, the BIP68/112/113 soft fork gave [[consensus]]-enforced meaning to some values in the nSequence field&amp;lt;ref name=&amp;quot;bip68&amp;quot;/&amp;gt; that is a part of every transaction input, creating a &amp;quot;relative locktime&amp;quot;. This allowed an input to specify the earliest time it can be added to a block based on how long ago the output being spent by that input was included in a block on the blockchain.&lt;br /&gt;
&lt;br /&gt;
=== CheckSequenceVerify ===&lt;br /&gt;
Also part of the BIP68/112/113 soft fork was the CheckSequenceVerify opcode&amp;lt;ref name=&amp;quot;bip112&amp;quot;/&amp;gt;, which provides for relative locktime the same feature CLTV provides for absolute locktime. When the CSV opcode is called, it will cause the script to fail unless the nSequence on the transaction indicates an equal or greater amount of relative locktime has passed than the parameter provided to the CSV opcode. Since an input may only be included in a valid block if its relative locktime is expired, this ensures the CSV-based timelock has expired before the transaction may be included in a valid block.&lt;br /&gt;
&lt;br /&gt;
CSV is used by [[Lightning Network]] transactions.&lt;br /&gt;
&lt;br /&gt;
== Far-future locks ==&lt;br /&gt;
It is not advised to lock up bitcoins into the far future because it takes on risk of the bitcoin network changing. For example, if there were an [[ECDSA]] or [[RIPEMD-160]] algorithm break that made any coins spendable with a few months of CPU time, the network might need to to prohibit moving old unspent coins after some transition, but long locktimed coins could not make such a transition.&lt;br /&gt;
&lt;br /&gt;
OP_CheckSequenceVerify allows locking for at most 65535 blocks (about 455 days) or for at most 65535*512 seconds (about 388 days). OP_CheckLockTimeVerify could be used to lock up coins for several centuries.&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* [https://en.bitcoin.it/wiki/Timelock https://en.bitcoin.it/wiki/Timelock]&lt;br /&gt;
* [https://coinb.in/#newTimeLocked coinb.in's time-locked page] javascript page for creating time-locked bitcoin wallets.&lt;br /&gt;
* [https://www.reddit.com/r/Bitcoin/comments/4p4klg/bitcoin_core_project_the_csv_soft_fork_has/d4i01he/ Reddit discussion of the possible uses OP_CHECKSEQUENCEVERIFY]&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Satoshi Nakamoto]]&lt;br /&gt;
* [[Cryptonote]]&lt;br /&gt;
* [[Mt. Gox]]&lt;br /&gt;
* [[OmiseGo]]&lt;br /&gt;
* [[Multisignature]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bip65&amp;quot;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65: OP_CHECKLOCKTIMEVERIFY] Peter Todd Retrieved 2016-04-12&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bip68&amp;quot;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki BIP68: Relative lock-time using consensus-enforced sequence numbers] Mark Friedenbach, BtcDrak, Nicolas Dorier, and kinoshitajona Retrieved 2016-04-12&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bip112&amp;quot;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki BIP112: CHECKSEQUENCEVERIFY] BtcDrak, Mark Friedenbach, Eric Lombrozo Retrieved 2016-04-12&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;anti_fee_sniping&amp;quot;&amp;gt;[https://bitcoin.org/en/release/v0.11.0 Bitcoin Core 0.11.0 release notes] Bitcoin.org Retrieved 2016-11-06&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;br /&gt;
[[Category:Smart contracts]]&lt;br /&gt;
[[Category:Bitcoin]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
		
	</entry>
</feed>