Create and Sign Bitcoin Transaction?

I hate asking for help in this manner, but am frustrated beyond belief now. Does anyone have any example code of how to create and sign a bitcoin transaction in Rust? I don't care which crate, I just need it to work.

Don't get me wrong, I know the bitcoin protocol inside and out, and have developed my own wallet software that creates and signs raw transactions before, but only in PHP. However, I already know me trying to sign a raw tx with the ECDSA secp256k1 curve is also going to be a headache, so would rather just get some crate to do that for me. However, can't seem to find any decent example code on the internet, and Chat GPT is useless when it comes to questions like that.

Is my best bet just to use "createrawtransaction" commany of bitcoin-cli via RPC? I would prefer not to go that route though, and simply want to create and sign a raw tx in Rust. Done this many times in both, Python and PHP but struggling in Rust for some reason.

For example, take previous input of:
TxID: 2350549a3661ff19323bed82c2ffd578fdee9de6982389f17f3612cb553f517c
Vout: 0
Amount: 0.052

And simply send it all, minus fees to: mq2vj6BtNuMyHiniiAGRkWBMXM1s5sfdpN

With the private key: cPf4eE7eFY6XWyQ8YnSaZ7cdcikx5tdqSbdNkpCUrT4jRQz8r6c9

How do I do that in Rust? Any help would be greatly appreciated, as I'm about ready to throw my laptop out the window.

No one sneaks a cross-post in without me noticing :smile:

(please add them to your question to avoid duplicated effort)

I apologize if I accidentally cross posted. I'm blind, everything is
audio based for me, and that form isn't the most accessible.


1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.