web3j icon indicating copy to clipboard operation
web3j copied to clipboard

Could not construct a recoverable key. Are your credentials valid?

Open zendevil opened this issue 3 years ago • 1 comments

Could not construct a recoverable key. Are your credentials valid?

I have the following code:

212 (def CGP
213   (reify ContractGasProvider
214     (getGasPrice [_ contract-func] (Numeric/decodeQuantity "100"))
215     (getGasLimit [_ contract-func] (Numeric/decodeQuantity "100"))))
216 
217 
218 (.send
219   (Creation/deploy
220     web3j 
221     (Credentials/create
222       ;;"0xa335d4e1d18d9491454c05cff8b41261944c745b3f21b5cba557db46aef3ffb3"
223       ;;"0x4bF309Fd8e0206e2f7396bB52cfb4019195aEE41")
224       "9023c589167652b2182da32c2352c25c88cc1032f725b40e9a02e9f4162e1cc2"
225       "0xB00d16842187bF6f5e8312C94AF192f14a199489")
226     CGP
227     "0x77aBe2770497a8FfC205aFD743292B1Db05B6b5D"
228     "creation-1"
229     "creator-1"
230     (Numeric/decodeQuantity "1626885270000")))

And the credential private and public keys are taken from the pre-made accounts in the ganache cli. However, upon running this, I'm getting:

Execution error at org.web3j.crypto.Sign/signMessage (Sign.java:97).
Could not construct a recoverable key. Are your credentials valid?
Clojure: class java.lang.RuntimeException

which is thrown here:

https://github.com/web3j/web3j/blob/9c92f2cd123a40edde0715592af533f08248ca60/crypto/src/main/java/org/web3j/crypto/Sign.java#L97

Why is this happening and how to fix this?

zendevil avatar Jul 22 '21 07:07 zendevil

most likely using address instead of public key.

private key 0xa335d4e1d18d9491454c05cff8b41261944c745b3f21b5cba557db46aef3ffb3 address 0x4bf309fd8e0206e2f7396bb52cfb4019195aee41

Xilis avatar Jan 20 '22 09:01 Xilis