Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node verification does not works #1

Open
max-lt opened this issue Jul 5, 2018 · 3 comments
Open

Node verification does not works #1

max-lt opened this issue Jul 5, 2018 · 3 comments

Comments

@max-lt
Copy link

max-lt commented Jul 5, 2018

The library produces invalid OTS proofs when the chanpoint refers to a segwit transaction.
This is due to the verify function that gets different results wether the rawTx data came from liteVerify or nodeVerify: a nodeVerfy may return a raw segwit transaction that is different than the insight explorer one, so the OpenTimestamps verifier says that it is an invalid OTS proof.

Here is the chainpoint:

{
  "targetHash": "cc89adf93d293479f085080d035a739cb5520e63c31b698520baa956b56241ab",
  "merkleRoot": "bf40e8e0e946af2851ae8bd94ef11d3280a97aff0408b37084e879b92ad44e21",
  "proof": [
    { "right": "701b23e1b207b82980185354dc9afd5449501acadf7d9faffb149e9100af17ab" },
    { "left": "13adf09da8a9667f276360d69815a3e8dcd3088b5034c04106ef74399f93b2c0" },
    { "right": "427ca37e5438a45c6a7af6b004d744a8c8608c16d00de2a5d8861f917d5b1515" },
    { "right": "b08cc17b1137b05ca2a70d8204dbdd83d56f69440f64a68837b6778812d0ef6d" },
    { "right": "5a8948ba06335fc6a0d650e4fc760d84e8e40d616f4c8694a03b488a8e639f9f" },
    { "left": "4e9fb5d7136303405a9a30cb147e798b83531ec75fff777a1c5bd916b8e477ea" },
    { "left": "f8ec7a6aeea44899f820ef5f08fee83496db1723a45aeb2f64ab76197c2b4b77" },
    { "right": "f3077457dba2454dc6506dbf377e59c7a88ff6a13a0a41b32a5191eb5652d263" },
    { "left": "9a98869a24cc8c467a884e83d93722193a5f81bf71e3ff42b345087c635c244e" }
  ],
  "anchors": [
    {
    "sourceId": "be87093799962404abed7c467046e6d909d99233d9a5610b6be0e246c0e6b0d6",
    "type": "BTCOpReturn"
    }
  ],
  "type": "ChainpointSHA256v2",
  "@context": "https://w3id.org/chainpoint/v2"
}

Corresponding segwit raw tx:

02000000000101f4f32b7ec23765f4b749ab01c9518bbf9fdd8f76c8a342
eb9cc5e9e175574299010000001716001483ab19460fbf73c488abbfa386
fe0758ddd6db0bffffffff020000000000000000226a20bf40e8e0e946af
2851ae8bd94ef11d3280a97aff0408b37084e879b92ad44e211006110100
00000017a914142fb26b30972949930229acb3366fb8f596861287024830
45022100bbf0108863f6da80f96af3b0245d6ddb291b8d0235aabf9ff5c0
9524202ef8a602201af7c4ea71a74d06e0c5dc5d17723da858c6c044a041
89bc7e9fd6f27afe4bae01210285485df305a5cced49200af1ff9b2f2b33
f4ed5e9eaaab60c2ed9d43bf4f5ed700000000

Corresponding Insight / Witnessless tx:

0200000001f4f32b7ec23765f4b749ab01c9518bbf9fdd8f76c8a342eb9c
c5e9e175574299010000001716001483ab19460fbf73c488abbfa386fe07
58ddd6db0bffffffff020000000000000000226a20bf40e8e0e946af2851
ae8bd94ef11d3280a97aff0408b37084e879b92ad44e2110061101000000
0017a914142fb26b30972949930229acb3366fb8f59686128700000000
@petertodd
Copy link
Member

Yeah, since Chainpoint is using OP_RETURN, we should be using the non-witness-serialized versions of the transactions throughout.

@RCasatta
Copy link
Member

The converter take the tx hex directly from the node, one option is to launch the bitcoin node with the flag -rpcserialversion this way all hex returned are witnessless.
The other option is to parse the transaction from the converter and serialize it without the witness, which require some sort of bitcoin lib (the opentimestamp-server works in this way)

@max-lt
Copy link
Author

max-lt commented Jul 10, 2018

Yeah, for now we use bcoin to reserialize transaction without witness. But it's a bit like using a sledgehammer to crack a nut.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants