question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BIP 112 Support (CSV)

See original GitHub issue

I notice that there is no explicit OP_CHECKSEQUENCEVERIFY support. While scripts using this operation can still be constructed by using OP_NOP3, I was wondering if there were any plans to add support and tests.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
afk11commented, Nov 11, 2017

This is not an easy task… All our templates to date are static in terms of the opcodes used. But CSV is an opcode that is never used by itself - it’s always with signature checks, hashlocks, etc. I would say our biggest blocker to this is having to pivot from static templates, to dynamic templates.

Eg:

[height] CSV DROP DUP HASH160 [hash] EQUALVERIFY CHECKSIG

This one is easy, and we could add a template… Moreso however, it should probably be two templates: CSV || P2PKH. But most usages of CSV actually are inside IF ELSE ENDIF branches such as this:

IF 
    [height] CSV DROP DUP HASH160 [hash] EQUALVERIFY CHECKSIG
ELSE
    2-of-2 CHECKMULTISIG
ENDIF

Here the first script is inside an IF branch… but what happens if we move the CSV part outside?

[height] CSV DROP
IF 
    DUP HASH160 [hash] EQUALVERIFY CHECKSIG
ELSE
    2-of-2 CHECKMULTISIG
ENDIF

Anyways, just generalizing here, this applies for CLTV, and others too, but it highlights the ground work needed… The actual code for “signing” or “verifying” CSV isn’t that much work - just check the txins sequence >= CSV stack value - but learning that your script has a CSV element, and forming a strategy for the whole script is harder 😃

Also, checking the signatures on such things is also a worthwhile question. We don’t check signatures in any way here, even for the static types (P2PK, P2PKH, multisig)… but if we start to deal with IF, CSV, CLTV, etc… we really need to look at writing a script interpreter, since it can also verify signatures for scripts we don’t know how to sign!

This comment turned out longer than expected, but overall the thesis is: Undestanding a scripts requirements for signing is always the hardest part. It’s easier when the scripts can be considered atomic such as the cases we support now, but in principle what we’re talking about here is scripts with multiple stages, and potentially multiple branches also.

It’s definitely something I see bitcoinjs working towards in the future, because otherwise for LN, etc, we’d be forced to write our own hacky template checking, and use sighash operations in userland code, etc… and really I think the value in a library like bitcoinjs is preventing unsafe usage, not encouraging people to do that second option 😃

0reactions
dcousenscommented, Dec 1, 2017
Read more comments on GitHub >

github_iconTop Results From Across the Web

[bitcoin-dev] New Soft Fork Deployment: CSV (BIP's 68, 112 ...
This deployment is being referred to as CSV (CheckSequenceVerify) and will activate the following 3 BIPS as consensus rules: BIP 68 ...
Read more >
Data Modeling Guide for Oracle Business Intelligence Publisher
New Features and Changes for Oracle BI Publisher 12c (12.2.1.1.0) ... About Supported CSV Files. 2-44. Creating a Data Set from a Centrally...
Read more >
BIP112(CHECKSEQUENCEVERIFY)
BIP : 112 Layer: Consensus (soft fork) Title: CHECKSEQUENCEVERIFY ... 4-byte scriptNum would only support up to a maximum of // 2^31-1.
Read more >
Timelock - Bitcoin Wiki
CLTV is currently used in CLTV-style payment channels and Time-Locked fidelity bonds. Relative locktime. In mid-2016, the BIP 0068/112/113 soft ...
Read more >
Load and Query CSV File in S3 with Presto | by Yifeng Jiang
The dataset has 112 million rows, 17 columns each row in CSV format. ... CSV format table currently only supports VARCHAR data type....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found