bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 3쪽 중 2쪽
modelofthemultipleblockchainsystem, wepresentanewDAppprogramminglanguage,
called “Recipe.”
How Bifrost works. The multiple blockchain environment is composed ofBifrost Con-
tainers. A set of Bifrost Containers establishes a blockchain network and connects to the
existing blockchain networks, such as Ethereum. For a DApp, theBifrost process consists of
a (1) development phase, (2) deployment phase, and (3) operation phase. In the development
7
phase, a DApp developer selects the multiple blockchain combinations that fits his/her require-
ments, and writes the smart contract code in Recipe, indicating which functions and variables
are matched to which blockchains in the smart contract code. In the deployment phase,Bifrost
splits and converts DApp codes into multiple components and generates the description for the
interoperation of the components. Each component code is transpiled to the program language of
the smart contract of the blockchain system.Bifrost then automatically checks the correctness
of each component. The verified component can be deployed into each blockchain system. In
the following operation phase, theBifrost Container supports interoperation between the split
components from a DApp.
The overall process. Figure 1 shows the overall process ofBifrost. The detailed process is
as follows.
1. The developer designs a blockchain service and DApp and selects aBifrost Container to
get a desirable combination of multiple blockchains.
2. The developers writes the smart contract code for the DApp in Recipe.
3. The developer marks the target blockchain in the smart contract code.
4. Bifrostanalyzesthesmartcontractcodeandsplitsitintocomponentsforeachblockchain.
It also generates the description, which contains the interface details to connect the com-
ponents.
5. Bifrost deploys the components and the description to each part.
In the operation phase,Bifrost supports the interoperation of the DApp as follows:
• Each component can employ the unique features of the underlying blockchain.
• The Bifrost Linker interconnects the data and control flows between the components.
Bifrostdoes not recreate a new blockchain system, but puts the existing blockchain systems
into the placeholders. The whole Bifrost system itself runs by Bifrost Nodes. Each Node
is connected to the selected existing blockchains and has aBifrost Container. For clarity, we
first describe the elements of the Node system and then explain the DApp building process with
Recipe, and the Linker operations.
2.3 Node architecture
Bifrost Node systems have an architecture to build an execution environment of the multi-
ple blockchain systems to DApps. When connecting different blockchain systems, we need to
handle the layered interconnection, since a single blockchain system already consists of multiple
functional layers, such as consensus, network, and smart contract modules. Hence, the architec-
tures of Bifrost Node systems are represented as stacks of supporting modules and blockchain
systems.
8
#MPDLDIBJO
"
&YUFSOBMMZ
PQFSBUFE
$POUBJOFSNBOBHFS
#MPDLDIBJO#
.BOBHFBCMF
$POUBJOFST
0QFSBUJPO4UBDL
&YFDVUJPO4UBDL
Figure 2: Bifrost Node architecture
Modular design. One of the sub-goals ofBifrostNode systems is to provide flexibility in the
selection of a blockchain system. ABifrostNode has a Container manager and Containers. The
Container consists of a manageable blockchain system, Linkers for interconnection between DApp
components, Input/Output (I/O) interfaces for external connection, and the connection manager
to handle networking. The Container manager is in charge of the creation and management of
Containers and is integrated with the Docker container system.
Stacks in two views. Figure 2 shows the logical composition of theBifrost Node. The
structure of theBifrost Node can be represented as a 3-dimensional (3D) stack to depict how
the modules are constructed and how they work for DApps. First, the execution stack shows the
structure of functional modules paralleling the externally operating blockchain system. In the
operation stack, we illustrate howBifrost executes the DApp components with the resources
of blockchain systems.
2.4 Execution stack
The execution stack of Bifrost is shown in Figure 3. It has a layered structure to build an
interworking platform with multiple blockchain systems. Thus, the execution stack has two
pillars: one for the (existing) public blockchain system and the other for the managed blockchain
Container. Most linkage modules reside in theBifrost Container.
We assume that a blockchain subsystem including a consensus algorithm and network module
and a runtime environment to execute smart contract. TheBifrost Node uses the externally
operating blockchain system without any modification.Bifrost runs the multiple components
9
/PEF
-JOLFS
Blockchain
Subsystem
Smart Contract
Runtime Environment
(e.g., EVM)
Blockchain
Subsystem
Smart Contract
Runtime Environment
DApp
component
DApp
component
Token
System
DApp-
wise
Linker
I/O
interface
Coin
Eco-
system
User
Interface
Dual
Conn.
Manager
Container-
wise
Linker
Container
Manager
.BOBHFECMPDLDIBJO
&YUFSOBMMZPQFSBUJOHCMPDLDIBJO
DApp
Figure 3: Bifrost execution stack
from DApps and maintains a token system ofBifrost, BFC (§4.1.1).
Container. A Container has a blockchain subsystem and the following modules:
• Blockchain Subsystem + Smart Contract Runtime Environment: Any blockchain subsys-
tem is applicable if it has basic functionality on a smart contract.
• Connection Manager: The connection manager maintains the duplex connections among
multiple blockchain systems. When the managed blockchain network forms a federation,
where multiple institutes participate in a network, the connection manager also supports
the connection between the Nodes in the federation.
• Linker: Bifrost splits a single DApp into components and deploys them to each target
blockchain subsystems. During the split,Bifrost inserts stub codes into each component
for interoperation. Linkers help the components to interwork with the stub codes. Linkers
are classified as the DApp-wise and the Container-wise Linkers for interoperation at the
level of DApps and Containers, respectively.
• I/O Interface and I/O Taps: The external connections for web, external storage, oracle
(data feed) are supported through the I/O Interface module. In order to interact with
the smart contract, the I/O Interface uses the I/O Tap, which is another smart contract
account, as a connecting account.
10
I/O Module
I/O Module
#MPDLDIBJO# #MPDLDIBJO"-JOLFS
DApp (1)
component
DApp (1)
component
I/O
Tap
DApp (2)
component
I/O
Tap
I/O
Tap
DApp (3)
component
DApp (3)
component
DApp (1)
Linker
DApp (2)
Linker
DApp (3)
Linker
Token system
Figure 4: Bifrost operation stack
2.5 Operation stack
Figure 4 depicts the operation stack, which shows how DApp components work with other mod-
ules. Each DApp has its own a Linker and an I/O Tap. They both reside in the Bifrost
Container. The configurations of the Linker and I/O Tap are generated whenBifrost splits the
components since they are dependent on the internal structure of the DApp.
Thebehaviorsofthecomponentareobviouslyloggedandvalidatedbytheunderlyingblockchain.
However, the Container-wise Linker manages the cost for execution (e.g., gas in Ethereum) de-
pending on the execution/pricing model of the blockchain. In addition,Bifrost has a token
system, called “BFC.” By the DApp-wise Linker convertingBFC to the native coin for the com-
ponent in the managed blockchains, all the components onBifrost can have a unified token
system.
I/O Interface and T ap A Container has the I/O Interface module for external connection,
which interacts with the components via the I/O Tap. The I/O Interface modules helps the
DApp to employ the external/decentralized storage and periodic operations requiring timers.
3 Recipe for Multi-component DApps
3.1 Motivations
Bifrost lets DApps reap the benefits from the multiple blockchain systems. To do so, the DApp
development requirements can be summarized as follows:
11
1. The split components of a DApp can interoperate as a DApp.
2. Each component should be transformed into a native form of the underlying blockchain
system.
Therefore, the approach ofBifrost is tosplit and transpileDApps for the multiple blockchain
environments.
Abstraction layers for universal programs. Traditionally, to make a program run on het-
erogeneous computing systems, one adds an abstraction layer, such as a virtual machine or OS,
with a newly defined abstract instruction set. However, in the abstraction layer approach, the
abstract instructions are translated to native instructions during execution on the fly. This in-
direct execution not only hinders the use of machine-specific features in the program but also
slows down overall performance.
T ranspilation to eliminate abstraction layers. Bifrost DApps and universal programs
have similar goals. We want to make DApp semi-universal on the specific combination of the
multiple blockchains and to avoid the limitations of abstraction layers. Thus, we take the multi-
stage programming approach, which is known for “abstraction without guilt.” We represent a
DApp in a high-level language form and split it into multiple components. Then, we transpile
each high-level component into the code in the lower-level programming language of the target
blockchain system. The smart contracts have interesting quirks: A smart contract code is sig-
nificantly smaller than the codes of the general computing environment, and it is functionally
self-containing. Thus, the smart contract code is suitable for the code-level transformations.
3.2 Recipe language system
With this approach, we have to deal with the following challenges:
• DApp developers need a way to write down blockchain-agnostic (or semi-universal) DApp
codes.
• The multi-component DApp should be aware of the cross-execution. Even thoughBifrost
Linkers facilitate the simultaneous execution of the components, it is hard to perform an
action that causes the cross-execution between the blockchains synchronously. The DApp
needs to adapt this asynchronous execution in the program model.
• For a smart contract, we always need to consider both the correctness and the fairness of
the code. Furthermore, adding asynchrony makes the correctness checks more difficult.
To overcome the challenges, we build a new program language system forBifrost. We
guide the developers to adapt the cross execution model of the multiple blockchain systems, and
support the split and transpilation process by leveraging the new program language system. We
12
Recipe
(High-level Lang.
for DApp)
RIL
(Recipe Intermediate
Language)
RILA RILB
Target Language
Low-level
Target Language
Module (blockchain
specific)
Module (blockchain
specific)
Target Language
Low-level
Target Language
SCRE code SCRE code
Linker
Desc.
Transpile Transpile
Split Split
Machine code
Abstracted
Figure 5: Recipe Language System
design a high-level language, called “Recipe,” and define a Recipe intermediate language (RIL)
for internal representation with transpilation rules. Figure 5 shows the structure of the Recipe
language system and its stages. In Figure 5, the languages become closer to machine code (or
bytecode) as they get closer to the bottom.
The Recipe Language System support the following stages:
• Recipe: Ahigh-level, declarativeprogramminglanguageusedtodescribeblockchain-independent
smart contracts. It has explicit marks to designate variables and functions to a target
blockchain system. It supports the asynchronous program model for the execution with
the cross-state between the split components. Recipe can also append the semantic infor-
mation to facilitate automatic security verification of the code.
• RIL: An intermediate language used to process and analyze the code in Recipe. The DApp
code is lifted into RIL when it starts to be transformed (i.e., split and transpiled). RIL has
a simple syntax for pattern-matching program analyzers. RIL also has a module system
for adaptive transpilation for different blockchain systems.
• Target languages: The existing programming languages used to develop smart contracts
(e.g., SolidityandGo). Weclassifythelanguagesthatcanbeusedasintermediatelanguages
13
in the building process, as low-level target languages (e.g, LLL and LLVM).
• Smart Contact Runtime Environment(SCRE) code: The executable code of smart contracts
in the blockchain systems.
3.3 Splitting and transpilation
Recipe supports the splitting and transpiling operations at the language levels. According to the
indication in the Recipe program code,Bifrost lifts the code into RIL and divides it.
Cross variables and functions. We define the variables and the functions used in both
components as “cross variables” and “cross functions,” respectively. Based on the selection of the
cross variables and functions, we categorize the other variables as “component local variables.”
Since the cross variables and functions are used between the components, the intervention of the
DApp-wise Linker is required. Thus, the cross variables and the result from the call to the cross
functions have two states:transient and finalized. A value of the transient state should not be
used since it is under the intervention for update. Afterwards, when it has reached the finalized
state, the value can be applied to the DApp. During the splitting process,Bifrost adds lock
and unlock codes for each cross variable. In addition, Recipe provides a callback handler for the
function call to the cross functions.
Process to build smart contract components. The splitting and transpilation process for
the components is as follows:
1. Based on the marks in the Recipe code, initially classify the variables and functions for
each component.
2. Lift the Recipe code into the RIL form.
3. Generate control and data dependency (super-)graphs based on the flow analyses on RIL.
4. Divide the RIL code into the components. Suppose two component as RILA and RILB.
5. Identify the component-crossing(inter-component) control flows and data flows and re-
adjust RILA and RILB with the updated flow information.
6. Add stub codes on the crossing point for each RILA and RILB. Convert an assignment
statement to the cross variable into a setter function, and add handlers for cross-function
calls.
7. Collect the interface information on the cross variables and functions and generate the
Linker description, which is delivered to Linkers to support the interoperation.
8. Automatically verify each component in terms of correctness and fairness.
14
9. Transpile RILA and RILB into each target language with the syntax rules for code gener-
ation and the blockchain-specific modules system.
After this process, from a DApp Recipe code, Bifrost can get the components for each
blockchain subsystem and a Linker description for its DApp-wise Linker. Bifrost initiates
the DApp service by deploying the SCRE codes of the components and delivering the Linker
description to a Linker in the Container.
Bifrost performs automatic detecting of vulnerability patterns after generating the split
components. Inordertocheckservice-widecorrectness, italsoappliesthemodel-checkingmethod
with a model generated from the semantic information of the components (given by developers)
and the Linker description.
4 Linker & BFC System
Sub-goals of Linkers. Bifrost combines the existing blockchain systems and lets the split
components run like a single DApp. After the multi-component DApp is prepared in §3, the
Bifrost Linker takes charge of the interoperation of the components. The Linker serves as
a relaying proxy and it maintains shared information between the components and supports
cross-function linkages. Since the smart contract of DApps has a different model from the gen-
eral computing environment, the interoperation method also has a different approach. A smart
contract has a permanent storage on the blockchain, a balance for native coins, as well as an
internal state. Thus, the Linker has the following sub-goals to provide reliable interoperations
for multi-component DApps:
• Transparent interoperation: The components from a DApp in the Recipe language should
interwork via the Linker without additional work.
• Platform-wide, unified coin (token) system: The DApps inBifrost should be supported
by a unified coin (or token) system in any combinations of blockchains.
• Relay availability: Whenever the components run, the Linker is available and supports the
interoperations.
• Adjustable finality: The consensus mechanism determines the characteristics on the finality
of a blockchain system. For example, Proof of Work (PoW)-based blockchain systems have
probabilistic finality, and Proof of Stake (PoS)-based blockchain systems generally have
(pseudo) instant finality. Hence, when Bifrost combines multiple blockchain systems
of different finality types, the Linker should manage the updates of different finalization
conditions.
Interworking on Bifrost. In order to achieve the sub-goals, we introduce a platform-wide
token system, BFC, and present the interoperation mechanism ofBifrost Linkers for the data
15
and control parts of DApps. For Linker availability, Bifrost provides logical and physical
redundancy of Linkers executed in parallel. In addition,Bifrost helps the Linker to support
adjustable finality based on the finality option in the Linker description.
4.1 Interworking via Linkers
In this subsection, we first describe a unified currency forBifrost, called BFC, and then define
the roles of Linkers in the interoperation of data and controls.
4.1.1 BFC operation
BFC resides in an existing blockchain as a token system (e.g., ERC-20 compatible tokens). Thus,
the component of DApps on the blockchain can useBFC directly. For the component on the
different side, BFC can be converted to the native coin if it is a managed blockchain. In that
case, Linkers perform 1-to-1 exchanges ofBFC to the native coins of the managed blockchain.
Thus, the component can use the native coins, converted fromBFC, to pay execution costs (e.g.,
gas) or to build coin-based services.
Note that BFC is a platform-wide token inBifrost so that any DApp inBifrost can use
it. However, a DApp can also have its own token systems in the public blockchain system. The
DApp can use all the functions of the token systems through the component on that public
blockchain system.
4.1.2 States
In Bifrost, a Linker handles the following states:
• Cross variables: The permanent storage of the smart contract is differently implemented
in low-level code in the blockchain systems. However, in the high-level programming lan-
guages, such as Solidity, it is abstracted as variables. Thus, Linker also identifies all cross-
state information between components as variables.
• Native coin balance (managed blockchain): The balance of the component in the native
coin of the managed blockchain.
• Component address: The address of the DApp component at the deployed blockchain
system.
• BFC balance: The balance ofBFC of each DApp.
4.1.3 Actions
The Linker also connects the followings action between components:
• Cross-function call: When a function in a component calls another function in another
component, the Linker relays the function call between components.
16
#BTFCMPDLDIBJO
#MPDLDIBJO"
$POUBJOFSXJTF
-JOLFS
DApp
component
DApp
component
DApp-wise
Linker
S
C
4UBUFWBSJBCMFT
4UBUFWBSJBCMFT
/BUJWF
DPJOCBMBODF
S’
C’
B #'$CBMBODF
C’
B
/BUJWFDPJO
CBMBODF CBTF
#'$CBMBODF
/BUJWF
DPJOCBMBODF
Figure 6: Internal states of DApp and Linker
• Cross-state update: When a change of a cross variable occurs, the Linker updates the
variable in the other component.
4.2 DApp-wise and Container-wise Linkers
As shown in Figures 3 and 4, Linkers can be classified into two types:
• DApp-wise Linker: It is generated for each DApp and takes charge of the interoperation of
the designated DApp. In the deployment phase,Bifrost configures the DApp-wise Linker
ba프로젝트로 돌아가기