比特币学习-Transaction的locktime属性

Locktime, also known as nLockTime from the variable name used in the reference client, defines the earliest time that a transaction is valid and can be relayed on the network or added to the block chain. It is set to zero in most transactions to indicate immediate propagation and execution. If locktime is nonzero and below 500 million, it is interpreted as a block height, meaning the transaction is not valid and is not relayed or included in the blockchain prior to the specified block height. If it is above 500 million, it is interpreted as a Unix Epoch timestamp (seconds since Jan-1-1970) and the transaction is not valid prior to the specified time. Transactions with locktime specifying a future block or time must be held by the originating system and transmitted to the bitcoin network only after they become valid. The use of locktime is equivalent to postdating a paper check. 

Locktime, 也被称为nLockTime, 它定义了个最早时间,只有过了这个最早时间,这个transaction可以被发送到比特币网络。通常被设置为0,表示transaction一创建好就马上发送到比特币网络。如果nLocktime的时间在1到5亿之间,则表示该transaction只会被添加到区块高度大于或等于nLocktime的区块中去。如果nLocktime的值超过5亿,则表示从1970年01月01日开始算,加上nLocktime 秒之后的一个时间点,如果transaction被创建的时间早于那个时间点,则该transaction不会被发送到比特币网路。带locktime的transaction,指明了transactions在未来的一个区块或者未来的一个时间点,才会被验证并发送到比特币网络上去。……

原文地址:https://www.cnblogs.com/x-poior/p/10142889.html