polkascan / py-substrate-interface

Python Substrate Interface
https://polkascan.github.io/py-substrate-interface/
Apache License 2.0
240 stars 114 forks source link

Derivation paths don't work #157

Closed xx-labs closed 2 years ago

xx-labs commented 2 years ago

Hello,

Creating accounts using the create_from_uri function seems to be broken.

Sample from https://docs.substrate.io/v3/tools/subkey/

subkey inspect "caution juice atom organ advance problem want pledge someone senior holiday very//polkadot//0"
SS58 Address:      5F3sa2TJAWMqDhXG6jhV4N8ko9SxwGy8TpaNS1repo5EYjQX

Python code:

keypair = Keypair.create_from_uri("caution juice atom organ advance problem want pledge someone senior holiday very//polkadot//0")
print(keypair.ss58_address)

5Hq3kCxRBhPswSAmuqnBXzqfGLiC9usvXP2FbB6iv4JAeUQy
arjanz commented 2 years ago

Confirmed, I ran some tests and it seems that there is indeed somehow a difference when one of the elements of the derivation paths is a numeric value.

However with all strings, for example //polkadot//test will result in the same address.

arjanz commented 2 years ago

Fix released in https://github.com/polkascan/py-substrate-interface/releases/tag/v1.1.2