On this page
evmGetPublicKey
Ethereum: get public key
Returns the public key derived from the specified path. Use showOnOneKey to request confirmation on the device.
const result = await HardwareSDK.evmGetPublicKey(connectId, deviceId, params);Params
Single public key
path- requiredstring | Array<number>SDK minimum length is3. read moreshowOnOneKey- optionalbooleanWhether to display the public key on the device. Defaults totrue.chainId- optionalnumberThe ChainId in ETH is a unique identifier for a specific Ethereum network, used to distinguish different versions of the blockchain. Reference .
Multiple public keys
bundle- array of objects withpath,chainId,showOnOneKeyfields
Example
Return the public key for first ethereum account:
HardwareSDK.evmGetPublicKey(connectId, deviceId, {
path: "m/44'/60'/0'/0/0",
showOnOneKey: true,
chainId: 1
});Return a bundle of public keys for multiple ethereum accounts:
HardwareSDK.evmGetPublicKey(connectId, deviceId, {
bundle: [
{ path: "m/44'/60'/0'/0/0", chainId: 1 }, // account 1
{ path: "m/44'/60'/1'/0/0", chainId: 1 }, // account 2
{ path: "m/44'/60'/2'/0/0", chainId: 1 } // account 3
]
});Result
Single-public-key response
{
success: true,
payload: {
path: string, // serialized BIP32 path
xpub?: string, // xpub in legacy format
pub: string, // hexadecimal public key
publicKey: string, // alias of pub
}
}Read more about BIP32 serialization format
Batch public-key response
{
success: true,
payload: [
{ path, xpub, pub }, // account 1
{ path, xpub, pub }, // account 2
{ path, xpub, pub }, // account 3
]
}Error
{
success: false,
payload: {
error: string, // error message
code?: string | number // error code
}
}For bundle requests with useBatch: true, a supported batch route returns { path, pub, publicKey } without xpub or node. The ordinary route returns the extended public key and node; do not require these fields in a batch response.
Last updated on