i have trouble in using op_csv. The spending condition is not match to my expectation.


Redeem Script Hex: 03010040b27576a91451d2a5e04d25ceaa86e600a6ec34bd24431c675d88ac Redeem Script Asm: 03<010040> OP_CHECKSEQUENCEVERIFY OP_DROP OP_DUP OP_HASH160 14<51d2a5e04d25ceaa86e600a6ec34bd24431c675d> OP_EQUALVERIFY OP_CHECKSIG

P2SH base85 address: 2NFRizqW8XpNQm7nxYvFpYTvYsy3BqgsEx2 (bitcoin testnet3)

Based on my mentioned redeem script, i set time parameter as 1 along with OP_CHECKSEQUENCEVERIFY. Now my expectation is once blockchain confirms this TX, supposedly, miner will accept my spending TX after 512 seconds.

here is my funding tx https://testnet.smartbit.com.au/tx/318462c4f6fef6e3c4fc58e8803c1ca43f20d162ca41d5c74f9e89725d8b300d



i set this TX's version as 2 and input's nsequence as 03010040. Now, i am waiting for blockchain to confirm my funding tx. Not so long, my funding tx was confirmed with date 2019-11-24T10:46:05Z. Now, I expect that 2019-11-24T10:46:05Z + 512 seconds = 2019-11-24 10:54:37 is time miner will accept my spending tx. As the result once my funding TX has been confirmed then i can spend immediately without any relative time restriction. ANYONE know what is happening?

here is my spending tx https://testnet.smartbit.com.au/tx/a68a821e06c1156d5fe80f3662c941142ed2ce1a57e597ce05bf167bce21fe2d

P/S: i further test by changing time parameter in redeem script from 1 to 4 and 5, then the result is slightly match to my expectation.

1 Answer 1


i manage to find answer for myself.

OP_CSV date consensus is based on median time past (mtp), not block's confirmed date.

once funding tx above has been confirmed, it is located in block#1609592 with block MTP is 2019-11-24 09:05:26 (UTC 0). At same time, chain's MTP is 2019-11-24 09:25:27 (UTC 0)

now come to spending tx, since utxo's confirmed date i used is 2019-11-24 09:05:26, plus 512 seconds = 2019-11-24 09:13:58. Therefore i can spend immediately as chain's MTP is more than 2019-11-24 09:13:58.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.