-
Notifications
You must be signed in to change notification settings - Fork 1
architecture
The following describes the architecture of the demonstrator, in particular regarding how it interacts with the OmniLedger blockchain for authorization, Stainless verification and EVM code execution.
The demonstrator leverages the dynacred library for user authorization. Once authorized, additional information is stored in the user credentials structure as described below.
In order to perform code verification and compilation to EVM bytecode, the demonstrator uses an OmniLedger service that provides a set of commands. The commands execute on the server, calling Stainless and retrieving the results. These commands don't interact with the blockchain; for this purpose, OmniLedger is used solely as a means to access Stainless and the Solidity compiler remotely. This functionality may be embedded in any OmniLedger conode, whether it belongs to a cothority or not.
The EVM bytecode produced by compiling the Stainless-generated Solidity code is meant to target the Ethereum blockchain. C4DT has however developed a compatibility layer embedding an EVM into Omniledger (BEvm), which allows to deploy and execute Smart Contracts. The demonstrator makes use of this feature to allow deployment and user interaction with the verified contracts. As the EVM layer is not yet included in the main OmniLedger cothority deployed at Dedis, a dedicated BEvm cothority is deployed for this purpose.
Following the previous paragraphs', the demonstrator requires the following information for its configuration:
- Dedis cothority information:
- Roster
- ByzCoinID
- Admin Darc [?]
- BEvm cothority information:
- Roster
- ByzCoinID
- BEvm contract Instance ID
- Address of the Conode running the Stainless service
- Other:
- BEvm user private key for signing instructions to the BEvm instance
- BEvm contract Instance ID
- BEvm user private key for signing instructions to the BEvm instance (same for all users)
- EVM Account private key, account nonce (unique per user)
- Addresses of the deployed contracts
- bc_admin: Create ByzCoin instance --> ByzCoinID,
bcadmin_key
,Darc_admin
bcadmin --config . create --roster roster.toml --interval 500ms
- bevm_admin: Create
bevm_admin_key
bcadmin --config . key
- bevm_user: Create
bevm_user_key
bcadmin --config . key
- bc_admin: Create
Darc_bevm
for bevm_admin
bcadmin --config . darc add --bc bc-<ByzCoinID>.cfg --unrestricted --identity ed25519:<bevm_admin_pub> --desc "BEvm Darc"
- bevm_admin: Add rules to
Darc_bevm
bcadmin --config . link roster.toml <ByzCoinID> --darc <Darc_bevm_ID> --identity ed25519:<bevm_admin_pub>
bcadmin --config . darc rule --bc bc-<ByzCoinID>.cfg --rule "spawn:bevm" --identity ed25519:<bevm_admin_pub>
bcadmin --config . darc rule --bc bc-<ByzCoinID>.cfg --rule "delete:bevm" --identity ed25519:<bevm_admin_pub>
bcadmin --config . darc rule --bc bc-<ByzCoinID>.cfg --rule "invoke:bevm.credit" --identity ed25519:<bevm_user_pub>
bcadmin --config . darc rule --bc bc-<ByzCoinID>.cfg --rule "invoke:bevm.transaction" --identity ed25519:<bevm_user_pub>
- bevm_admin: Create BEvm instance (-->
bevmadmin
command-line tool callingspawn:bevm
) --> BEvm Instance ID
bevmadmin --config . spawn --bc bc-<ByzCoinID>.cfg
- bevm_user: Credit EVM accounts (
invoke:bevm.credit
), deploy and interact with Smart Contracts (invoke:bevm.transaction
)