Skip to main content

Core API Calls: avalanche_getAccountPubKey

Developer documentation for JSON-RPC API calls to use with Core

Amanda avatar
Written by Amanda
Updated over a month ago

This method returns the public keys associated with the active account of the Core wallet. It provides both EVM and P-chain keys.

Params (0)

Result (PubicKeyDetails)

EVM: String

The EVM public key of the active account. Required

xp: String

The X-Chain and P-Chain public key of the active account. Required

Errors:

Code

Message

4001

User rejected the request.

-32602

There is no active account

-32602

Can not find public key for the given index

-32602

Unable to get public key

-32602

This account does not have its public key imported

-32602

Public key is not known for Fireblocks accounts

-32602

This account does not have its public key imported

Example

Request:

await window.ethereum.request({
"method": "avalanche_getAccountPubKey",
"params": []
});

Result:

{
"evm": "03f083f3aeada2222e49d1f9616fe966e90a758b31b33893bb46087ba11de5491b",
"xp": "022ac8b32f6667bf9055f3123ad7a733fd12ae20f80fa920bf4ef425c62d30555e"
}

For any additional questions, please view our other knowledge base articles or contact a Product Support team member via the chat button. Examples are for illustrative purposes only.

Did this answer your question?