SettleMint
User guidesSystem addonsXvP settlementHTLC settlements

Walkthrough

Follow a multi-party HTLC settlement where two DALP settlements use the same hashlock to coordinate token and USDC flows across Ethereum and Polygon.

Two local DALP XvP settlements coordinate one cross-chain deal with a shared hashlock. DALP executes only the local flows on each settlement's chain. External flows describe the matching obligation on the other chain and help participants verify the deal before approval or reveal.

Prerequisites

This walkthrough assumes you know the HTLC terms hashlock, timelock, raw secret, and reveal. Read the HTLC explanation first if those terms are new.

Scenario: Tokenized real estate sale

A Builder sells 100 tokenized apartment tokens on Ethereum. Two Buyers pay USDC on Polygon, and a Notary receives a Polygon fee. The parties create one settlement on Ethereum for the property-token delivery and one settlement on Polygon for the USDC payment.

Parties

PartyRole in this walkthroughLocal chain for approvals
BuilderSends property tokensEthereum
Buyer 1Sends payment and receives 50 tokensPolygon
Buyer 2Sends payment and receives 50 tokensPolygon
NotaryReceives the notary feePolygon

Deal terms

ItemAmount
Property price500,000 USDC
Buyer 1's share250,000 USDC plus 2,500 USDC fee
Buyer 2's share250,000 USDC plus 2,500 USDC fee
Notary fee5,000 USDC total
Property tokens100 APT-101 total

The same hashlock links both settlements:

ValueExample
Raw secretclosing-secret-apt-101-2025
Hashlock0x920eda3b2f7ffb9adef73772ed5ef26ea12e8934c8ae5f2b24ec5a0c07ff8969

The raw secret is the value entered during reveal. The hashlock is the 32-byte 0x-prefixed value stored on both settlements.

Settlement structures

Ethereum settlement

The Builder creates the Ethereum settlement because the Builder sends the property tokens on Ethereum.

FieldValue
Local flow 1Builder sends 50 APT-101 to Buyer 1
Local flow 2Builder sends 50 APT-101 to Buyer 2
External flow 1Buyer 1 sends 250,000 USDC to Builder on Polygon
External flow 2Buyer 2 sends 250,000 USDC to Builder on Polygon
External flow 3Buyer 1 sends 2,500 USDC to Notary on Polygon
External flow 4Buyer 2 sends 2,500 USDC to Notary on Polygon
Hashlock0x920eda3b2f7ffb9adef73772ed5ef26ea12e8934c8ae5f2b24ec5a0c07ff8969
TimelockJanuary 20, 2025 at 17:00 UTC
Auto-executeEnabled for this walkthrough

Polygon settlement

Buyer 1 creates the Polygon settlement because the Buyers send the USDC flows on Polygon. Buyer 2 still approves because Buyer 2 is also a local sender.

FieldValue
Local flow 1Buyer 1 sends 250,000 USDC to Builder
Local flow 2Buyer 2 sends 250,000 USDC to Builder
Local flow 3Buyer 1 sends 2,500 USDC to Notary
Local flow 4Buyer 2 sends 2,500 USDC to Notary
External flow 1Builder sends 50 APT-101 to Buyer 1 on Ethereum
External flow 2Builder sends 50 APT-101 to Buyer 2 on Ethereum
Hashlock0x920eda3b2f7ffb9adef73772ed5ef26ea12e8934c8ae5f2b24ec5a0c07ff8969
TimelockJanuary 19, 2025 at 17:00 UTC
Auto-executeEnabled for this walkthrough

External flows do not execute the other chain

Each settlement executes only its local flows. The external flows make the matching obligation visible to participants. They do not transfer assets on the other chain.

Only local senders approve

On Ethereum, only the Builder approves because the Builder sends the local APT-101 tokens. On Polygon, Buyer 1 and Buyer 2 approve because those Buyers send the local USDC flows. Recipients do not approve.

Balance tracking

Ethereum chain

StepActionBuilderBuyer 1Buyer 2XvP contract
InitialNo settlement action100 APT-101000
CreateBuilder creates settlement100 APT-101000
ApproveBuilder approves, settlement is Armed000100 APT-101
ExecuteSecret is revealed on Ethereum050 APT-10150 APT-1010

Polygon chain

StepActionBuilderNotaryBuyer 1Buyer 2XvP contract
InitialNo settlement action00252,500 USDC252,500 USDC0
CreateBuyer 1 creates settlement00252,500 USDC252,500 USDC0
Approve 1Buyer 1 approves000252,500 USDC252,500 USDC
Approve 2Buyer 2 approves, settlement is Armed0000505,000 USDC
ExecuteSecret is revealed on Polygon500,000 USDC5,000 USDC000

Step-by-step walkthrough

Builder generates the raw secret

Builder opens the settlement wizard and generates a raw secret. The wizard supports either entering the raw secret or entering an existing hashlock, depending on which party creates the settlement.

  • Raw secret: closing-secret-apt-101-2025
  • Hashlock: 0x920eda3b2f7ffb9adef73772ed5ef26ea12e8934c8ae5f2b24ec5a0c07ff8969

Builder keeps the raw secret private and shares only the hashlock with the Buyers before approval.

Builder creates the Ethereum settlement

Builder configures the Ethereum settlement:

  1. Adds two local flows for the APT-101 transfers to Buyer 1 and Buyer 2.
  2. Adds the four Polygon USDC flows as external flows.
  3. Enters the shared hashlock.
  4. Sets the timelock to January 20, 2025 at 17:00 UTC.
  5. Enables auto-execute for this walkthrough.
  6. Submits the transaction.

The Ethereum settlement now describes both sides of the deal, but it can execute only the Ethereum APT-101 flows.

Buyers verify the Ethereum settlement

Buyer 1 and Buyer 2 check the Ethereum settlement before they create and approve the Polygon side:

  • The local flows send 50 APT-101 to each Buyer.
  • The external flows match the Polygon USDC obligations.
  • The hashlock matches the value they use on Polygon.
  • The Ethereum timelock gives them enough time to reveal the secret after it becomes public on Polygon.

Builder does not share the raw secret at this stage.

Buyer 1 creates the Polygon settlement

Buyer 1 creates the matching Polygon settlement:

  1. Adds four local flows for the USDC payments to Builder and Notary.
  2. Adds the two Ethereum APT-101 flows as external flows.
  3. Enters the same hashlock used on Ethereum.
  4. Sets the timelock to January 19, 2025 at 17:00 UTC.
  5. Enables auto-execute for this walkthrough.
  6. Submits the transaction.

The Polygon settlement can execute only the Polygon USDC flows.

Builder approves on Ethereum

Builder approves the Ethereum settlement:

  1. Opens the Ethereum settlement detail page.
  2. Selects Approve.
  3. Confirms the transaction that transfers 100 APT-101 into the XvP contract.

The Ethereum settlement enters Armed state because its only local sender has approved.

Buyers approve on Polygon

Buyer 1 approves first:

  1. Opens the Polygon settlement.
  2. Selects Approve.
  3. Confirms the transaction that transfers 252,500 USDC into the XvP contract.

The settlement remains pending until Buyer 2 also approves.

Buyer 2 then approves:

  1. Opens the Polygon settlement.
  2. Selects Approve.
  3. Confirms the transaction that transfers 252,500 USDC into the XvP contract.

The Polygon settlement enters Armed state.

Builder reveals the secret on Polygon

Builder reveals the raw secret on the Polygon settlement to claim the USDC:

  1. Opens the Polygon settlement.
  2. Selects Reveal Secret.
  3. Enters closing-secret-apt-101-2025.
  4. Confirms the transaction.

Because auto-execute is enabled in this walkthrough, revealing the valid secret executes the local Polygon flows:

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

The Polygon settlement is Executed. The raw secret is now public on-chain.

Buyers reveal the same secret on Ethereum

After the Polygon reveal, Buyer 1 or Buyer 2 can reuse the public raw secret on the Ethereum settlement:

  1. Opens the Ethereum settlement.
  2. Selects Reveal Secret.
  3. Enters closing-secret-apt-101-2025.
  4. Confirms the transaction.

Because auto-execute is enabled in this walkthrough, revealing the valid secret executes the local Ethereum flows:

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

The Ethereum settlement is Executed.

What can go wrong

ScenarioWhat happensWhat to do
Secret is never revealed before January 19The Polygon settlement expires. Buyers can withdraw their USDC from the Polygon settlement.Do not reveal on Ethereum. Let both sides expire or withdraw according to each settlement's local state.
Secret is revealed on Polygon but not Ethereum before January 20The Polygon USDC flows execute. The Ethereum settlement remains available until its timelock. After expiry, Builder can withdraw the APT-101 tokens.Buyers should reveal on Ethereum as soon as the Polygon reveal transaction is final enough for their operating process.
Buyer 2 does not approve on PolygonThe Polygon settlement does not reach Armed state. Execution stays blocked until all local senders approve.Wait for approval or let the settlement expire, then withdraw local assets from that settlement.
Ethereum is congested after the Polygon revealBuyers may run out of time before the Ethereum timelock.Use staggered timelocks and reveal with enough operational margin for finality and retries.

Next steps

On this page