TransWikia.com

Bitcoin script verification fails after certain time period

Bitcoin Asked by Subhra Mazumdar on December 4, 2021

So I want to write a bitcoin script so that after a certain time period (say for example after 30 mins), the verification fails and transaction is marked invalid even if it gets broadcasted. Time locks are used so that a transaction is considered valid after a certain time period. I want the opposite to happen. So can I just enter some bogus lines of code after OP_CHECKLOCKTIMEVERIFY so that script check intentionally fails? Or is there any opcode by which I can achieve the same functionality?

One Answer

This isn't possible with a single bitcoin sript, but your example can be realized quite easily by simply adding one more transaction to the equation:

So the premise is that given an input, it can be spent by either party A or party B. The restriction is that party B must spend it within the 1st 30 mins else after that A must spend it.

  • Party A and party B cooperate to create a 1-of-2 multisig address, and then have coins sent to it
  • After 30 minutes, party A will create a second transaction which pays the coins to an address that only party A controls
  • Now party A can spend the coins, party B cannot

This depends on party A publishing the second transaction, but that step could also be automated and happen during the initial setup of the multisig address. The second transaction could even have a timelock added, such that it could not be published early (though party A can otherwise spend the coins at any time, so this seems unnecessary).

Otherwise, as mentioned in the comments, this sort of construction isn't possible using bitcoin script alone.

Answered by chytrik on December 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP