hayesgm / signet

Lightweight Ethereum Key Manager & RPC Client in Elixir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Difficulty creating signer

albydarned opened this issue · comments

Hello! I'm trying to sign transactions on the Polygon Mumbai Testnet. This is the error i'm getting

image

Steps I've taken:

  1. Uploaded wallet private key to Google Cloud KMS
  2. Configured Goth process named GCPCredentials and verified I get a valid response on Goth.fetch(GCPCredentials)
  3. Added the following config to the bottom of runtime.exs, replacing the necessary values from step 1
    config :signet, :signer, [
    {MySigner, {:cloud_kms, GCPCredentials, "projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{keyid}" "1"}}]

It seems i'm missing something simple getting the genserver process started or someting. Please let me know of any other info I need to provide.

Can you add {:google_api_cloud_kms, "~> 0.38.1"}, to your mix.exs. The CloudKMS module doesn't load unless you include this optional lib. We should not this in the docs.

Ah, thank you @hayesgm. That eliminated the error I had! I should've thought of searching for a package, the error makes sense now.

Do you have an example or some guidance on how to properly add a wallet private key from something like Metamask to GCloud KMS? I've created a Project, Keyring, and a key with:

  • HSM protection level
  • Asymmetric sign purpose
  • Elliptic Curve secp245k1 key SHA256 Digest default algorithm

At this point, it looks like I need to make an upload job, format the key for import, then wrap the key using the provided wrapping key.

I really like how the library is designed and have enjoyed using it so far. When I get things done, I'll be happy to write a PR adding some setup instructions to the docs.

Thanks in advance!

Ok @hayesgm, I think I was able to get the key properly into GCP KMS... Happy to post my steps I've recorded once I validate them. Now, i'm running into a new error. It looks like its trying to pad something that doesn't need to be padded? The address it is signing with is correct which makes me think I have gotten the key uploaded properly. Any ideas?

image

@hayesgm Just wanted to bump this to see if you have any ideas as to why this is happening

@hayesgm This PR solved it for me when I forked the repo and integrated it

#18

Thanks for taking care of this. Sorry for the delay in processing, but that PR is merged now.