Git Product home page Git Product logo

Comments (9)

richardkiss avatar richardkiss commented on July 24, 2024

There is a method in pycoin/services/bitcoind.py called "bitcoind_agrees_on_transaction_validity" that is useful for checking agreement of bitcoind and pycoin that you might find useful.

There is a bug in pycoin that causes some (but not all) multisig transactions to not validate when they should. I have a test case which currently fails, so I just need to track down what's wrong. I think it's a problem in my implementation of OP_CHECKMULTISIG.

You should be able to partially sign with just one key. I seem to remember that I have a test case that does this...

from pycoin.

gitmarek avatar gitmarek commented on July 24, 2024

That test case is in tests/pay_to_test.py, in test_multisig_one_at_a_time().
Looks like a great starting point to learn pycoin tx internals, thanks. I shall rewrite my gist as test case,
checking if Gavin's transaction signature is ok and than trying to recreate it from scratch.

That problem in the implementation of OP_CHECKMULTISIG, do you think it is in
tx/script/vm.py, or deeper in ecdsa.possible_public_pairs_for_signature()? In other words,
do you think eval_script() reads bad data from script and feeds it into possible_public_pairs_for_signature() or the signature_hash and sig_pair are correct?

from pycoin.

richardkiss avatar richardkiss commented on July 24, 2024

My gut feeling is that the problem is possible_public_pairs_for_signature. A prior implementation of OP_CHECKMULTISIG did the naïve thing of trying every signature with every public pair... that one probably worked (although it predated the test that now fails).

from pycoin.

gitmarek avatar gitmarek commented on July 24, 2024

I changed the implementation of OP_CHECKMULTISIG to the earlier version
and unfortunately the tx_test.py still fails at the same point.
(You can see what code I actually run the test against at 9e519b4)

from pycoin.

gitmarek avatar gitmarek commented on July 24, 2024

The transaction couldn't be validated because signature_hash in vm.py is wrong!
If I put the correct signature_hash, the transaction validates.
(Actually, I force the correct script into signature_for_hash_type_f.)
Please, checkout: 689e067, and run tests/ga_multisig_test.py.

from pycoin.

gitmarek avatar gitmarek commented on July 24, 2024

I came up with the solution: PR #73.
What do you think?

from pycoin.

gitmarek avatar gitmarek commented on July 24, 2024

Unfortunately, now pay_to_test.py fails.
I think that's because Tx.sign_tx_in() does not handle P2SH input correctly. I took care of it in 6a365a8

from pycoin.

ysobolev avatar ysobolev commented on July 24, 2024

@gitmarek I can confirm your fix works. Pycoin now correctly signs multisig transactions.

from pycoin.

richardkiss avatar richardkiss commented on July 24, 2024

Merged (squashed) in 9333471

from pycoin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.