Skip to content

feat: add memo param to TxBuilder#11

Open
nocktoshi wants to merge 13 commits into
nockbox:mainfrom
nocktoshi:feat/memo
Open

feat: add memo param to TxBuilder#11
nocktoshi wants to merge 13 commits into
nockbox:mainfrom
nocktoshi:feat/memo

Conversation

@nocktoshi

Copy link
Copy Markdown
Contributor

Adds ability to send a memo with the wasm builder.

Note: I still need to update iris UI to show the memo when signing. For now it works by blind signing.

Txn from Iris: https://nockblocks.com/tx/BkcNhQcSmRjQygQ4wYTLFh6WVKmSyNbKFCcKVyBYkZNUDzjwxUEfidh

Usage:

          const builder = new wasm.TxBuilder(feePerWord);
          const recipientDigest = new wasm.Digest(PAYMENT_ADDRESS);
          const refundDigest = new wasm.Digest(address);

          builder.simpleSpend(
            [note],
            [spendCondition],
            recipientDigest,
            amount,
            null,
            refundDigest,
            false,
            "My Memo" //New Memo Parameter
          );

Comment thread crates/iris-nockchain-types/src/tx_engine/note.rs
@h33p

h33p commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

Finally had time to look at this. If we are to support a standard for text encoding, it should be optimal. Few issues I can see:

  • Not a fan of 1 byte per belt. We can encode arbitrarily long sequences as belts. See Base58Belts in iris-ztd/hash.rs for conversions. We would just an equivalent of to/from_bytes for Vec<Belt> holding type.
  • There's no need to null terminate this sequence - it just ends

Both of these add up to transaction cost. If the following can be done to cut costs, they should be done. At that point, the standard can be adopted by the wallet officially.

@h33p

h33p commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

@nocktoshi there is now efficient and compact atom<->belts conversion https://github.com/nockbox/iris-rs/blob/main/crates/iris-wasm/src/noun.rs#L48

nocktoshi added 3 commits May 29, 2026 23:35
# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	crates/iris-grpc-proto/src/convert.rs
#	crates/iris-nockchain-types/src/tx_engine/builder.rs
#	crates/iris-nockchain-types/src/tx_engine/note.rs
#	crates/iris-nockchain-types/src/tx_engine/tx.rs
#	crates/iris-wasm/src/tx.rs
- Updated `seeds_to_pb` function to handle `NoteData` from the new module.
- Refined `From` implementation for `PbNoteData` to use tuple destructuring.
- Removed unused memo handling code from `SpendBuilder` and `TxBuilder`.
- Simplified memo encoding in `encode_utf8_string_memo` to use a more efficient format.
- Cleaned up imports and removed deprecated structures related to memo handling.
- Introduced `push_memo` and `push_blob` methods for inserting memo and blob nouns.
- Added `push_memo_utf8` method to encode UTF-8 strings as compact belts nouns.
- Enhanced the NoteData structure to support new memo handling functionality.
@nocktoshi

Copy link
Copy Markdown
Contributor Author

@h33p I have updated the pr to use the new atom<->belts conversion in noun.rs

How does it look?

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