4

I've made some changes to my blockchain setup recently. I switched the signature over to EthereumSignature, which changed my AccountId to an H160 size. Thankfully, I can still use scripts to manage balances and move funds between accounts.

I also set up four prefunded accounts on the dev node for testing. But here's where I hit a snag. Polkadot.js doesn't seem to be recognizing these prefunded dev accounts.

Anyone else run into this or have any ideas on how to fix it? Any suggestions would be much appreciated!


The 4 prefunded account are defined as such:

AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")),
AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")),
AccountId::from(hex!("798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc")),
AccountId::from(hex!("773539d4Ac0e786233D90A233654ccEE26a613D9")),

What polkadot.js shows: enter image description here

3 Answers 3

1

Apps actually does have a dedicated set of ethereum-style dev accounts and it does know how to make ethereum-style signatures. The tricky part is that it only enables this feature on a few hard-coded chain spec names.

Check out https://github.com/polkadot-js/apps/blob/e55b9fc67b0dc1f36f2123948fb4a8f18cdc7a38/packages/apps-config/src/settings/ethereumChains.ts#L4 for the hard-coded list.

If you are building a production chain, you could open a PR to add your spec name to that list. But if you are just developing and experimenting, you could consider changing your spec name to one that is already on the list. I used frontier-template and now Apps is working for me!

enter image description here

I would love it if there were some way to manually tell Apps to use the ethereum-style signatures and accounts. I've opened a feature request for that here https://github.com/polkadot-js/apps/issues/9632

1

There is no recognition logic, just hardcoded values

https://github.com/polkadot-js/common/blob/master/packages/keyring/src/testing.ts

So you just should update the addresses of prefunded accounts to match the hardcoded pairs.

1
  • 1
    Nice! It appears that Ethereum hardcoded addresses are also in existence. These are seemingly utilized exclusively when the keyring is of the Ethereum type, as evidenced here: github.com/polkadot-js/common/blob/… Any insights on how polkadot.js might be capable of identifying when it is operating on an Ethereum signature node?
    – ALeSD
    Commented Jun 25, 2023 at 6:38
0

I believe that polkadot.js just show some well known keys in accounts when connecting to a development node, not necessarily the ones you have prefunded in your genesis config.

I must be missing some details, but I think it works this way.

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.