Ethereum: get public key
Display requested public key derived by given BIP44 path on device and returns it to caller. User is presented with a description of the requested public key and asked to confirm the export.
const result = await TrezorConnect.ethereumGetPublicKey(params);Params
GetPublicKey
path
String | Array<Number>
minimum length is 5. read more
showOnTrezor
Boolean
determines if address will be displayed on device. Default is set to true
suppressBackupWarning
Boolean
By default, this method will emit an event to show a warning if the wallet does not have a backup. This option suppresses the message.
chunkify
Boolean
determines if address will be displayed in chunks of 4 characters. Default is set to false
Bundle(GetPublicKey)
Example
Displays public key derived from BIP44 path:
TrezorConnect.ethereumGetPublicKey({
path: "m/44'/60'/0'/0",
});Return a bundle of public keys without displaying them on device:
TrezorConnect.ethereumGetPublicKey({
bundle: [
{ path: "m/44'/60'/0'/0/0", showOnTrezor: false }, // public key 1
{ path: "m/44'/60'/1'/0/0", showOnTrezor: false }, // public key 2
{ path: "m/44'/60'/2'/0/0", showOnTrezor: false }, // public key 3
],
});Result
Result with only one public key
{
success: true,
payload: {
path: Array<number>, // hardended path
serializedPath: string, // serialized path
xpub: string, // xpub in legacy format
xpubSegwit?: string, // optional for segwit accounts: xpub in segwit format
chainCode: string, // BIP32 serialization format
childNum: number, // BIP32 serialization format
publicKey: string, // BIP32 serialization format
fingerprint: number, // BIP32 serialization format
depth: number, // BIP32 serialization format
}
}Read more about BIP32 serialization format
Result with bundle of public keys
{
success: true,
payload: [
{ path, serializedPath, xpub, xpubSegwit?, chainCode, childNum, publicKey, fingerprint, depth }, // account 1
{ path, serializedPath, xpub, xpubSegwit?, chainCode, childNum, publicKey, fingerprint, depth }, // account 2
{ path, serializedPath, xpub, xpubSegwit?, chainCode, childNum, publicKey, fingerprint, depth } // account 3
]
}Error
{
success: false,
payload: {
error: string // error message
}
}