SettleMint
User guidesSystem addonsXvP SettlementHTLC settlements

Walkthrough

Follow a complete multi-party cross-chain settlement where a Builder sells tokenized real estate to two Buyers, with a Notary receiving fees across Ethereum and Polygon.

This walkthrough demonstrates a complex multi-party HTLC settlement involving four parties across two blockchains. You'll see how XvP coordinates cross-chain exchanges and handles multiple flows.

Prerequisites

This walkthrough assumes you understand how HTLC works. If you're new to HTLCs, we recommend reading the HTLC explanation first to learn about hashlocks, timelocks, and why the mechanism is cryptographically secure.

Scenario: Tokenized real estate sale

The parties

PartyRoleChain
BuilderSells property tokensEthereum
Buyer 1Purchases 50% ownershipPolygon
Buyer 2Purchases 50% ownershipPolygon
NotaryHandles legal transfer, receives feePolygon

The deal

  • Builder sells an apartment tokenized as 100 APT-101 tokens on Ethereum
  • Buyer 1 and Buyer 2 each purchase 50% (50 tokens each)
  • Total price: 500,000 USDC + 5,000 USDC notary fee
ItemAmount
Property price500,000 USDC
Buyer 1's share250,000 USDC + 2,500 notary fee
Buyer 2's share250,000 USDC + 2,500 notary fee
Notary fee5,000 USDC total

Settlement structures

Ethereum settlement (created by Builder)

FieldValue
Local flows
Flow 1Builder → Buyer 1: 50 APT-101
Flow 2Builder → Buyer 2: 50 APT-101
External flows (informational)
Flow 3Buyer 1 → Builder: 250,000 USDC (on Polygon)
Flow 4Buyer 2 → Builder: 250,000 USDC (on Polygon)
Flow 5Buyer 1 → Notary: 2,500 USDC (on Polygon)
Flow 6Buyer 2 → Notary: 2,500 USDC (on Polygon)
Hashlock0xdef456...
TimelockJanuary 20, 2025 at 5:00 PM
Auto-executeEnabled

Polygon settlement (created by Buyer 1)

FieldValue
Local flows
Flow 1Buyer 1 → Builder: 250,000 USDC
Flow 2Buyer 2 → Builder: 250,000 USDC
Flow 3Buyer 1 → Notary: 2,500 USDC
Flow 4Buyer 2 → Notary: 2,500 USDC
External flows (informational)
Flow 5Builder → Buyer 1: 50 APT-101 (on Ethereum)
Flow 6Builder → Buyer 2: 50 APT-101 (on Ethereum)
Hashlock0xdef456... (same as Ethereum)
TimelockJanuary 19, 2025 at 5:00 PM (24 hours before Ethereum)
Auto-executeEnabled

Only senders approve

On Ethereum, only the Builder approves (sending tokens). On Polygon, only Buyer 1 and Buyer 2 approve (sending USDC). Recipients don't take action.

Balance tracking

Ethereum chain

StepActionBuilderBuyer 1Buyer 2XvP Contract
Initial-100 APT-101000
CreateBuilder creates settlement100 APT-101000
ApproveBuilder approves → Armed000100 APT-101
ExecuteSecret revealed050 APT-10150 APT-1010

Polygon chain

StepActionBuilderNotaryBuyer 1Buyer 2XvP Contract
Initial-00252,500 USDC252,500 USDC0
CreateBuyer 1 creates settlement00252,500 USDC252,500 USDC0
Approve 1Buyer 1 approves000252,500 USDC252,500 USDC
Approve 2Buyer 2 approves → Armed0000505,000 USDC
ExecuteSecret revealed500,000 USDC5,000 USDC000

Step-by-step walkthrough

Builder generates the secret

Builder opens the settlement wizard on Ethereum and generates a cryptographic secret:

  • Secret: 0x7a8b9c... (Builder saves this securely)
  • Hashlock: keccak256(secret) = 0xdef456...

The Builder keeps the secret private and shares only the hashlock with the Buyers.

Builder creates settlement on Ethereum

Builder configures the settlement:

  1. Adds two local flows (property tokens to each Buyer)
  2. Adds four external flows (USDC from Buyers on Polygon)
  3. Sets timelock to January 20, 2025 at 5:00 PM
  4. Enables auto-execute
  5. Submits the transaction

Builder shares hashlock with Buyers

Builder shares the hashlock 0xdef456... with Buyer 1 and Buyer 2. The Buyers can verify:

  • The settlement exists on Ethereum
  • It contains the correct flows (they'll receive property tokens)
  • The hashlock matches what they'll use on Polygon

Important: Builder does NOT share the secret yet - only the hashlock.

Buyer 1 creates settlement on Polygon

Buyer 1 creates the matching settlement on Polygon:

  1. Adds four local flows (USDC from both Buyers to Builder and Notary)
  2. Enters the same hashlock 0xdef456...
  3. Sets timelock to January 19, 2025 at 5:00 PM (24 hours before Ethereum)
  4. Enables auto-execute
  5. Submits the transaction

Builder approves on Ethereum

Builder approves the Ethereum settlement:

  1. Opens the settlement detail page
  2. Clicks Approve
  3. Confirms the transaction (transfers 100 APT-101 to the XvP contract)

The Ethereum settlement enters Armed state (only one local sender: Builder).

Buyers approve on Polygon

Buyer 1 approves:

  1. Opens the Polygon settlement
  2. Clicks Approve
  3. Confirms (transfers 252,500 USDC to XvP contract)

Settlement shows "1 of 2 approvals."

Buyer 2 approves:

  1. Opens the Polygon settlement
  2. Clicks Approve
  3. Confirms (transfers 252,500 USDC to XvP contract)

The Polygon settlement enters Armed state.

Builder reveals secret on Polygon

Builder reveals the secret to claim the USDC:

  1. Opens the Polygon settlement
  2. Clicks Reveal Secret
  3. Enters the secret 0x7a8b9c...
  4. Confirms the transaction

Auto-execute triggers immediately:

  • Builder receives 500,000 USDC
  • Notary receives 5,000 USDC

The Polygon settlement is now Executed.

Secret is revealed on Ethereum

Now that the secret is public (visible on Polygon), anyone can use it on Ethereum.

Option A: Buyers find the secret on-chain in the Polygon transaction.

Option B: Builder emails the secret to Buyers (it's already public, no security risk).

One of the Buyers reveals the secret on Ethereum:

  1. Opens the Ethereum settlement
  2. Clicks Reveal Secret
  3. Enters 0x7a8b9c...
  4. Confirms

Auto-execute triggers immediately:

  • Buyer 1 receives 50 APT-101
  • Buyer 2 receives 50 APT-101

The Ethereum settlement is now Executed.

What if something goes wrong?

ScenarioWhat happens
Secret never revealed before January 19Polygon settlement expires. Buyers withdraw their USDC.
Secret revealed on Polygon but not Ethereum before January 20Buyers have until January 20 to reveal on Ethereum. After that, Builder can withdraw property tokens.
One Buyer doesn't approve on PolygonSettlement never reaches Armed state. After timelock, all approved parties can withdraw.
Network congestion on EthereumBuyers should reveal the secret well before the January 20 deadline to account for delays.

Next steps

On this page