Skip to content

Commit 627382e

Browse files
Sync src from main: b2dcf75 add sync ci
1 parent a87136a commit 627382e

File tree

9 files changed

+20
-20
lines changed

9 files changed

+20
-20
lines changed

src/SUMMARY.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Table of contents
22

3-
## AgentPay Introduction
3+
# AgentPay Introduction
44

55
* [Background & Overview](README.md)
66

7-
## AgentPay Architecture
7+
# AgentPay Architecture
88

99
* [System Overview](agentpay-architecture/system-overview.md)
1010
* [On-Chain Contracts](agentpay-architecture/on-chain-contracts/README.md)
@@ -17,7 +17,7 @@
1717
* [End-to-End Protocols](agentpay-architecture/off-chain-protocols/end-to-end-protocols.md)
1818
* [App Contracts and Protocols](agentpay-architecture/app-contracts-and-protocols.md)
1919

20-
## State Guardian Network
20+
# State Guardian Network
2121

2222
* [Off-Chain Availability Problem](state-guardian-network/off-chain-availability-problem.md)
2323
* [Evolution of SGN](state-guardian-network/evolution-of-sgn.md)

src/agentpay-architecture/app-contracts-and-protocols.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ For simplicity, this section uses a two-player game as the example: both players
4242

4343
### **Play the Game with Conditional Payments to the Winner**
4444

45-
<figure><img src="../.gitbook/assets/app-send-pay.png" alt=""><figcaption></figcaption></figure>
45+
<img src="../.gitbook/assets/app-send-pay.png" alt=""><figcaption></figcaption>
4646

4747
Figure above shows the message flow during the game setup and playing phase. _A_ and _D_ are players of an off-chain game App channel. Black lines represent messages related to game logic, while purple and orange lines represent conditional payment messages from _A_ and _D_, respectively. Dashed lines indicate direct communication between _A_ and _D_, without involving relay nodes.
4848

@@ -56,15 +56,15 @@ The steps are summarized as follows:
5656

5757
### **Settle the Payments When the Loser Is Cooperative**
5858

59-
<figure><img src="../.gitbook/assets/app-settle-pay.png" alt=""><figcaption></figcaption></figure>
59+
<img src="../.gitbook/assets/app-settle-pay.png" alt=""><figcaption></figcaption>
6060

6161
Figure above shows the message flow when _A_, after losing the game off-chain, follows the protocol to settle payments cooperatively. The honest loser _A_ initiates the settlement of both conditional payments: [paying the full amount](off-chain-protocols/end-to-end-protocols.md#source-pays-in-full-amount-on-true-outcome) for its own conditional payment to _D_, and [rejecting the conditional payment](off-chain-protocols/end-to-end-protocols.md#destination-rejects-the-payment-on-false-outcome) from _D_. The workflow completes once the winner _D_ confirms settlement of both payments.
6262

6363
**There are zero on-chain transactions throughout the entire lifecycle**—from when the two players agree to play the game, to the final prize distribution—so long as all participants behave cooperatively. The App contract and its logic remain purely virtual and only need to appear on-chain in the rare case of a dispute.
6464

6565
### **Settle the Payments When the Loser Is Uncooperative**
6666

67-
<figure><img src="../.gitbook/assets/app-dispute-pay.png" alt=""><figcaption></figcaption></figure>
67+
<img src="../.gitbook/assets/app-dispute-pay.png" alt=""><figcaption></figcaption>
6868

6969
Figure above shows the message flow when _A_ loses the game but refuses to settle the conditional payments off-chain. To claim the prize, the winner _D_ initiates a dispute, resolves the payment on-chain, and completes settlement with its upstream peer. **Relay nodes (**_**B**_**&#x20;and&#x20;**_**C**_**) never need to perform any on-chain transactions**, even when the end players (_A_ and _D_) fail to cooperate.
7070

src/agentpay-architecture/off-chain-protocols/end-to-end-protocols.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The setup process for an end-to-end multi-hop conditional payment is the same fo
3232

3333
The figure below illustrates the message flow where payment source **A** sends a conditional payment to destination **D** through relay nodes **B** and **C**.
3434

35-
<figure><img src="../../.gitbook/assets/e2e-pay-setup.png" alt=""><figcaption></figcaption></figure>
35+
<img src="../../.gitbook/assets/e2e-pay-setup.png" alt=""><figcaption></figcaption>
3636

3737
The conditional payment is established sequentially through simplex channels **A–B**, **B–C**, and **C–D**, following the [_Send Conditional Payment_](single-hop-protocols.md#send-conditional-payment) procedure described earlier.
3838

@@ -46,7 +46,7 @@ Once the conditional payment is successfully set up, the nodes along the route c
4646

4747
The figure below shows the message flow when the payment source initiates settlement by paying the full amount to its peer. This can occur immediately after **A** receives the `RevealSecretAck` for a payment protected by a single hash lock, or after the associated CelerApp boolean conditions are finalized (off-chain) as _true_.
4848

49-
<figure><img src="../../.gitbook/assets/e2e-pay-full.png" alt=""><figcaption></figcaption></figure>
49+
<img src="../../.gitbook/assets/e2e-pay-full.png" alt=""><figcaption></figcaption>
5050

5151
As shown above, when the condition evaluates to _true_, settlement begins from the payment source (**A**) and proceeds downstream toward the destination (**D**).
5252

@@ -56,7 +56,7 @@ Each relay node (**B**, **C**) transfers the full amount to its downstream peer
5656

5757
The figure below shows the message flow when the payment destination rejects the conditional payment. This occurs after the associated boolean conditions are finalized (off-chain) as _false_.
5858

59-
<figure><img src="../../.gitbook/assets/e2e-pay-reject.png" alt=""><figcaption></figcaption></figure>
59+
<img src="../../.gitbook/assets/e2e-pay-reject.png" alt=""><figcaption></figcaption>
6060

6161
When a conditional payment should not be paid, cooperative off-chain settlement begins from the payment destination (**D**) and proceeds upstream toward the source (**A**).
6262

@@ -72,7 +72,7 @@ For payments with **boolean conditions**, relay nodes never need to initiate dis
7272

7373
The figure below illustrates a case where the payment destination (**D**) starts an on-chain dispute because it did not receive the full payment amount, possibly due to a failure or malicious action by an upstream node (**A**, **B**, or **C**).
7474

75-
<figure><img src="../../.gitbook/assets/e2e-boolean-dispute.png" alt=""><figcaption></figcaption></figure>
75+
<img src="../../.gitbook/assets/e2e-boolean-dispute.png" alt=""><figcaption></figcaption>
7676

7777
If the destination **D** does not receive the expected settlement, it can submit an on-chain transaction to resolve the payment by conditions. Once the payment result is finalized in the **PayRegistry**, **D** sends a `PaymentSettleProof` message to its upstream peer (**C**) to request settlement.
7878

@@ -114,7 +114,7 @@ The setup process for an end-to-end multi-hop payment with numeric conditions is
114114

115115
The figure below illustrates the cooperative settlement flow for payments with numeric conditions when all nodes behave honestly. The process begins at the payment destination (_D_) once the final payment result is determined to be a value between zero and the maximum amount.
116116

117-
<figure><img src="../../.gitbook/assets/e2e-vouch (1).png" alt=""><figcaption></figcaption></figure>
117+
<img src="../../.gitbook/assets/e2e-vouch (1).png" alt=""><figcaption></figcaption>
118118

119119
The destination _D_ first sends a `PayResultVouchRequest` to the payment source _A_, producing a co-signed [VouchedCondPayResult](../on-chain-contracts/channel-operations.md#resolve-payment-by-vouched-result) that confirms both parties agree on the payment outcome. Then, _D_ sends a `PaymentSettleProof` message to its upstream peer _C_, using the vouched result as proof. _C_ verifies that the payment is not finalized at a smaller amount by querying the PayRegistry, then pays _D_ the vouched amount off-chain. After receiving the settlement response, _C_ forwards the same vouched result upstream to _B_, which repeats the same process. Finally, _A_ settles with _B_ directly without querying the registry, since _A_ is itself the payment source that signed the vouched result.
120120

@@ -124,7 +124,7 @@ Relay nodes perform the **PayRegistry check** to protect themselves against pote
124124

125125
After a relay node pays its downstream peer the vouched amount, it must ensure it can receive the same amount from its upstream peer. If this does not occur in time—or if the relay detects that the payment has been maliciously resolved on-chain to a smaller amount—it can initiate an on-chain dispute using the co-signed vouched result.
126126

127-
<figure><img src="../../.gitbook/assets/e2e-vouch-dispute.png" alt=""><figcaption></figcaption></figure>
127+
<img src="../../.gitbook/assets/e2e-vouch-dispute.png" alt=""><figcaption></figcaption>
128128

129129
In the example shown, relay node _C_ disputes the payment on-chain after paying _D_ the vouched amount but failing to receive settlement from _B_. _C_ submits a transaction to resolve the payment by vouched result. The **PayResolver** contract guarantees that the finalized result in the **PayRegistry** will never be smaller than the vouched amount submitted by _C_, ensuring that _C_ can always recover at least what it has paid out.
130130

src/agentpay-architecture/off-chain-protocols/single-hop-protocols.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Because both simplex directions operate independently yet symmetrically, the fol
1717

1818
Sending a conditional payment involves creating a new co-signed [simplex channel state](../on-chain-contracts/core-data-structures.md#simplex-channel-state) that adds a new entry to the pending pay list (field 5) and updates related metadata. The process requires one round trip of two off-chain messages — `CondPayRequest` and `CondPayResponse`.
1919

20-
<figure><img src="../../.gitbook/assets/send-cond-pay.png" alt=""><figcaption></figcaption></figure>
20+
<img src="../../.gitbook/assets/send-cond-pay.png" alt=""><figcaption></figcaption>
2121

2222
**`CondPayRequest`** — sent by the peer initiating or forwarding a conditional payment. It includes:
2323

@@ -39,7 +39,7 @@ Once a conditional payment’s outcome is finalized, the two peers can cooperati
3939

4040
The process uses up to three off-chain messages — `PaymentSettleRequest`, `PaymentSettleResponse`, and (optionally) `PaymentSettleProof`, which is used when the receiving peer initiates the settlement.
4141

42-
<figure><img src="../../.gitbook/assets/settle-cond-pay.png" alt=""><figcaption></figcaption></figure>
42+
<img src="../../.gitbook/assets/settle-cond-pay.png" alt=""><figcaption></figcaption>
4343

4444
**`PaymentSettleRequest`** is sent by the `peer_from` side of the channel to clear one or more payments. It includes:
4545

@@ -70,7 +70,7 @@ The previous section described the basic single-hop message flow between two cha
7070

7171
Unlike TCP or other data transmission protocols, simplex state update messages are not independent packets — each new message depends on the previous simplex state. This means one invalid message invalidates all subsequent messages derived from it. AgentPay modifies the traditional sliding window design to support these dependencies while still achieving high concurrency and throughput.
7272

73-
<figure><img src="../../.gitbook/assets/sliding-window.png" alt=""><figcaption></figcaption></figure>
73+
<img src="../../.gitbook/assets/sliding-window.png" alt=""><figcaption></figcaption>
7474

7575
The figure above illustrates the sliding window workflow under two types of failures: message loss and request rejection. **S** represents the new simplex state, **b** the base sequence number, and **R** the request type (e.g., send or settle). For example, “_S7,b4,R5_” denotes a message carrying a one-signed simplex state with sequence number 7, built on the previous state 4, for request R5. **A** denotes acknowledgment (ACK), and **N** denotes negative acknowledgment (NACK). AgentPay assumes messages may be lost but are always delivered in order, as guaranteed by the underlying transport layer (e.g., [gRPC](https://grpc.io/)).
7676

src/agentpay-architecture/on-chain-contracts/contracts-architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contracts Architecture
22

3-
<figure><img src="../../.gitbook/assets/Screenshot 2025-10-29 at 11.26.58 PM (1).png" alt=""><figcaption></figcaption></figure>
3+
<img src="../../.gitbook/assets/Screenshot 2025-10-29 at 11.26.58 PM (1).png" alt=""><figcaption></figcaption>
44

55
The figure above illustrates the AgentPay on-chain contract architecture. The white dashed boxes at the bottom represent user-side off-chain components. Each colored rectangle denotes an individual on-chain contract: blue modules are **AgentPay core contracts** (those with dashed borders are _versioned contracts_ that can evolve over time through peer-agreed migration), while green modules represent **external condition contracts** defined by applications. Orange arrows indicate inter-contract function calls with their primary purpose, and black arrows show user interactions from Agent nodes.
66

src/agentpay-architecture/on-chain-contracts/core-data-structures.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ We first introduce the core structural elements of AgentPay, which center on two
66

77
## Duplex Payment Channel
88

9-
<figure><img src="../../.gitbook/assets/channel-duplex.png" alt=""><figcaption></figcaption></figure>
9+
<img src="../../.gitbook/assets/channel-duplex.png" alt=""><figcaption></figcaption>
1010

1111
The figure above illustrates the logical data model of an AgentPay state channel between two peers, Alice and Bob. Not all information shown here resides on-chain. The model consists of two types of peer-related data:
1212

src/agentpay-architecture/on-chain-contracts/decentralized-versioning.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ message ChannelMigrationInfo {
5454

5555
Anyone can complete the migration by submitting this message to the **new** CelerLedger’s `migrateChannelFrom` API.
5656

57-
<figure><img src="../../.gitbook/assets/upgrade-ledger.png" alt=""><figcaption></figcaption></figure>
57+
<img src="../../.gitbook/assets/upgrade-ledger.png" alt=""><figcaption></figcaption>
5858

5959
As illustrated above, the migration consists of four inter-contract calls within one transaction:
6060

src/agentpay-architecture/system-overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The system architecture separates payment execution, application logic, and netw
88

99
### System Architecture&#x20;
1010

11-
<figure><img src="../.gitbook/assets/Screenshot 2025-10-29 at 10.57.23 AM.png" alt=""><figcaption></figcaption></figure>
11+
<img src="../.gitbook/assets/Screenshot 2025-10-29 at 10.57.23 AM.png" alt=""><figcaption></figcaption>
1212

1313
The figure above illustrates the high-level architecture of the AgentPay network. It consists of three main components: the **payment channel**, the **app channel**, and the **nodes connected by these channels**. Together they enable secure, low-latency economic interactions off-chain, with on-chain settlement only when necessary.
1414

src/state-guardian-network/sgn-as-channel-guardian.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Once registered, SGN validators collectively store cryptographic commitments of
88

99
## Service Flow
1010

11-
<figure><img src="../.gitbook/assets/guardian.png" alt=""><figcaption></figcaption></figure>
11+
<img src="../.gitbook/assets/guardian.png" alt=""><figcaption></figcaption>
1212

1313
Figure above illustrates the basic Channel Guardian service flow. The numbers in parentheses indicate the sequence of events:
1414

0 commit comments

Comments
 (0)