I'm writing an offline signature program without rpc,i have to encode transaction into bytes and I want to know the encoding rules.

What should the tag parameter fill in?
Under what circumstances do parameters need to be used?If I don't use it, do I need a placeholder?
What order to use?BIG_ENDIAN or LITTLE_ENDIAN?
In short, I want to know how I can generate bytes that can be signed.
My English is not very good, I hope you can understand what I express.

Browse other questions tagged or ask your own question.