2

I'm looking for a way to expose some type of data publicly without providing my private view key to the public. Is there a way to expose payment id's in block explorers? Or is there some other way of exposing this?

1 Answer 1

2

There are two types of payment ID. The first is the older style 32 byte unencrypted payment ID. This will appear on the blockchain for anyone to see.

The second type is the newer style 8 byte encrypted payment ID. That gets encrypted with the transaction shared secret before hitting the blockchain, so that would not be suitable.

Monero has a tx_extra field that can be of any length, so you could even create specially formed transactions that could put much more than 32 bytes unencrypted onto the blockchain. The structure of the tx_extra field is described here: https://cryptonote.org/cns/cns005.txt

Here is an example transaction on the blockchain: https://xmrchain.net/tx/91be5c4bf7afa2a80bdb82db4eacefa8a212aefed41cca75f06e83f16ebef742

The tx_extra field is:

0221005d5ef173175a81d7e82ee3627fb7ef578f2f5803c552c93967d3caa36a920934019aeca56f3e9e0b6b849993ec27cf2eae0bb157e85ee2e4249afb03683eccc879

The first byte 02 means the first field is of type "tx_extra_nonce", which means either an encrypted or unencrypted payment id will follow. The second byte is a varint 21 which means that the field we're about to read is 33 bytes long (21 in hex is 33 in decimal).

Therefore the "tx_extra_nonce" field is the following 33 bytes:

005d5ef173175a81d7e82ee3627fb7ef578f2f5803c552c93967d3caa36a920934

The first byte of the field is 00 which means the rest of the field is a 32 byte unencrypted payment id:

5d5ef173175a81d7e82ee3627fb7ef578f2f5803c552c93967d3caa36a920934

If the first byte of the tx_extra_nonce field was 01, then an 8 byte encrypted payment id would have followed.

For completeness, note that the next field in the tx_extra is marked as type 01. This means that the 32 byte transaction public key follows.

The transaction public key is:

9aeca56f3e9e0b6b849993ec27cf2eae0bb157e85ee2e4249afb03683eccc879
2
  • Do you have a sample of how this looks on a block explorer? A transaction with the payment id exposed? Commented Apr 2, 2018 at 5:49
  • I've updated the answer with an example
    – knaccc
    Commented Apr 2, 2018 at 7:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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