SettleMint
System 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. The platform executes only the local flows on each chain. As you follow each step, the external flows show the matching obligation on the other chain so every participant can verify the full deal before approving or revealing.

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 fee on that chain. The parties create one settlement on Ethereum for the property-token delivery and one 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 you enter during reveal. The hashlock is the 32-byte 0x-prefixed value stored on both settlements.

Settlement structures

Ethereum settlement

Builder creates the Ethereum settlement. Local flows transfer APT-101 tokens on Ethereum. External flows record the matching USDC obligations on Polygon so each participant can verify the full deal before approval.

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 both Buyers send USDC flows on that chain. Buyer 2 still approves, as a local sender who sends funds.

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

Balance tracking

Ethereum chain

StepEventBuilderBuyer 1Buyer 2XvP contract
InitialNo change yet100 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

StepEventBuilderNotaryBuyer 1Buyer 2XvP contract
InitialNo change yet00252,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 lets you either enter the raw secret directly or supply 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 they approve.

Builder creates the Ethereum settlement

Builder configures the 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 settlement now describes both sides of the deal, but executes only the APT-101 flows on Ethereum.

Buyers verify the Ethereum settlement

Before creating and approving the Polygon side, Buyer 1 and Buyer 2 check the Ethereum settlement to confirm:

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

Builder does not share the raw secret until both settlements are approved.

Buyer 1 creates the Polygon settlement

Buyer 1 creates the matching Polygon settlement. The configuration mirrors the Ethereum structure but executes only the USDC flows on Polygon:

  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.

Builder approves on Ethereum

Builder approves the Ethereum settlement by opening the detail page, selecting Approve, and confirming the transaction that transfers 100 APT-101 into the XvP contract. The settlement enters Armed state: its only local sender has approved.

Buyers approve on Polygon

Buyer 1 approves first:

  1. Opens the settlement on Polygon.
  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 by opening the settlement, selecting Approve, and confirming the transaction that transfers 252,500 USDC into the XvP contract. The settlement on Polygon enters Armed state.

Builder reveals the secret on Polygon

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

  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 USDC flows on Polygon:

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

The Polygon settlement moves to Executed state. 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 now-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 APT-101 flows on Ethereum:

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

The Ethereum settlement moves to Executed state. Both sides of the deal are complete.

What can go wrong

The table describes common failure scenarios and how to resolve each one.

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 have each party 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 your 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 have each local sender withdraw their assets from that settlement.
Ethereum is congested after the Polygon revealBuyers may run out of time before the Ethereum timelock.Set staggered timelocks and reveal with enough operational margin for finality and retries so you stay within your time window.

Next steps

On this page