bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 8쪽 중 4쪽
⇤ )ij (t)= cij (t) otherwise µ(k⇤ )ij (t) = 0. For any k 6= k⇤,s e t
µ(k)ij (t) = 0.
Remark. In each slot t, DBR essentially tries to solve the following weighted-sum
optimization problem:
max
X
ij
X
k
µ(k)ij (t)W (k)ij (t)
s.t.
X
k
µ(k)ij (t)+ X
k
µ(k)ji (t) Bi$j (t), 8i, j. (10)
The above optimization problem is also called MaxWeight and derived from our theo-
retical analysis of DBR (see the next section). The aforementioned algorithm descrip-
tion gives an approximate solution to MaxWeight.
3.2.3. Throughput Performance of DBR
To analyze the throughput performance of DBR, we first introduce a few definitions.
• A state channel network is said to be stable if
lim
t!1
Q(k)i (t)
t =0 , 8i, k,
which implies that the long-term arrival rate to each debt queue equals the
long-term departure rate from that queue.
• A state channel network is said to balanced if
lim
t!1
ij (t)
t =0 , 8 channel i $ j.
27
In other words, for each payment channel i $ j the long-term sending rate from
node i to node j equals the sending rate from node j to node i.
• Define
(k)i , limt!1 1t t1X⌧ =0 a(k)i (⌧ )
as the long-term average arrival rate to node i for payments with destination
k. An arrival rate vector =( (k)i )i,k is said to be supportable if there exists
a routing algorithm that can keep the network stable and balanced under this
arrival rate vector.
• The throughput region of a state channel network is the set of supportable
arrival rate vectors.
• A routing algorithm is throughput-optimal if it can support any payment
arrival rate vector inside the throughput region.
For the ease of exposition, we assume that the external payment arrival process
{a(k)i (t)}t0 is stationary and has a steady-state distribution, and that the total de-
posit for each payment channel remains fixed, i.e., Bi$j (t)= Bi$j for any t 0. Our
analysis can be extended to the case where the arrival process is non-stationary and
channel deposits are time-varying (e.g., dynamic on-chain deposit/withdraw), at the
expense of unwieldy notations. The following theorem shows the throughput perfor-
mance of DBR.
Theorem 3.1. The DBR algorithm is throughput-optimal.
In other words, as long as there exists a routing algorithm that can keep the payment
network stable and balanced, the DBR algorithm can also achieve that. The rest
of §3.2.3 in below is the proof of Theorem 3.1. We first introduce a lemma which
characterizes the throughput region for a state channel network.
Lemma 3.2. An arrival rate vector =( (k)i )i,k is supportable if and only if there
28
exist flow variables f =( f (k)ij )i,j,k that satisfy the following conditions:
(k)i + X
j2Ni
f (k)ji X
j2Ni
f (k)ij 0, 8k, i 6= k (11)
X
k
f (k)ij = X
k
f (k)ji , 8i, j (12)
X
k
f (k)ij + X
k
f (k)ji Bi$j , 8i, j. (13)
Proof. The necessity of the above conditions is trivial. Inequality (11) corresponds
to the flow conservation requirement. If it is violated, then the arrival rate to node i
is larger than the departure rate, and the state channel network is unstable. Equation
(12) corresponds to the channel balance requirement. If it is violated, then channel
i $ j is imbalanced. Inequality (13) corresponds to the channel capacity constraint,
since the sum of tokens transferred over each channel i $ j cannot exceed the total
channel deposit Bi$j .
In order to prove the suciency of the above conditions, we construct an algorithm
that can stabilize and balance the state channel network when the arrival rate vector
satisfies (11)-(13). The algorithm is straightforward: in each slot t, set the routing
variable µ(k)ij (t)= f (k)ij for any i, j, k. Clearly, under this routing algorithm every chan-
nel i $ j remains balanced in each slot t since Pk µ(k)ij (t)= Pk f (k)ij = Pk f (k)ji =P
k µ(k)ji (t). Moreover, the network is stable under the algorithm since the flow con-
servation requirement is satisfied for every node. Note that each link i ! j may have
insucient fund initially (i.e., cij (0) < Pk f (k)ij ) such that the routing decision is in-
feasible. In this case, we can let node j transfer some tokens to node i at the beginning
in order to equalize the fund at both ends of the state channel. Such an adjustment
process incurs at most Bi$j sub-optimal transfers for each channel i $ j and does
not influence network stability and channel balance in the long term.
Therefore, equations (11)-(13) are a necessary and sucient condition for an arrival
rate vector to be supportable.
It should be noted that the routing algorithm mentioned in the proof of Lemma 3.2
cannot be implemented in practice since we do not know the external arrival rate vector
in advance. In the following, we prove that DBR can achieve the same throughput
performance without knowing any payment trac statistics in advance.
29
By Lemma 3.2, if an arrival rate vector belongs to the throughput region, it must
satisfy (11)-(13) and can be supported by the algorithm mentioned in the proof of
Lemma 3.2 (referred to as the optimal oracle algorithm ). In the following, denote by
eµ(k)ij (t) the routing decision made by the optimal oracle algorithm in slot t.B yt h e
nature of the optimal oracle algorithm, we have eµ(k)ij (t)= f (k)ij for any t (if ignoring
the initial fund adjustment process).
Define the Lyapunov function as follows:
(t)=
X
i,k
⇣
Q(k)i (t)⌘2 + 2 Xi,j 2ij (t). (14)
Also define the conditional Lyapunov drift as D(t) , E[(t + 1) (t)|Q(t), (t)],
where the expectation is with respect to the randomness of arrivals. To facilitate the
analysis, we assume that the amount of new payments arrivals to the network in each
slot is bounded by some constant. By equation (6), we have
⇣
Q(k)i (t + 1)⌘2 = hQ(k)i (t)+ a(k)i (t)+ X
j
µ(k)ji (t) X
j
µ(k)ij (t)i2
=
⇣
Q(k)i (t)+ X
j
µ(k)ji (t) X
j
µ(k)ij (t)⌘2 + ⇣a(k)i (t)⌘2
+2 a(k)i (t)⇣Q(k)i (t)+ X
j
µ(k)ji (t) X
j
µ(k)ij (t)⌘
⇣
Q(k)i (t)⌘2 2Q(k)i (t)⇣X
j
µ(k)ij (t) X
j
µ(k)ji (t)⌘
+2 a(k)i (t)Q(k)i (t)+ const,
(15)
where the inequality is due to the assumption that the arrival a(k)i (t) in each slot t is
bounded by some constant and the fact that the number of transferred tokens in each
slot is also bounded (since µ(k)ij (t) Bi$j ). Now we have
X
i,k
⇣
Q(k)i (t + 1)⌘2 X
i,k
⇣
Q(k)i (t)⌘2
const 2
X
i,k
Q(k)i (t)⇣X
j
µ(k)ij (t) X
j
µ(k)ji (t)⌘+2 X
i,k
a(k)i (t)Q(k)i (t)
= const 2
X
i,j
X
k
µ(k)ij (t)⇣Q(k)i (t) Q(k)j (t)⌘+2 X
i,k
a(k)i (t)Q(k)i (t),
30
where we rearrange the sum in the above equality. Similarly, noticing that
ij (t + 1) = ij (t)+
X
k
µ(k)ji (t) X
k
µ(k)ij (t),
we can prove
2
X
i,j
2ij (t + 1) 2 Xi,j 2ij (t) · const Xi,j Xk ij (t)⇣µ(k)ij (t) µ(k)ji (t)⌘
= · const
X
i,j
X
k
µ(k)ij (t)⇣ij (t) ji (t)⌘
= · const 2
X
i,j
X
k
µ(k)ij (t)ij (t),
,
(16)
where we use the fact that ij (t)= ji (t). As a result, by combining (15) and (16),
the conditional Lyapunov drift can be bounded by
D(t) c1 + c2 2
X
i,j
X
k
µ(k)ij (t)⇣Q(k)i (t) Q(k)j (t)+ ij (t)⌘+2 X
i,k
(k)i Q(k)i (t)
c1 + c2 2
X
i,j
X
k
eµ(k)ij (t)⇣Q(k)i (t) Q(k)j (t)+ ij (t)⌘+2 X
i,k
(k)i Q(k)i (t)
= c1 + c2 2
X
i,j
X
k
f (k)ij
⇣
Q(k)i (t) Q(k)j (t)+ ij (t)⌘+2 X
i,k
(k)i Q(k)i (t)
= c1 + c2 +2
X
i,k
Q(k)i (t)⇣(k)i + X
j
f (k)ji X
j
f (k)ij
⌘
X
ij
X
k
ij (t)
⇣
f (k)ij f (k)ji
⌘
c1 + c2,
where c1 and c2 are some constants, the second inequality is due to the operation
of DBR (see (10)), and the last inequality is due to (11) and (12). Using the law of
iterated expectations yields:
E[(⌧ + 1)] E[(⌧ )] c1 + c2.
Summing over ⌧ =0 , ··· ,t 1, we have
E[(t)] E[(0)] (c1 + c2) · t.
31
Then we have
X
i,k
E
h⇣
Q(k)i (t)⌘2i+ 2 Xi,j Eh2ij (t)i (c1 + c2)t + E[(0)]. (17)
To show that DBR achieves channel balance, we note from (17) that
2
⇣
E[
X
i,j
|ij (t)|]
⌘2
2 Xi,j Eh2ij (t)i (c1 + c2)t + E[(0)],
where the first inequality holds because the variance of |(t)| cannot be negative, i.e.,
Var(|(t)|)= E
hP
i,j 2ij (t)i ⇣E[Pi,j |ij (t)|]⌘2 0. Thus we have
E[
X
i,j
|ij (t)|]
s
2c1t + 2c2t + 2E[(0)] .
Since E[(0)] < 1, we have that for any payment channel i $ j
lim
t!1
E
h|ij (t)|
t
i
=0 ,
i.e., the network maintains channel balance under the DBR algorithm.
Similarly, we can show that
X
i,k
E[Q(k)i (t)] p(c1 + c2)t + E[(0)],
which implies that
lim
t!1
E[Q(k)i (t)]
t =0 , 8i, k,
i.e., the network is stable under the DBR algorithm.
32
3.3. Discussions of DBR
3.3.1. Failure Resilience
Due to its adaptive and multi-path nature, the DBR algorithm is inherently robust
against network failures. For example, when there are unresponsive nodes, DBR can
quickly adapt and support the maximum possible throughput over the remaining avail-
able nodes.
3.3.2. Privacy
Due to the multi-path nature of DBR, any intermediate node can only access the
information for a small fraction of each value transfer request. As a result, the DBR
algorithm naturally provides good privacy protection in terms of the amount of trans-
ferred values. However, in DBR, each node does need to know the destination of each
value transfer request in order to place it in a proper debt queue. If we also need to hide
the payment destination, onion routing [11] can be used in conjunction with DBR. In
onion routing, messages are encapsulated in layers of encryption. The encrypted data
is transmitted through a series of network nodes called onion nodes , each of which
“peels” away a single layer, uncovering the data’s next destination. When the final
layer is decrypted, the message arrives at its destination. We can direct payments
through an overlay network consisting of onion nodes and apply DBR to optimally
route payments among onion nodes.
3.4. Simulation Results
We numerically compare the performance of DBR with two existing routing algo-
rithms in payment state channel networks: SpeedyMurmurs [13] and Flare [10] (used
in Lightning Network). The simulation is conducted on the topology given in Figure
3.
Figure 4 shows the throughput performance comparison. It is observed that DBR
achieves 15x improvement in average payment throughput as compared to the existing
routing algorithms. The exceptional throughput performance of DBR is due to its
channel-balancing and congestion-aware nature. In particular, Figure 5 illustrates the
channel utilization 3 under DBR, SpeedyMurmurs and Flare, where we can observe
3Channel utilization corresponds to the ratio between the amount of transferred tokens in each time slot and
33
1/30/2018 Force-Directed Graph - bl.ocks.org
https://bl.ocks.org/mbostock/4062045 1/8
Popular / AboutMike Bostock’s Block 4062045
Updated November 27, 2017
Force-Directed Graph
This simple force-directed graph shows character co-occurence in Les Misérables. A physical
simulation of charged particles and springs places related characters in closer proximity, while
unrelated characters are farther apart. Layout algorithm inspired by Tim Dwyer and Thomas
Jakobsen. Data based on character coappearence in Victor Hugo's Les Misérables, compiled by
Donald Knuth.
Compare this display to a force layout with curved links, a force layout with fisheye distortion and a
matrix diagram.
index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.links line {
stroke: #999;
stroke-opacity: 0.6;
}
.nodes circle {
stroke: #fff;
stroke-width: 1.5px;
Open
Figure 3. Payment channel network topology used in simulations (77 nodes, 254 bi-directional
payment channels). The payment channel network is running with 40 payment flows with
randomly chosen source-destination pairs. The initial deposit for each channel is uniformly
distributed within [100,200] tokens. Payment arrivals follow a Poisson process and the size of
each payment follows a geometric distribution with the mean of 3 tokens.
Figure 4. Instant Payment throughput
comparison among DBR (avg: 6748 pay-
ments/slot), SpeedyMurmurs (avg: 467
payments/slot) and Flare (avg: 316 pay-
ments/slot).
Figure 5. Channel utilization comparison
among DBR, SpeedyMurmurs and Flare.
Higher channel utilization implies a higher
level of channel balancing.
that DBR consistently achieves high (nearly 100%) channel utilization while the other
routing algorithms only achieve less than 5% channel utilization due to the lack of
channel balancing.
the total token deposits of all channels. For example, if the total amount of deposits is 100 and only 50 of them
are moved in slot t,t h e nt h eo v e r a l lc h a n n e lu t i l i z a t i o ni nt h a ts l o ti s5 0 % .
34
4. cOS: O↵-chain Decentralized Application Operating System
To help everyone quickly build, operate, and use scalable o↵-chain decentralized appli-
cations without being hassled by the additional complexities introduced by o↵-chain
scaling, Celer Network innovates on a higher level abstraction: cOS, a combination of
application development framework (SDK) and runtime system. This section provides
the high-level vision, design objectives and illustrations on cOS.
4.1. Directed Acyclic Graph of Conditionally Dependent States
In this section, we provide a view of our abstraction model on the construct of o↵-chain
applications, and describe how the model is integrated with state channel networks.
In order to support use cases beyond simple P2P payments, we model a system of
o↵-chain applications as a directed acyclic graph (DAG) of conditionally dependent
states, where the edges represent the dependencies among them.
Figure 6. DAG of Conditionally Dependent States
Figure 6 illustrates the system model, where the Generalized Conditional Payment
Channel in the payment networks are the only contracts with on-chain states. The
settlement of these on-chain states depends on one or more conditional payment ob-
jects (e.g. Conditional Payment Object 3), which are completely o↵-chain but on-chain
enforceable. We want to highlight that these conditional payment objects are not only
simple time hash locked transactions, but can be conditioned on o↵-chain application
35
contract states, such as “O↵-chain App X” in Figure 6.
The conditional payment objects can be relayed through multiple hops just like
simple unconditional payments objects. For example, Payment Channel 1 can be a
channel connecting Alice and Bob and Payment Channel 2 can be a channel connecting
Bob and Carl. Let “O↵-chain App 2” be an o↵-chain chess game Alice is playing with
Carl, and suppose Alice wants to express the semantic of “Alice will pay Carl 10 ETH
if Carl wins the game”. Even without a direct channel between Alice and Carl, Alice
can send a conditional payment to Carl through Bob with two layers of conditional
locks. The first layer is a simple time hashed lock to make sure that Bob relays and
resolves the payment in a reasonable amount of time. The second layer locks the
payment conditioning on the result of the chess game. With this two-hop relay, the
conditional payment between Alice and Carl can be settled via Bob even though Bob
did not involve in the chess game. This is a minimized example of how a dependency
graph formed by generalized state channels, conditional payment objects and o↵-chain
applications can support arbitrarily complex multi-party interactions.
Note that o↵-chain objects do not have to depend only on o↵-chain objects. For
example, Alice can pay Carl when the latter successfully transfers a certain ENS
name to the former. In other words, the payment depends on the o↵-chain condition
that the owner of the ENS name changes from Carl to Alice.
Also, o↵-chain payment objects do not always have to be conditional: a condi-
tional payment object can “degenerate” into an unconditional balance proof as the
application runs. More generally speaking, conditional dependencies are transient by
nature: application state updates are done via a pair of two topological traversals of
the underlying state graph. The first traversal goes in the forward direction and the
second one in the reverse direction. The forward traversal, starting from the on-chain
state-channel contracts, creates additional transient conditional dependency edges and
modifies existing ones. The reverse traversal may remove existing transient conditional
dependency edges, because some conditions evaluate to constant true when traversing
backward.
4.2. O↵-chain Application Development F ramework
Much like how modern high-level languages and operating systems abstract away the
details about the underlying hardware, the complexity of interacting with conditional
36
state dependency graphs necessitates a dedicated development framework. With the
principle of “ease of use” on our mind, Celer Network presents the cOS SDK, a com-
plete toolchain solution for the creation, tracking, and resolution of states in o↵-chain
applications. We hope that the SDK will accelerate the adoption of the o↵-chain scal-
ing solution and the payment network provided by Celer Network, fostering a strong
ecosystem.
cOS API
Smart contract
Platform-specific code
State dependency graph
cOS state compiler
cApp
Figure 7. Structure of a decentralized application on Celer Network (cApp)
In general, we categorize decentralized applications into two classes: simple pay-
per-use applications and more complex multi-party applications. The pay-per-use ap-
plications include examples like the Orchid Protocol, where the user keeps receiving
microservices (e.g. data relay) from a real-world entity and streams payments through
the payment network. Since there is no need for conditional dependency on other o↵-
chain states, a lean transport layer API on top of the routing layer, both of which are
provided by Celer Network, suce for such cases.
The class of multi-party applications, the general structure of which is illustrated
in Figure 7, is where the idea of conditional state dependency graphs really shines.
The SDK defines a set of design patterns and a common framework for developers to
express the conditional dependencies. We plan to extend the existing smart contract
languages with modern software construction techniques such as metaprogramming,
annotation processing, and dependency injection so that the dependency information
can be written out explicitly without being too intrusive. A compiler then processes
the application code, extracts the declared o↵-chain objects, and generates the con-
ditional dependency graph. The compiler detects invalid or unfulfillable dependency
information and generates human-readable errors to assist the developer in debugging.
To help developers reason about the dependencies even further, the SDK will be able
to serialize the graphs into common formats such as Graphviz, with which they can
37
be easily visualized and presented.
The SDK also provides a code generator that generates a set of “bridge methods”
for interacting with smart contracts whose code is available at compile time. The
code generator parses the application binary interface (ABI), which specifies the sig-
nature of all callable functions in a smart contract, and generates the corresponding
bridge methods in platform-specific languages such as Java. The main advantage of
this approach is type safety: the glue methods replicate the method signatures of the
functions in the smart contract faithfully, providing a static and robust compile-time
check before dispatching the method to the cOS runtime for execution.
4.3. O↵-chain Application Runtime
The cOS runtime serves as the interface between cApps 4 and the Celer Network trans-
port layer. It supports cApps in terms of both network communication and local o↵-
chain state management. The overall architecture is illustrated in Figure 8.
Smart contract VM
VM-native bridge
Local storage
cApp
State guardian network
Blockchain
cAppcApp
cChannelCommunicate
Persist
Dispute
Handoff
cOS
Figure 8. cOS Runtime Architecture
On the network front, the runtime handles multi-party communication during the
lifecycle of a cApp. It also provides a set of primitives for secure multi-party com-
putation capable of supporting complex use cases such as gaming. In the case of
counter-party failure, whether fail-stop or Byzantine, the runtime relays disputes to
the on-chain state. In the case of 프로젝트로 돌아가기