Closed kaigedong closed 4 years ago
I didn't figure out now...
The account public key you mentioned (0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d
) is basically already SCALE encoded, that means you can use ('d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d') already as a param for storage calls.
I think you mean how to convert the SS58 encoded address '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY' into the account public key '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d', which is covered on the Substrate wiki here:
https://github.com/paritytech/substrate/wiki/External-Address-Format-(SS58)
We have an implemention for this in our substrate-interface repos here:
https://github.com/polkascan/py-substrate-interface/blob/master/substrateinterface/utils/ss58.py#L32
Hope this helps!
Great! Thanks a lot!
When querying the storage, params should be SCALE encoded.
I saw many
encoding test
for int types. But as for AccountID (Alice):5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
, it should be converted to0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d
But how can I convert AccountID to SCALE encoded? Could you please show an example?