1

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

FUNDING

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

SPENDING

02000000010d308b5d72899e4fc7d541ca62d1203fa41c3c80e858fcc4e3f6fef6c4628431000000008b483045022100f995ccfb8ce2bda36c4ec0f37f067ee6c87c58043155b3a583da201ffaaa4db50220794d23e402b3f0a9579ab9bb8fbb573eba8cffed27542c162b629aa0f914b10d01210292dbb331c39d84611fbaa8e225d781ec50c2ed21fbf311bfeb869042f4b3e1781f03010040b27576a91451d2a5e04d25ceaa86e600a6ec34bd24431c675d88ac0100400001d40c0600000000001976a91451d2a5e04d25ceaa86e600a6ec34bd24431c675d88ac00000000

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

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, privacy policy and cookie policy

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