Skip to Content
Hardware

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

Optional common params

Single public key

  • path - required string | Array<number> SDK minimum length is 3. read more
  • showOnOneKey - optional boolean Whether to display the public key on the device. Defaults to true.
  • chainId - optional number The 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 with path, chainId, showOnOneKey fields

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