0

【Front】

const keyB64 = await window.ethereum.request({
        method: 'eth_getEncryptionPublicKey',
        params: [accounts],
        });
        const publicKey = Buffer.from(keyB64, 'base64')
        console.log("publicKey:" , publicKey.toString("HEX"));
        //public key : 147a15547b90473007ccd597cdf8d82eff6da1fe2e3139733eb23dc04e6fc112

【BackEnd】

 Credentials credentials =  Credentials.create(privatekey);

 System.out.println("publickey : "+credentials.getEcKeyPair().getPublicKey().toString(16)) 
 //publickey:797fefaa3381ccce66cebea8c5f6ddb121d4aa1afc4317e179e963cc3d8dfb285b1fb664bc48d1b49586fa70c5b82302b6bcbf2d7f35178520afd25f53219a9e

Why metamask export public key is different from Web3j library export public key ?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.