Back to course

Serialization with Serde

Rust for Systems & Web3 Security

Converting Data to Bytes

Serde is the de-facto standard for serializing and deserializing Rust data structures to JSON, Bincode, or TOML. In Web3, converting data to a binary format for storage on-chain is mandatory.

rust #[derive(Serialize, Deserialize)] struct Transaction { amount: u64, }