Skip to content

Conversation

@ikripaka
Copy link
Collaborator

@ikripaka ikripaka commented Jan 16, 2026

Add a constant, as the value field is optional for issuance tokens.
The actual value is irrelevant for further transaction analysis and can be omitted.

@ikripaka ikripaka requested a review from KyrylR as a code owner January 16, 2026 14:04
@ikripaka ikripaka self-assigned this Jan 20, 2026
@ikripaka ikripaka force-pushed the feature/issue_tokens branch from 8d7c5f4 to 4a64a6b Compare January 20, 2026 11:09
@ikripaka ikripaka changed the title Add PLACEHOLDER_ISSUANCE_VALUE to reduce uncertainty Add PLACEHOLDER_ISSUANCE_VALUE to simplicity-core Jan 20, 2026
Comment on lines 14 to 17
/// `PLACEHOLDER_ISSUANCE_VALUE` exists because an issuance token doesn't require
/// to have a unique `value` field for blinding.
/// For token issuance, the exact value inserted is irrelevant.
pub const PLACEHOLDER_ISSUANCE_VALUE: u64 = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain more?

Currently it looks like a Magic value

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is to use fixed value instead of any value, which is derived from utxos.
Yeah, in some kind this value is used for blinding, but it also can be executed with PLACEHOLDER_ISSUANCE_VALUE.
In further code on transaction analysis value field is unused by now, so I wished to replace it with constant.

Screenshot 2026-01-20 at 13 47 14 options/creation_option.rs Screenshot 2026-01-20 at 13 51 25 basic/issue_asset.rs

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In comment for this constant we should mention this example, and add reasoning why it can be done, and mention when the actual values should be in TxOutSecrets

Copy link
Collaborator Author

@ikripaka ikripaka Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main information is in the comment. The reissuance and issuance tokens have to be defined and used in the order they were created, not the other way around.
https://github.com/ElementsProject/rust-elements/blob/2d94f5dcb5e4a81838681c71ed8a49b337feecd2/src/blind.rs#L652

How the blinding happens:

  1. https://github.com/ElementsProject/rust-elements/blob/2d94f5dcb5e4a81838681c71ed8a49b337feecd2/src/pset/mod.rs#L479
    Blind last - the function blinds all inputs and commitments to the last output.
  2. https://github.com/ElementsProject/rust-elements/blob/2d94f5dcb5e4a81838681c71ed8a49b337feecd2/src/pset/mod.rs#L493
     Inside this function, we can see that first, we gather SurjectionProofs and then blind the outputs.
      Gathering surjection inputs has a condition related to the issuance token. We can see that only asset_id is copied and the value is set to 0.
    // This value really does not matter in surjection proofs
      https://github.com/ElementsProject/rust-elements/blob/2d94f5dcb5e4a81838681c71ed8a49b337feecd2/src/pset/mod.rs#L438

So, after that, we can say with confidence that the value can be omitted and set to PLACEHOLDER_ISSUANCE_VALUE.

Screenshot 2026-01-20 at 15 39 36

@ikripaka ikripaka force-pushed the feature/issue_tokens branch from 908a7c7 to 79fd8fd Compare January 21, 2026 12:12
@ikripaka ikripaka force-pushed the feature/issue_tokens branch from 79fd8fd to 1b51de6 Compare January 21, 2026 13:17
Copy link
Collaborator

@KyrylR KyrylR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 1b51de6

@KyrylR KyrylR merged commit 87f89e9 into main Jan 21, 2026
3 checks passed
@KyrylR KyrylR deleted the feature/issue_tokens branch January 21, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants