mrtruongleo / dym-ts-sdk

Dymension typescript work with @cosmjs/stargate
4 stars 4 forks source link

Invalid Private Key #3

Open silverfangsama opened 1 month ago

silverfangsama commented 1 month ago

Using the example provided as a started guide, providing a non-0x private throws an error that the private key is invalid. Even as a fix I attempted to prefix the private with 0x, still the same error. Any suggestions? ![Uploading Screenshot 2024-08-13 at 17.41.30.png…]()

mrtruongleo commented 1 month ago

Your image is not showing. It is very likely that your DYM account was created incorrectly, so the private key is not correct. Remember that the private key for an address on the Dymension network is the same as the private key for an EVM address with the same mnemonic phrase. Unlike other addresses in the Cosmos ecosystem, Dymension, Injective, and Evmos use the same private key for addresses on the EVM network.

silverfangsama commented 1 month ago

Your image is not showing. It is very likely that your DYM account was created incorrectly, so the private key is not correct. Remember that the private key for an address on the Dymension network is the same as the private key for an EVM address with the same mnemonic phrase. Unlike other addresses in the Cosmos ecosystem, Dymension, Injective, and Evmos use the same private key for addresses on the EVM network.

I have been using the account for sometime. So, I can't find any reason as to why it would be faulty. Though, it is relevant to note that it was not generated by cosmjs. I created the account on keplr

mrtruongleo commented 1 month ago

I had a bad experience with Kepler and Leap wallets when retrieving the private key. With Kepler, I couldn't find an option to export the private key if the wallet was imported or created from a mnemonic phrase. With the Leap wallet, the mobile app retrieves the Dymension private key in the same way it does for other chains in the Cosmos ecosystem, which is incorrect. However, the browser extension retrieves the correct private key according to the EVM private key. Therefore, if you want to double-check, you should import or create a new wallet using the Leap browser extension, select the Dymension chain, and then find the ‘Export private key’ option.

mrtruongleo commented 1 month ago

OR If you're using a mnemonic phrase, import it into MetaMask or any wallet that supports EVM chains, then retrieve the private key from there and use it for testing with Dymension. It’s a bit strange, but that’s how this chain works.

silverfangsama commented 1 month ago

I had a bad experience with Kepler and Leap wallets when retrieving the private key. With Kepler, I couldn't find an option to export the private key if the wallet was imported or created from a mnemonic phrase. With the Leap wallet, the mobile app retrieves the Dymension private key in the same way it does for other chains in the Cosmos ecosystem, which is incorrect. However, the browser extension retrieves the correct private key according to the EVM private key. Therefore, if you want to double-check, you should import or create a new wallet using the Leap browser extension, select the Dymension chain, and then find the ‘Export private key’ option.

Speaking on this, I did notice something strange when I used a previous setup for dyemnsion before I stumbled upon your repo.

The setup I had did not give me any invalid private key error. But while querying the address, I found out it was a different address from the one the private key has.

mrtruongleo commented 1 month ago

I've updated the readme.md with instructions for creating a new DYM address and private key. You can check it and make a try.

silverfangsama commented 1 month ago

I will try this. Thank you for your time. I would love to connect more. Is there anywhere I could reach you? Telegram, twitter?

I am still relatively new to this. While I've done some work, I know I still have a lot to learn

mrtruongleo commented 1 month ago

I will try this. Thank you for your time. I would love to connect more. Is there anywhere I could reach you? Telegram, twitter?

I am still relatively new to this. While I've done some work, I know I still have a lot to learn

Thank you. I've been less active online recently, and my knowledge is also quite modest. If there's anything that needs discussing, don't hesitate to ask. You can reach me on Telegram at @raydotac.