Skip to main content

Questions tagged [scale]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
5 votes
4 answers
187 views

Decoding Polkadot/Kusama transactions in Rust

I would like to inspect transactions (extrinsics) in a given block to potentially: Find different types of transactions and their parameters Look through all transactions included in the block and ...
Szymig's user avatar
  • 225
4 votes
1 answer
203 views

Compact SCALE decoding

In this answer the compact decoding for 1 byte and multi-byte versions have been detailed. I did a sample implementation based on that information and it does what it is supposed to, at least for the ...
Xiu Hung's user avatar
  • 527
3 votes
1 answer
74 views

Decoding `democracy.Voted`

I'm having trouble decoding a democracy.Voted event on Polkadot - for example: https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frpc.polkadot.io#/explorer/query/...
csknk's user avatar
  • 227
3 votes
1 answer
72 views

Scale codec f64 support

What is the reason that the SCALE codec does not support Encode and Decode of f64 types?
Mathis Wellmann's user avatar
2 votes
3 answers
796 views

Convert any address to accountId (in hex)

How can i convert an address of the form "5DTNtGF2DmZ7QwGxg6n1xWzF6cEokNyNre7mUqpVuozrLxu3" to hex using polkadotjs packages? Here is the context: I have multiples array of datas, containing ...
Nathan's user avatar
  • 454
2 votes
1 answer
78 views

Why SCALE vs RLP?

What are the differences between SCALE and RLP serialization beyond little-endian vs big-endian encoding? If both are length-encoded, what might make one better than the other?
Drew Stone's user avatar
  • 1,194
2 votes
1 answer
90 views

How to create a tuple type using polkadot.js api

I am trying to create a tuple. I know we can create an enum by defining the type as MyEnum: { _enum: { 'account': String, 'accountId': 'u128' ...
Emmanuel Thomas's user avatar
2 votes
1 answer
97 views

Does changing an enum require a storage migration? What about `Error` and `Event`

Say I have instances of this enum stored on-chain: enum Enum { V0, V1, } And suppose now that I change the enum in some way: enum Enum { V0, V2, V1, } This is what the substrate ...
mkl's user avatar
  • 432
2 votes
1 answer
79 views

Scale codec: Is there a way to extract an enum's arm's codec index value?

Using scale, an enum can be written like this: #[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)] pub enum Block { #[codec(index = 101)] V1(BlockV1), } The #[codec(index = 101)], the 101 ...
The Quantum Physicist's user avatar
2 votes
1 answer
44 views

How to provide argument to storage call in subxt?

In polkadotjs I have following code: const opts = [{"UniqueIdenfier1":[0,"challengeprofile"]}] let data = api.query.templateModule.periodName( ...opts, ...
Amiya Behera's user avatar
1 vote
1 answer
89 views

Scale Codec for Dart

There are a couple of packages that are outdated or do not have the features I need for Dart-lang. So, I decided to code my own. There are really good implementations coded in various languages that ...
Burak's user avatar
  • 903
0 votes
2 answers
39 views

No metadata hash in transaction

I see from the RFC (https://github.com/polkadot-fellows/RFCs/blob/main/text/0078-merkleized-metadata.md#inclusion-in-an-extrinsic) that it's possible to not provide the hash when crafting a polkadot ...
dierreh's user avatar
0 votes
1 answer
110 views

Scalecodec: How can I get the equivalent of Decode in Python, instead of DecodeAll?

When using the Python script: timestamp = ScaleDecoder.get_decoder_class('Timestamp', ScaleBytes(timestamp_bytes_array)).decode() it seems that the decoder expects the size of the array to be exactly ...
The Quantum Physicist's user avatar
0 votes
1 answer
161 views

How to decode RPC results using Python's Scale library

I'm trying to get the chain state information from substrate using RPC for IdentityOf of any Accountid Upon succesfull request, I get the following result: { "jsonrpc": "2.0", ...
Faisal Ahmed's user avatar