Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to sign evm transactions again (regression) #753

Open
randy75828 opened this issue Jul 31, 2024 · 19 comments
Open

Unable to sign evm transactions again (regression) #753

randy75828 opened this issue Jul 31, 2024 · 19 comments

Comments

@randy75828
Copy link
Contributor

randy75828 commented Jul 31, 2024

It seems like there is a recent removal in the evm field in carbon.json as shown here:

feeaefb

and that the evm info for the chain is moved to:

https://github.com/chainapsis/keplr-chain-registry/blob/main/evm/eip155%3A9790.json

but this brings back this error Not ethermint like and EVM chain due to the missing evmInfo field.

image

This sudden update is breaking our chains evm transaction. Can anyone help?

@randy75828
Copy link
Contributor Author

@delivan
Copy link
Member

delivan commented Jul 31, 2024

Hey @randy75828 It would be helpful to tell what and where do you try to sign EVM transaction.

@randy75828
Copy link
Contributor Author

I'm signing on our demex application. It is a feature that is planned for release today but due to the sudden change in the chain config here it is blocked in testing environment.

In short it is blocked because of the evm info removal

@delivan

@randy75828
Copy link
Contributor Author

I saw that reversion is probably due to the SWTH values not showing corrrectly on the keplr wallet, which probably stems from the fact that probably the wallet cannot differentiate an 8dp SWTH (cosmos) vs 18dp SWTH (evm). However this reversion is causing us to not being able to sign evm transaction

@delivan
Copy link
Member

delivan commented Jul 31, 2024

You are right. and another crucial problem is Metamask user's address is derived with 'coin type 60', but Keplr user's address is derived with 'coin type 118'. We don't support both coin typ 60 and 118 as on one chain. so we split Carbon chain config into cosmos version(coin type 118, cosmos/carbon.json) and evm version (coin type 60, evm/eip155:9790.json).

If you want to use evm functionality, you should use Keplr with ethereum json rpc provider via window.keplr.ethereum or MIPD(EIP-6963) like using Metamask in your app. @randy75828

@delivan
Copy link
Member

delivan commented Jul 31, 2024

If you want to sign and send a transaction, you can use eth_sendTransaction. it includes signing process.
eth_signTransaction is not supported for now but it will be supported asap. @randy75828

@randy75828
Copy link
Contributor Author

randy75828 commented Jul 31, 2024

appreciate the help! it is working now! @delivan

@randy75828
Copy link
Contributor Author

@delivan i realised there is no way for me to suggest chain unless i hardcode the json i got while added keplr via the official keplr website

https://chains.keplr.app/

{
  "rpc": "https://evm-api.carbon.network",
  "nodeProvider": {
    "name": "Switcheo Labs",
    "email": "[email protected]",
    "website": "https://www.switcheo.com/"
  },
  "chainId": "eip155:9790",
  "chainName": "Carbon EVM",
  "chainSymbolImageUrl": "https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/eip155:9790/chain.png",
  "bip44": {
    "coinType": 60
  },
  "currencies": [
    {
      "coinDenom": "SWTH",
      "coinMinimalDenom": "swth",
      "coinDecimals": 18,
      "coinGeckoId": "switcheo"
    }
  ],
  "feeCurrencies": [
    {
      "coinDenom": "SWTH",
      "coinMinimalDenom": "swth",
      "coinDecimals": 18,
      "coinGeckoId": "switcheo"
    }
  ],
  "rest": "https://evm-api.carbon.network",
  "evm": {
    "chainId": 9790,
    "rpc": "https://evm-api.carbon.network"
  },
  "features": [
    "eth-address-gen",
    "eth-key-sign"
  ],
  "beta": true
}

is there any api available for me to call?

@delivan
Copy link
Member

delivan commented Jul 31, 2024

You can call wallet_addEthereumChain with some params via window.keplr.ethereum.request method.
I refer a document from Metamask which is working same with Keplr @randy75828

@randy75828
Copy link
Contributor Author

Hmm but in that case I'll need to hardcore the params regardless, based on what is on keplr wallet registry for my Evm chain?

@delivan
Copy link
Member

delivan commented Jul 31, 2024

Yes, It would be good to do that and one thing you should change is chainId value as "0xfef" not "eip155:9790"

@randy75828
Copy link
Contributor Author

randy75828 commented Jul 31, 2024

thanks
image

for this, is it possible to suggest Carbon EVM straightaway?
Seems like not quite possible?
image

@delivan
Copy link
Member

delivan commented Jul 31, 2024

There is no way for that connection popup, but after that you can call wallet_switchEthereumChain to switch to your chain to connect.
Refer the document for it

@randy75828
Copy link
Contributor Author

Thanks

image i am getting this error even though the chain has been added and switched, do u know why

@delivan
Copy link
Member

delivan commented Aug 1, 2024

@randy75828 Have you connected to your chain? does that error make your logic stuck?

@randy75828
Copy link
Contributor Author

I think that happened when i remove the chain from the extension. Can only resolve it when i disconnect the wallet from my website via the keplr extension

@randy75828
Copy link
Contributor Author

randy75828 commented Aug 1, 2024

@delivan
i managed to get the evm signing to work, but im gettting this error for some of my users signing evm transaction. Im unable to replicate it because i reinstalled the keplr extension and readded the chain without the evminfo(the extension will not allow me to add my chain with the evm info anymore)
image

Is there a way to programatically remove the chain and add again?

@randy75828
Copy link
Contributor Author

i figured the exception was thrown because Carbon EVM chain coin type is 60
image
is it possible for me to change to 118

i am getting another validation error when it is 118. is there a way to allow 118?

image

@delivan

@randy75828
Copy link
Contributor Author

Found a way to patch it

#756

@delivan can u probably take a look at this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants