Created
January 28, 2025 11:08
-
-
Save tdimitrov/89b3faa9d062b6d0bd6e997bd8fc8506 to your computer and use it in GitHub Desktop.
Scale encode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "parity-scale-playground" | |
version = "0.1.0" | |
edition = "2021" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
hex = "0.4" | |
parity-scale-codec = { git = "https://github.com/paritytech/parity-scale-codec" } | |
parity-scale-codec-derive = { git = "https://github.com/paritytech/parity-scale-codec" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use parity_scale_codec::Decode; | |
use parity_scale_codec::Encode; | |
use parity_scale_codec_derive::Decode; | |
use parity_scale_codec_derive::Encode; | |
fn main() { | |
let input = "52bc71c1eca5353749542dfdf0af97bf764f9c2f44e860cd485f1cd86400f649"; | |
let data: Vec<u32> = vec![1, 0, 1, 0, 1, 1, 1, 1, 1]; | |
let encoded = data.encode(); | |
println!("{}", hex::encode(&data)); | |
// #[derive(Encode, Decode)] | |
// pub struct AccountId32([u8; 32]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment