Skip to content

ConfidentialMPTConvert

[Source]

Convert your public MPT balance to an encrypted confidential balance. The converted amount is credited to your confidential inbox balance, requiring an explicit ConfidentialMPTMergeInbox transaction to merge it into your spending balance before use.

This transaction also serves as the opt-in mechanism for confidential transfer participation. By executing it, including with a zero-amount conversion, your HolderEncryptionKey is recorded on your MPToken object, enabling you to receive and manage confidential funds. Issuers can convert tokens through a separate holder account that they control, which participates as a regular holder with no special privileges.

Note

This transaction converts only your own balance. To send confidential tokens to another account, first convert your balance, then use ConfidentialMPTSend transaction.

(Requires the ConfidentialTransfers amendment )

Example ConfidentialMPTConvert JSON

{
  "TransactionType": "ConfidentialMPTConvert",
  "Account": "rBob...",
  "MPTokenIssuanceID": "610F33...",
  "MPTAmount": "1000",
  "HolderEncryptionKey": "038d...",
  "HolderEncryptedAmount": "AD3F...",
  "IssuerEncryptedAmount": "BC2E...",
  "BlindingFactor": "EE21...",
  "ZKProof": "ABCD...",
  "Fee": "12",
  "Sequence": 2470665,
  "Flags": 2147483648
}

ConfidentialMPTConvert Fields

In addition to the common fields, ConfidentialMPTConvert transactions use the following fields:

FieldJSON TypeInternal TypeRequired?Description
MPTokenIssuanceIDStringUInt192YesThe unique identifier for the MPT issuance being converted.
MPTAmountStringUInt64YesThe public plaintext amount to convert into a confidential balance. Must be non-negative.
HolderEncryptionKeyStringBlobNoThe holder's ElGamal public key for confidential balances. Required when enabling confidential transfers for the first time. Forbidden if a key is already registered.
HolderEncryptedAmountStringBlobYes66-byte ElGamal ciphertext credited to the holder's inbox balance.
IssuerEncryptedAmountStringBlobYes66-byte ElGamal ciphertext credited to the issuer's mirror balance.
AuditorEncryptedAmountStringBlobNoA 66-byte ElGamal Ciphertext for the auditor. Required if sfAuditorEncryptionKey is present on the issuance.
BlindingFactorStringUInt256YesThe 32-byte scalar value used to encrypt the amount. Used by validators to verify the ciphertexts match the plaintext MPTAmount.
ZKProofStringBlobNoA Schnorr Proof of Knowledge. Required only when HolderEncryptionKey is present.

Error Cases

Besides errors that can occur for all transactions, ConfidentialMPTConvert transactions can result in the following transaction result codes:

Error CodeDescription
temDISABLEDThe ConfidentialTransfers amendment is not enabled.
temMALFORMEDThe transaction is malformed for one of the following reasons:
  • HolderEncryptionKey is provided but ZKProof is not.
  • HolderEncryptionKey is not provided but ZKProof is.
  • HolderEncryptionKey length is not exactly 64 bytes.
  • BlindingFactor length is not 32 bytes.
  • ZKProof length is not 65 bytes.
temBAD_AMOUNTThe MPTAmount is less than 0 or exceeds the maximum allowable MPT amount.
temBAD_CIPHERTEXTOne or more encrypted amount fields (HolderEncryptedAmount, IssuerEncryptedAmount, or AuditorEncryptedAmount) have incorrect length or represent an invalid elliptic curve point.
tecNO_PERMISSIONThe issuance has sfAuditorEncryptionKey set, but the transaction does not include sfAuditorEncryptedAmount.
tecDUPLICATEA public key is provided in the transaction, but the account already has a registered key.
tecINSUFFICIENT_FUNDSThe holder does not have sufficient public MPT balance to cover the MPTAmount.
tecBAD_PROOFThe ZKP verification failed for one of the following reasons:
  • The BlindingFactor fails to reconstruct the provided ciphertexts given the plaintext MPTAmount.
  • The Schnorr ZKP fails to verify the holder's knowledge of the secret key.