Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cameronalemon opened this issue Dec 5, 2024 · 0 comments

Comments

@cameronalemon
Copy link

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)
@cameronalemon cameronalemon reopened this Dec 5, 2024
@Python-Cardano Python-Cardano deleted a comment Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant