Skip to content

Unable to recover signature from unsigned_cbor when RawPlutusData in output #402

Open
@cameronalemon

Description

@cameronalemon

I am checking that I can sign a transaction using pycardano based on the unsigned cbor from the eternl wallet (which can be downloaded just before signing any transaction). I have successfully done this for a simple ADA transfer to my own wallet, but cannot get the right signature for some DEX transaction.

Everything matches between my attempt to sign the transaction and the equivalent submitted transaction signed using the eternl wallet and then the hash is downloaded via the tx id, except for the signature.

I am using the mnemonic to get the wallet extended signing keys and verification keys using HDWallet.from_mnemonic(mnem)

from pycardano import HDWallet, PaymentExtendedVerificationKey, ExtendedSigningKey, BlockFrostChainContext, Network, VerificationKeyWitness, Transaction

blockfrost_api_key = 'mainnet... '
context = BlockFrostChainContext(blockfrost_api_key, network=Network.MAINNET)

mnem = 'attitude inherit ... ' #24 words
wallet = HDWallet.from_mnemonic(mnem)

payment = wallet.derive_from_path("m/1852'/1815'/0'/0/0")
sk = ExtendedSigningKey.from_hdwallet(payment)
vk = PaymentExtendedVerificationKey.from_signing_key(p_skey)

#download the unsigned cbor hex from eternl just before signing
unsigned_cbor_hex = '84a400...'
unsigned_tx = Transaction.from_cbor(unsigned_cbor_hex)

signature = sk.sign(unsigned_tx.transaction_body.hash())
vk_witnesses = [VerificationKeyWitness(vk, signature)]
signed_tx = Transaction(unsigned_tx.transaction_body, TransactionWitnessSet(vkey_witnesses=vk_witnesses), auxiliary_data=unsigned_tx.auxiliary_data)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions