I am running the substrate-dev node. Made a transaction using Polkadot-explorer. After fetching the block using subxt I am getting extrinsic hex as:


I want to convert this hex into a readable form in Rust.

  • 1
    Just to say, Subxt doesn't currently support decoding blocks into anything useful, but it's next up on the roadmap and should be out by the end of Jan 2023, all being well!
    – jsdw
    Nov 5, 2022 at 22:02

1 Answer 1


You need to confirm the Type first.


use parity_scale_codec::Decode;

#[derive(Debug, Decode)]
struct MockExtrinsicType { .. }

let extrinsic = MockExtrinsicType::decode(&mut &*array_bytes::hex2bytes_unchecked("8400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d016a0d5d23b65049765a0141666edf0108dc326ced62c96a3092a74471c3bd00382aa84dfd9b12ce199560a26ac6126e1f5f50a59bd50c798f408979843153908c66071000000008081234"));
println!("{:?}", extrinsic);

Usually, the block type is https://github.com/paritytech/substrate/blob/f2bc08a3071a91b71fec63cf2b22c707411cec0e/primitives/runtime/src/generic/block.rs#L92.

And the extrinsic type is https://github.com/paritytech/substrate/blob/f2bc08a3071a91b71fec63cf2b22c707411cec0e/primitives/runtime/src/lib.rs#L868.

Finally, you need to decode the OpaqueExtrinsic into this https://github.com/paritytech/substrate/blob/f2bc08a3071a91b71fec63cf2b22c707411cec0e/primitives/runtime/src/generic/unchecked_extrinsic.rs#L44.

  • thanks, what are the possible types? and how can I confirm them. Oct 25, 2022 at 16:13
  • Where did you get this result? Need more detail to analyze this. Oct 25, 2022 at 16:14
  • i got it from running an extrinsic from polkadot-ui. Developers -> Extrinsics -> System -> remarkWithEvent -> Value:0x1234 and then running let block = client.rpc().block(Some(block_hash)).await?; using subxt providing the blockhash of event and then block.block.extrincics[1] returns me this hex Oct 25, 2022 at 16:18
  • @AurevoirXavier but how to decode the OpaqueExtrinsic into unchecked_extrinsic ?
    – dadzerlaze
    Dec 2, 2022 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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