How to use the secp256k1.lib function in secp256k1

To help you get started, we’ve selected a few secp256k1 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JoinMarket-Org / joinmarket / bitcoin / podle.py View on Github external
def tweak_mul(point, scalar):
    """Temporary hack because Windows binding had a bug in tweak_mul.
    Can be removed when Windows binding is updated.
    """
    return secp256k1._tweak_public(point,
                                   secp256k1.lib.secp256k1_ec_pubkey_tweak_mul,
                                   scalar)
class PoDLEError(Exception):
github JoinMarket-Org / joinmarket / bitcoin / secp256k1_main.py View on Github external
def multiply(s, pub, usehex, rawpub=True):
    '''Input binary compressed pubkey P(33 bytes)
    and scalar s(32 bytes), return s*P.
    The return value is a binary compressed public key.
    Note that the called function does the type checking
    of the scalar s.
    ('raw' options passed in)
    '''
    newpub = secp256k1.PublicKey(pub, raw=rawpub, ctx=ctx)
    #see note to "tweak_mul" function in podle.py
    res = secp256k1._tweak_public(newpub,
                                   secp256k1.lib.secp256k1_ec_pubkey_tweak_mul,
                                   s)
    return res.serialize()