2

I have a bot for automated sending of XMR. The bot can send XMR to integrated addresses only, without separate payment ID support.

One customer has given me both a regular address and an old-style long payment ID. I have no feedback with this customer and I can't ask him to generate an integrated address or short payment ID.

I know an integrated address is made from a regular address and short payment ID, but the customer gave me a long payment ID. Is it possible to create an integrated address, which corresponds to a given pair? Otherwise, is it possible to convert the long payment ID to a short payment ID?

2

This really depends on how long the supplied payment ID is. Integrated addresses embed a short payment ID (64 bits - 8 bytes). So if the supplied payment ID is 8 bytes or less, yes, you can construct an integrated address using the supplied regular address and payment ID. Steps would be:

  1. Base58 decode the regular address
  2. Replace the first byte with byte 0x13
  3. Remove the last 4 bytes
  4. Append the payment ID (padded to 8 bytes if it's shorter)
  5. Append the first 4 bytes of the Keccak-256 hash of the above
  6. Base58 encode - this result is the integrated address.

You could alternatively just use the wallet RPC method make_integrated_address passing in the parameters standard_address and payment_id.

If the supplied payment ID is longer than 8 bytes, then no, you cannot create an integrated address using that payment ID and address.

  • The received payment_id is 32 bytes. Is it impossible anyway? – ca6 Mar 20 at 13:26
  • 1
    "If the supplied payment ID is longer than 8 bytes, then no, you cannot create an integrated address using that payment ID and address." – jtgrassie Mar 20 at 13:59
  • It is worth noting the Base58 decode of a Monero primary address is atypical when compared to many other cryptos, there are nine separate fields see the bottom answer of monero.stackexchange.com/questions/1409/…. – skaht Mar 22 at 18:50
  • A clearer explanation of the variant of the base58 implementation used in Monero can be found here. – jtgrassie Mar 26 at 5:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.