Sign transaction out wallet I am trying to develop a program which can create a transaction from scratch and use a private key to sign it. The idea behind is an open wallet where users each has its own private key and the wallet prepare the transaction (amount, destination..) and the user sign it before the open wallet send it.

Thank you
Depending on the language you are using, there are several libraries you can use to sign a pre-made raw transaction.

I use Python, so one that I found quite intuitive and easy to use is the old vButerin's Bitcoin tools. The code is no longer supported, but it could be helpful.

Moreover, I've personally developed some tools to help people understand how Bitcoin transactions are created, what are their parts in the transaction serialization and how can they be created from scratch. There are publicly available on GitHub also. The library is intended to teach, so maybe you could use the comments to understand how to do what you asked.