Monero Key Image Sync
Export Monero key images for transaction outputs (UTXOs) to enable spent output tracking. The device returns encrypted key images that must be decrypted by your wallet software using the provided encryption key. The key images are encrypted using ChaCha20-Poly1305 for security.
const result = await TrezorConnect.moneroKeyImageSync(params);Params
MoneroKeyImageSync
path
String | Array<Number>
minimum length is 3. All components must be hardened (e.g., m/44'/128'/0'). read more
networkType
Enum: MAINNET (0) | TESTNET (1) | STAGENET (2) | FAKECHAIN (3)
Monero network type: 0 = MAINNET (default), 1 = TESTNET, 2 = STAGENET, 3 = FAKECHAIN
subs
Array<MoneroSubAddressIndicesList>
Subaddress indices to sync
account
Number
Major subaddress index
minor_indices
Array<Number>
Minor subaddress indices
tdis
Array<MoneroTransferDetails>
Transfer details (UTXOs) to export key images for
out_key
String
Output public key (64 hex chars = 32 bytes)
tx_pub_key
String
Transaction public key (64 hex chars = 32 bytes)
additional_tx_pub_keys
Array<String> | String
Additional transaction public keys for multi-output transactions (each 64 hex chars). Can be array or comma-separated string
internal_output_index
Number
Output index within the transaction (used in hash computation)
sub_addr_major
Number
Major subaddress index (default: 0)
sub_addr_minor
Number
Minor subaddress index (default: 0)
Important Notes:
- All keys must be exactly 64 hexadecimal characters (32 bytes)
- The
internal_output_indexis included in the cryptographic hash commitment additional_tx_pub_keysshould only be provided for multi-output transactions (typically empty for 2-output transactions)
Example
Export key images for UTXOs from a Monero testnet transaction:
TrezorConnect.moneroKeyImageSync({
path: "m/44'/128'/0'", // All components must be hardened
networkType: 1, // 0=MAINNET, 1=TESTNET, 2=STAGENET
tdis: [
{
out_key: '0a09ab658fca97610a38b8a5c206a0709db435341c31a9d40150df7e52440ac6',
tx_pub_key: 'da13cd8f4cc2c4f769d88b734d71cfdc0e43d01a20eb7bff6553fd67cb2ed37e',
additional_tx_pub_keys: [],
internal_output_index: 1,
sub_addr_major: 0,
sub_addr_minor: 0,
},
],
});Example with Multiple Outputs
TrezorConnect.moneroKeyImageSync({
path: "m/44'/128'/0'",
tdis: [
{
out_key: 'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890',
tx_pub_key: 'fedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321',
internal_output_index: 0,
sub_addr_major: 0,
sub_addr_minor: 0,
},
{
out_key: '1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
tx_pub_key: '0987654321fedcba0987654321fedcba0987654321fedcba0987654321fedcba',
additional_tx_pub_keys: [
'aabbccddaabbccddaabbccddaabbccddaabbccddaabbccddaabbccddaabbccdd',
],
internal_output_index: 1,
sub_addr_major: 0,
sub_addr_minor: 1,
},
],
});Result
The result contains encrypted key images. Each key image is encrypted using ChaCha20-Poly1305 AEAD.
{
success: true,
payload: {
key_images: [
{
iv: string, // 12-byte initialization vector/nonce
key_image: string, // Encrypted blob
},
// ... more key images
],
signature: string, // 32-byte encryption key
}
}Decryption
To use the key images, decrypt each one with ChaCha20-Poly1305 using the same encryption key:
// The signature field contains the encryption key
const encryptionKey = result.payload.signature;
// Decrypt each key image
result.payload.key_images.forEach(ki => {
const decrypted = chacha20poly1305_decrypt(ki.key_image, encryptionKey, ki.iv);
});