-
Hi, how to import a private key that has been exported from Metamask to wallet-core for ethereum ? in cpp |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Use |
Beta Was this translation helpful? Give feedback.
-
thanks can you provide an example? i read the PrivateKey.h can not understand how to use it , i got different errors even when try to validate a private key with isValid method it gives me that i have to use a TWcureve when i provide the cure then it tells me that the method only accepts one argument , this is how i call it: TW::PrivateKey::isValid("2a55a49995cf26a86f19a5c9272ee04b5a9f401130e29854c3a22fd50b309522", TWCurveSECP256k1); |
Beta Was this translation helpful? Give feedback.
-
'PrivateKey::isValid' has a one-parameter version, and a two-paramter version, and the first parameter is the key data, but it must be |
Beta Was this translation helpful? Give feedback.
'PrivateKey::isValid' has a one-parameter version, and a two-paramter version, and the first parameter is the key data, but it must be
Data
type, not string. Hint: use parse("") from HexCoding.https://github.com/trustwallet/wallet-core/blob/master/src/PrivateKey.h#L33
Test:
https://github.com/trustwallet/wallet-core/blob/master/tests/PrivateKeyTests.cpp#L20
Test with create (TW):
https://github.com/trustwallet/wallet-core/blob/master/tests/interface/TWPrivateKeyTests.cpp#L21