Skip to content

Mwixnet wallet support - #783

Open
wiesche89 wants to merge 6 commits into
mimblewimble:stagingfrom
wiesche89:mwixnet_wallet_support
Open

Mwixnet wallet support#783
wiesche89 wants to merge 6 commits into
mimblewimble:stagingfrom
wiesche89:mwixnet_wallet_support

Conversation

@wiesche89

@wiesche89 wiesche89 commented Jul 28, 2026

Copy link
Copy Markdown

Summary
Adds Owner API support for creating signed mwixnet swap requests from wallet outputs.
related PR mimblewimble/mwixnet#34

Adds an experimental mwixnet wallet command that creates and submits a swap request to the first mwixnet server over Arti.

Also fixes the shared Arti HTTP POST implementation by sending the correct request target and JSON headers and handling HTTP error responses.

The command:

  • accepts an output commitment, ordered server keys, and a fee per hop
  • locks and tracks the selected output
  • returns the associated transaction log ID
  • validates the JSON-RPC response
  • keeps the output locked if the request is rejected or its acceptance cannot be confirmed

Tests
Adds tests for request creation and locking, JSON-RPC responses, transaction IDs, and Arti HTTP request formatting.

Testing
Select an unspent output:
./target/release/grin-wallet --testnet outputs

Submit it to mwixnet:
./target/release/grin-wallet --testnet mwixnet
<OUTPUT_COMMITMENT>
--server mza3u6vkqodqc6kjjapfbcjrg7hgpkuw6nyq5xvfjqp5jm2lfeaocwqd.onion
--fee_per_hop 12500000
--key ba2ee29d1e44227e3d78d1abbc7d86a9321ae24fb3656b545b001907a008bc4e
--key a6920c1ef8bd8bb14fe4940521eca294f797856baaa307eb51894dda157b1477

@wiesche89
wiesche89 requested a review from ardocrat August 3, 2026 07:48
Comment thread controller/src/command.rs
}
}

pub fn mwixnet<L, C, K>(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

question about usability, so user should create send request, extract commitment somehow and provide id to wallet, can we use this command on send to automate commitment getting

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

mwixnet swaps an existing UTXO, so reusing send would create an unnecessary Slate transaction. I can instead make the commitment optional and select an eligible output by amount or max, while keeping explicit selection available.

Comment thread controller/src/command.rs
Rejected(String),
}

fn parse_mwixnet_response(response: &str) -> Result<MwixnetResponse, Error> {

@ardocrat ardocrat Aug 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we move mwixnet related parsing to mwixnet file, it can be useful to use them at owner rpc api for example, same related to tests below

use onion::{new_stream_cipher, Onion, OnionError, Payload, RawBytes};

/// Maximum number of servers in an mwixnet route.
pub const MAX_MWIXNET_HOPS: usize = 16;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why such limit is important?

@wiesche89
wiesche89 force-pushed the mwixnet_wallet_support branch from 644017d to e18a052 Compare August 8, 2026 20:13
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.

2 participants