1

I want to use the "Submit a transaction" method in Blockfrost but it needs an already serialized transaction. Does anybody know how to serialize a transaction in python? (I don't wanna use CLI or anything like that)

2
  • Sadly there isn't an easy way of doing this in Python yet, since the [serialization library][1] is written in Rust with WASM wrappers. At the moment your best bet is to use Javascript/TypeScript in Node, or use pure Rust, or if you're feeling adventurous it is possible to execute rust functions from a Python code base. It just requires a bit of work, [see here.][2] [1]: github.com/Emurgo/cardano-serialization-lib [2]: vortexa.com/insight/integrating-rust-into-python
    – Thom
    Commented Dec 4, 2021 at 15:10
  • It is also be possible to construct and sign a transaction using cardano-cli. Quickly searching for a python wrapper I've found github.com/creativequotient/automint
    – sorki
    Commented Dec 6, 2021 at 13:24

1 Answer 1

2

Good news, there is a python implementation available! https://github.com/cffls/pycardano

I haven't used it myself but the Readme claims this library is able to build and sign transactions. It even comes with an example for exactly this purpose: https://github.com/cffls/pycardano#transaction-creation-and-signing

2
  • That was a lifesaver. Thanks, man!
    – Foad
    Commented Apr 21, 2022 at 10:43
  • Can it compile Plutus. I looked at the docs but I am too new to this whole thing to even be able to tell. I just want to programmatically generate simple scripts.
    – Sam Gralla
    Commented Apr 29, 2022 at 5:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.