How to sign a transaction FROM delegate address

Hi. How can I sign a transaction where I want to send ADA from a delegate address. I would like to implement this signature in python, using PyNaCl.

I find a the following example on cardanoupdates:

# Sign
# You need 2 signing keys
# 1. the `payment.skey` for wittness the input and
# 2. the `stake.skey` for signing the delegation certificate.
cardano-cli shelley transaction sign \
    --tx-body-file delegation.raw \
    --signing-key-file stake.skey \
    --signing-key-file payment.skey \
    --mainnet \
    --out-file delegation.signed

As I can see, there are two signing-key-file param in Cardano-cli. How can I reproduce it in my code?

My guess to sign it two times? First with stake key and after the payment key? So something like this:

        signatures = []
        signkey = SigningKey(priv_12[64:], encoder=HexEncoder)
        stakekey = SigningKey(stake_12[64:], encoder=HexEncoder)
        hexbytes = payloads['payloads'][0]['hex_bytes']
        staked = stakekey.sign(bytes.fromhex(hexbytes))
        signed = signkey.sign(staked)
                          "edwards25519", signed.signature.hex(), "ed25519"))

But the resulted signature is invalid:

Shelley command failed: transaction submit Error: Error while submitting tx: ApplyTxError [LedgerFailure (UtxowFailure (UtxoFailure (FeeTooSmallUTxO (Coin 165237) (Coin 165061)))),LedgerFailure (UtxowFailure (UtxoFailure (OutputTooSmallUTxO [(Addr Mainnet (KeyHashObj (KeyHash \“6f75117a842adaff350b79d79dee63711ffd58b7aeec5b785557f770\”)) (StakeRefBase (KeyHashObj (KeyHash \“c5774fc05fc1e8f6f6f86067059348ae4527399681645364502a1adf\”))),Value 834939 (fromList ))]))),LedgerFailure (UtxowFailure (InvalidWitnessesUTXOW…

1 Like


Still this is a question or you already find it out…