bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 5쪽 중 1쪽
ThisistheoriginalwhitepaperfortheCartesiprojectpublishedin2018.
Whilemuchofthetechnologicalunderpinningandsoftwarearchitecturedescribed
inthewhitepaperstillholdstruefortheprojecttothisday,theCartesitechnology
initscurrentstateistheproductofyearsofresearch,development,and
contributionsbyagrowinganddecentralizedcommunityofindependentteams,
companies,andindividuals.
ForregularupdatesontheCartesiecosystem,visittheCartesiBlog.
V ersion 1.01
The Core of Cartesi
Augusto Teixeira Diego Nehab
Abstract
Cartesi is a layer-2 platform for the development and deployment of
scalable decentralized applications. Cartesi DApps are composed of
both blockchain and off-chain components. Off-chain components
run inside Cartesi Nodes that represent the interests of each DApp
user. Cartesi Nodes provide DApp developers with reproducible
Cartesi Machines , where large scale verifiable computations can
be run. These verifiable computations are easily integrated into
smart contracts by powerful primitives that provide strong conflict-
resolution guarantees. More precisely, any dispute arising over the
result of computations run inside Cartesi Machines can be fairly
adjudicated at negligible cost on the blockchain. Cartesi Nodes also
allow DApp developers to run native code. Native computations can
leverage the node’s full processing power, including any available
GPUs. Whether performed natively by the node or inside Cartesi
Machines, off-chain components run under a complete Linux oper-
ating system that provides the full ecosystem required by complex
computations. Cartesi enables DApp developers to use all the pro-
gramming languages, tools, libraries, software, and services they
are already familiar with. By moving most of the complex logic of
their DApps to portable off-chain components, developers are freed
from the limitations and idiosyncrasies imposed by blockchains. In
this way, Cartesi empowers developers to select the best run-time
environment in which to host each part of their DApps.
1 Introduction
Public blockchains are mechanisms through which networks can
maintain decentralized consensus over a shared state. Typically, this
state holds, among other data, a payment system. The stake held by
participants in the resulting economy works as their incentive for
making the state widely available to others and for rejecting invalid
transactions. In this virtuous cycle, the payment system is built on
top of the decentralized consensus, which only functions due to
incentives created by the payment system itself. Both the payment
system and the consensus can then be used for other purposes.
As new applications for blockchain technology are envisioned, the
demands on the underlying infrastructure are constantly increasing.
At the moment, the two major obstacles to widespread adoption of
blockchain technology are its poor scalability and lack of a solid
development environment. The main contribution of Cartesi to the
blockchain ecosystem is overcoming both these issues.
Scalability Currently deployed consensus mechanisms are based
on full redundancy [ Nakamoto 2009; Wood 2018]. They require
every transaction to be stored permanently and to be validated by
every participant. This inefficiency is the key limiting factor to the
growth of the transaction rate, the amount of data involved, and the
intensity of computations within transactions. High transaction costs
and increased latency have become a barrier to many innovative
applications that would otherwise benefit from the flexibility that
smart contracts bring to the blockchain.
Attempts to improve blockchain scalability can be divided into
layer 1 and layer 2 solutions. Layer 1 scalability solutions change
the underlying blockchain infrastructure itself. Examples include
the optimization of block sizes, sharding, and Delegated Proof of
Stake (DPoS). Because they operate at the infrastructure level, these
solutions are burdened by the requirement of preserving global con-
sensus. Certain aspects of the state, such as the payment system, are
of critical importance to all parties and therefore require global con-
sensus. Otherwise, for most interactions mediated by the blockchain,
it is perfectly safe to limit access and verification responsibility to
the few parties that can potentially be affected. The blockchain can
then be used to provide finality and to guarantee local consensus in
the rare occasions where a dispute arises between these parties. In
other words, global consensus is a precious resource that should be
used with parsimony. In recognition of this fact, layer-2 scalability
solutions such as plasma, side chains, TrueBit, or state channels
move as much data and computation as possible off-chain. Layer-1
and 2 scalability solutions are discussed at some depth in section 2.
Computation environment Every computation that can influence
a transaction, whether performed on-chain or off-chain, must be re-
producible by all parties playing a validating role. Reproducible
computational models must be self-contained and deterministic. In
other words, the complete state for the computation and the entire
sequence of modifications to this state must be fully specified and
agreed upon. Sadly, real computing architectures were not designed
with these constraints in mind, and therefore are not reproducible.
Blockchain platforms solve this problem by employing custom vir-
tual machines (VMs) when processing smart contracts. These VMs
are reproducible, but also domain specific. On the one hand, they
offer native support for features useful to smart contracts (e.g., ac-
counting, rollback, associative memory, authentication, cryptogra-
phy etc). On the other hand, they lack valuable features found in
general-purpose architectures (e.g., floating-point arithmetic, virtual
memory, interrupts etc).
The revolution in software capability the world experienced over
the last few decades can be attributed to two key factors. The first
is an exponential increase in the speed at which modern hardware
platforms can process vast amounts of data. The second, and equally
important, is the ever-increasing expressive power of software devel-
opment environments. Indeed, general-purpose computations do not
happen in isolation. Rather, they are assembled from inter-dependent
building-blocks created by a worldwide collaboration of software
developers. These components and services rely on standard-library
facilities hosted by an underlying operating system (memory man-
agement, process management, file systems, networking, etc). It is
the operating system that ties everything together. Such facilities
are not available from the free-standing programming languages and
compilers that typical blockchains offer to smart contract developers.
Reproducibility and scalability concerns have made on-chain com-
putation environments very restrictive. To boost productivity and
widen the scope of blockchain development, we need a reproducible
computation model that supports modern operating systems.
Cartesi
This paper describes Cartesi, a layer-2 platform for the develop-
ment and deployment of scalable decentralized applications. Cartesi
DApps are hybrid, i.e., they include both blockchain and off-chain
components.
The off-chain component runs in a network of Cartesi Nodes (sec-
tion 6), each representing the interests of a DApp user. The off-chain
component is further divided into two modalities. Native compu-
tations run directly in the host hardware. Although native compu-
tations have access to the node’s full processing power (including
GPUs), the computations are not reproducible, at least not a pri-
1
V ersion 1.01
ori. Reproducible computations run instead inside Cartesi Machines
that are controlled by the Cartesi Node. These are general, fully
self-contained Linux systems, that run on a deterministic RISC-V
architecture (section 3). Nodes interact with Cartesi Machines by
means of a well-defined host interface (section 4).
Within the blockchain, a Cartesi DApp can specify reproducible off-
chain computations to be performed over large amounts of off-chain
data (section 5). Cartesi Nodes can automatically follow these speci-
fications to perform the computations off-chain. DApp developers
can instruct the nodes to submit results or verify and dispute results
submitted by others. From the blockchain’s perspective, undisputed
computations take negligible resources. Even in case of disputes, the
settlement cost is only the logarithm of the storage and time required
during the computation. Off-chain, Cartesi Nodes never experience
more than twice the space and time required by the computation. In
this way, Cartesi virtually eliminates the gap in storage and com-
putation power between smart contracts and traditional computer
programs.
Moving computations off-chain brings several advantages beyond
scalability. Cartesi Machines enable DApp developers to use all the
programming languages, tools, libraries, software, and services they
are already familiar with. Moreover, the way in which computations
are formulated is agnostic to the underlying blockchain. By isolating
all the complex smart-contract logic into reproducible off-chain com-
putations, developers can make their DApps more portable across
different blockchains.
The focus of this document is the core of Cartesi. It includes the
full specification for the Cartesi Machine, the host interface for con-
trolling it, the blockchain interface for specifying complex off-chain
computations, and the Cartesi Node interface for performing and
verifying these computations. Higher-level tools, interfaces, and a
variety of use cases built on top of this core functionality will be de-
scribed in a future document [ Teixeira and Nehab 2019a]. Detailed
documentation on all interfaces, as well as the development environ-
ment for Cartesi Nodes and Cartesi Machines will be available from
the Cartesi SDK [ Teixeira and Nehab 2019b].
2 Related work
The work most closely related to Cartesi is TrueBit [ Teutsch and
Reitwießner 2017]. The connection between Cartesi and Truebit
comes from the fact that both technologies move intensive compu-
tations off-chain and then, within the blockchain, use a verification
game [Feige and Kilian 1997] to efficiently settle disputes regarding
the results of these computations. Despite this similarity, many other
design decisions set these two technologies apart.
TrueBit is based on WebAssembly [2018], a VM ISA designed by
a W3C Community Group to support efficient web applications. 1
In contrast, Cartesi is based on RISC-V [ Waterman and Asanovi´c
2017a,b], an open ISA designed in UC Berkley for implementation
by native hardware. The WebAssembly and RISC-V ISAs are of
similar complexity. The key difference is their position in relation to
applications and the operating system. WebAssembly was designed
to sit between applications and the underlying operating system.
RISC-V is instead meant to sit under the operating system and the
applications it supports. TrueBit’s choice is consistent with a focus
on extending the computational power of smart contracts, which
tend to operate under severely restricted environments. Real-world
applications, however, cannot exist in isolation. They depend on
rich, complex run-time environments that are invariably built on top
of a modern operating system. To give developers of decentralized
1It was originally based on the LL VM back-end for an obscure Myricom
NIC embedded processor design used internally at Google.
applications access to the tools, libraries, services, and software they
are already familiar with, Cartesi chose to support Linux. A realistic
ISA, such as RISC-V , is much better suited for this purpose.
One of the differences of greatest consequence is in how Cartesi
aligns the interest in off-chain computations with the responsibility
for their execution. In TrueBit, there is no such alignment. A smart
contract posts the computation to a pool of untrusted parties and
waits for one of them to perform it off-chain and post the result
back. In this sense, TrueBit can be seen as a means for increasing
the computational power of individual smart contracts. Cheating is
prevented with a complex incentive layer that rewards pool members
for successively disputing incorrect results. To keep the members
engaged, computations with incorrect results must be artificially
injected by the incentive layer. This inefficiency is a fundamental
part of the design of TrueBit. Conversely, Cartesi can be seen as a
way for off-chain computations to be endorsed by a smart contract.
All parties that could be affected by this endorsement are responsible
for performing the computation off-chain and, if needed, starting
a dispute. Although the ensuing verification can be outsourced to
a dispute resolution market (see section 6.2), there is no built-in
inefficiency and no need for an incentive layer.
The large storage requirements of real-world computations pose a
significant challenge that TrueBit does not address. Explicit repre-
sentations of code and data do not fit within the blockchain. Instead,
a Cartesi Machine, together with its code and data, are represented
on-chain by a hash of its state. This arrangement allows for complex
transactions built from several rounds of off-chain computations to
be fully specified. The states themselves are only ever known ex-
plicitly off-chain, by interested parties. Some applications can face
data availability issues to which Cartesi offers a range of original
solutions [Teixeira and Nehab 2019a].
Finally, Cartesi is committed to making off-chain computations
portable across different blockchain platforms.
2.1 Other related technologies
New blockchain technologies emerge at such a high rate that any
attempt at a comprehensive survey is doomed to become obsolete
before it is even published. Nevertheless, some general trends merit
discussion. Specific examples cited in the discussion should be seen
as representatives of entire categories, rather than exhaustive lists.
Layer-1 scalability solutions The scalability trilemma put forth
by Buterin [2018a] poses that no simple workaround can improve
transaction throughput without reducing the decentralization or se-
curity of a blockchain. On the one hand, requiring higher throughput
from nodes raises their operating cost, which centralizes power in
the hands of the few players that can afford them. On the other,
fragmenting consensus into independent chains makes each of them
more vulnerable to 51% attacks.
The two leading proposals for breaking the trillema are refinements
of these two ideas. Delegated Proof of Stake (e.g., Larimer [2017])
requires a small number of powerful nodes to validate every single
transaction. However, these nodes are democratically elected by all
parties that hold a stake in the blockchain. The alternative proposal
is to split the state and history into multiple shards that are verified
independently [Buterin 2018b]. These shards are then connected to
a main chain in a way that reduces the odds of successful attacks.
Both ideas are expected to significantly improve the throughput of
transactions processed by the blockchain. They must nevertheless
achieve universal consensus among nodes on each transaction. This
imposes a super-linear global cost as computation sizes grow.
2
V ersion 1.01
Cartesi, on the other hand, is designed to achieve local (instead of
universal) consensus over its computations. More precisely, only
affected parties are required to perform the computation, while
any possible dispute among them can be resolved in logarithmic
time. This design allows for intensive computations to be performed
off-chain only by the impacted participants, who still enjoy strong
conflict resolution guarantees.
In this way, DPoS and sharding are orthogonal to Cartesi. Cartesi
benefits from the faster and cheaper transactions provided by the
underlying infrastructure. Conversely, the blockchain benefits from
Cartesi’s ability to specify and adjudicate large-scale realistic com-
putations.
Layer-2 scalability solutions V arious solutions have been pro-
posed on the second layer to increase blockchain scalability in terms
of transaction throughput, such as Plasma or State Channels. These
developments have particularities of their own, but are generally
designed to register large amounts of transactions off-chain, which
are only committed on-chain in order to reach finality or in the case
of a dispute. A common requirement of these solutions is that the
blockchain should be able to resolve any dispute that may arise (after
a Plasma exit, or when a channel is closed). These exit mechanisms
impose strong limitation on the maximum transaction size that either
Plasma or State Channels can handle. So for example, if two parties
disagree on an off-chain transaction that requires a large computa-
tion to be completed, they would be unable to settle who is correct
on the main chain.
Cartesi can greatly improve these technologies, as it allows both a
Plasma chain or a State Channel to specify full Cartesi computations
within its transactions. And in case a dispute lifts the computation
to the main chain, the settlement can still be efficiently and safely
resolved.
Reputation solutions Several projects intend to bring large scale
and flexible computations to the blockchain by relying on a system
of redundancy, reputation, and verification (e.g., SONM [2018],
Golem [2016], and iExec [2017]). Although all these systems have
different designs, the main idea is that computations are sent to a
pool of off-chain providers, who submit their results independently.
If someone challenges the presented results, a randomly assigned
verifier decides on the correct outcome.
Although these systems have a built-in reputation mechanism to
discourage misbehavior, it is not yet clear whether they are resistant
to collusions or bribing in case the outcome of a computation can
have financial consequences. Cartesi gives instead mathematical
guarantees on its dispute resolutions.
Trusted execution environment Several projects are integrating
enclaves (e.g., Intel’s SGX, ARM’s TrustZone, or AMD’s SEV) with
the blockchain [ TEEX 2018; Song et al. 2018; Enigma 2018; Cheng
et al. 2018]. In a nutshell, enclaves are hardware-supported features
that allow user-level code to create an execution environment whose
privacy and integrity is protected even from processes running at
higher privilege levels.
Computations running inside enclaves are not, a priori, reproducible.
Using remote attestation in lieu of verification is equivalent to trust-
ing the hardware manufacturer. Whether this level of centralization
is justifiable or not depends on the application at hand, the manu-
facturer’s competence, and on the potential for conflicts of interest.
Even setting these issues aside, privacy is not always guaranteed,
as recent attacks show [ Weichbrodt et al. 2016; Brasser et al. 2017;
Moghimi et al. 2017; Lee et al. 2017].
Enclaves may yet play an important role in the future of blockchain
technology. However, their threat model and security guarantees are
very different from Cartesi’s. Future applications may wish to com-
bine both technologies by running part of their native computations
inside hardware enclaves within Cartesi Nodes, or by running an
entire Cartesi Node inside a hardware enclave.
Zero knowledge proofs Another approach to enable private and
scalable computations on the blockchain is to use general purpose
zero-knowledge proof systems such as zk-SNARKS [ Blum et al.
1988; Bitansky et al. 2012] or zk-STARKS [Ben-Sasson et al. 2018].
These systems achieve verifications in a fast, non-interactive and
private manner. However, the computations that can be specified
within these models are very restrictive as they are derived from
arithmetic circuits without control flow. Therefore, they are not
Turing complete and cannot run arbitrary code.
In off-chain environments, this technology is reaching maturity
thr프로젝트로 돌아가기