src/transactions/structs.rs
#[derive(Debug, Serialize, Deserialize)]
pub struct Torrent {
pub info: Info,
#[serde(rename = "created by")]
pub created_by: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Info {
pub length: u64,
pub name: String,
pub difficulty: u64,
pub block_hash: String,
#[serde(rename = "piece length")]
pub piece_length: u64,
pub info_hash: String,
pub pieces: Vec<std::collections::HashMap<u8, String>>,
}
Example Torrent File:
{
"info": {
"length": 129,
"name": "0.clc",
"difficulty": 0,
"block_hash": "a8ee2beb07b9a275facfe7479d8afacec282b69ec6af49755ed774993163008e",
"piece length": 100,
"info_hash": "15bf452209276528b3180e21b404c96a5649e9d40c91b7d04b6374b3dc8058b7",
"pieces": [
{"1": "84aa1eb51a86803b072243d6ac4c577695e35eaf1cb4874b963aaeb7525b52e8"},
{"2": "9da536e40d9025bb244ba7fd970601e2a87858666b1328556b343c28555b251d"}
]
},
"created by": "Contractless Blockchain"
}