Git Product home page Git Product logo

Comments (7)

richardkiss avatar richardkiss commented on July 24, 2024

I agree that there should be a standard placeholder, but my gut feeling has been to put a 0000...0 signature the same length of a standard signature. This way, a partially signed transaction is exactly the same length as the final transaction, which makes it a bit easier to calculate the required transaction fees. I think this is better than OP_0 even though it doesn't match the defacto "standard" that others have adopted. What do you think?

from pycoin.

ysobolev avatar ysobolev commented on July 24, 2024

Well, you have an excellent point about fees. By the way, right now, the signature is not all zeros. Anyway, if you want to try to champion another standard, I support that. I agree, OP_0 is not exactly the best placeholder. However, if the majority of users settle on OP_0, that is what you should go with.

from pycoin.

sserrano44 avatar sserrano44 commented on July 24, 2024

I had this same issue trying the cryptocorp api and had to monkey patch pycoin to make it work

from pycoin.

richardkiss avatar richardkiss commented on July 24, 2024

Sebastian, can I take a look at your patch?

from pycoin.

ysobolev avatar ysobolev commented on July 24, 2024

If using 0.53 from GitHub, then the following code works well:
ScriptMultisig._dummy_signature = lambda x, y: "\x00"
If using 0.52, there appears to be a bug and ScriptMultisig.solve needs a rewrite.

from pycoin.

sserrano44 avatar sserrano44 commented on July 24, 2024

We endup fixing the input and redeem script

from pycoin.ecdsa import generator_secp256k1
from pycoin.serialize import b2h, stream_to_bytes
from pycoin.key.BIP32Node import BIP32Node
from pycoin.tx.pay_to import ScriptMultisig
from pycoin.tx.script.tools import *
from pycoin.tx.script import der

def dummy_signature(sig_type):
    order = generator_secp256k1.order()
    r, s = order - 1, order // 2
    return der.sigencode_der(r, s) + bytes_from_int(sig_type)

def fix_input_script(inp, redeem_script):
    """replace dummy signatures with OP_0 and add redeem script for digitaloracle compatibility"""
    dummy = b2h(dummy_signature(1))
    ops1 = []
    for op in opcode_list(inp.script):
        if op == dummy:
            op = 'OP_0'
        ops1.append(op)
    # FIXME hack to add redeem script omitted by pycoin
    ops1.append(b2h(redeem_script))
    inp.script = compile(' '.join(ops1))

from pycoin.

richardkiss avatar richardkiss commented on July 24, 2024

As of d09b5e0, you should be able to pass in
signature_placeholder=OP_0 as a kwarg to Tx.sign to use OP_0 as your placeholder.

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.