Example #1
0
def multi_sign(txData, privtKey1, privtKey2, verificationScript):
    signature1 = privtkey_sign(txData, privtKey1)
    signature2 = privtkey_sign(txData, privtKey2)
    invoke_script = int_to_hex(len(signature1) / 2) + signature1 + int_to_hex(
        len(signature2) / 2) + signature2

    txData += "01"  #witness length
    txData += int_to_hex(len(invoke_script) / 2)
    txData += invoke_script
    txData += int_to_hex(len(verificationScript) / 2)
    txData += verificationScript
    raw_data = txData
    return raw_data
Example #2
0
def auto_transfer(addressFrom, addressTo, value, assetId, privtKey):
    res = createTx(addressFrom, addressTo, value, assetId)
    tx_data = res.get("txData")
    tx_id = res.get("txid")
    signature = privtkey_sign(tx_data, privtKey)
    publicKey = privtKey_to_publicKey(privtKey)
    raw_data = tx_data + "01" + "41" + "40" + signature + "23" + "21" + publicKey + "ac"
    return tx_id, send_raw_tx(raw_data)
Example #3
0
def sign_and_broadcast(txData, privtKey):
    signature = privtkey_sign(txData, privtKey)
    pubkey = privtKey_to_publicKey(privtKey)
    raw_tx = construct_raw_tx(txData, signature, pubkey)
    return send_raw_tx(raw_tx)
Example #4
0
def sign(txData, privtKey):
    signature = privtkey_sign(txData, privtKey)

    return signature