Skip to content

Instantly share code, notes, and snippets.

@tdimitrov
Created January 28, 2025 11:08
Show Gist options
  • Save tdimitrov/89b3faa9d062b6d0bd6e997bd8fc8506 to your computer and use it in GitHub Desktop.
Save tdimitrov/89b3faa9d062b6d0bd6e997bd8fc8506 to your computer and use it in GitHub Desktop.
Scale encode
[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" }
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