2

In tx library there is a function: serialize() that "serializes" your transaction object. You can then convert that serialization into hexa decimal string, and use it to send the transaction with the sendSignedTransaction() method.

My question is: what does serializing a transaction object mean? and why is it necessary to do this?

1

Serialization means that the message is packed in a byte stream, which properties (like encoding, byte ordering, etc.) are defined by a common protocol. This way you can ensure everybody can pack (serialize) the object into a byte-stream and send it to any participant who knows the protocol, whereupon the participant is able to properly unpack (deserialize) the byte stream into an object again. This was you can guarantee, that the object which was deserialized by one party is equal (in terms of information) to the object that was serialized by another party.

Check out https://ethereum.github.io/yellowpaper/paper.pdf Appendix B (and section 4.2.2 for block serialization) for more information. I also recommend checking out literature which explains in further detail why serialization is required in the first place

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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