📐Mathematical Modeling

The algorithm powering the one-click cross-chain transaction feature in 1FUEL relies on mathematical models rooted in optimization and graph theory. Here's a breakdown of the mathematical foundation

Graph Representation

The blockchain networks are represented as a graph 𝐺=(𝑉,𝐸), where 𝑉 is the set of vertices (blockchains) and 𝐸 is the set of edges (transaction paths between blockchains).

Each edge 𝑒𝑖𝑗∈𝐸 between blockchains 𝑣𝑖 and 𝑣𝑗 has a weight 𝑤(𝑒𝑖𝑗), representing the transaction cost, which includes gas fees, latency, and liquidity.

Cost Function

The goal is to find the path from the source blockchain 𝑣𝑠 to the target blockchain 𝑣𝑡 with the minimum cost.

The cost function is defined as:

C(vj,k)=minviV{C(vi,k1)+w(eij)}C(v_j, k) = \min_{v_i \in V} \{ C(v_i, k-1) + w(e_{ij}) \}

Here, 𝐶(𝑣𝑗,𝑘) represents the minimum cost to reach vertex 𝑣𝑗 from the source 𝑣𝑠 using at most 𝑘 edges.

Dynamic Programming Solution

The algorithm iteratively computes the cost function for each vertex and edge, updating the cost as network conditions change. This ensures that the optimal path is dynamically adjusted in real-time to reflect the most efficient transaction route.

HTLC Integration

The security and atomicity of transactions are ensured through HTLCs. Mathematically, this is represented by:

Atomic Execution Condition

HTLC Outcome={Transaction Successif Hash Condition MetTransaction Reversedif Time Expired or Condition Not Met\text{HTLC Outcome} = \begin{cases} \text{Transaction Success} & \text{if Hash Condition Met} \\ \text{Transaction Reversed} & \text{if Time Expired or Condition Not Met} \end{cases}

This ensures that the transaction either fully completes across all involved blockchains or is fully reversed, protecting the user from partial transaction failures.

Last updated