Skip to content

Commit

Permalink
Merge pull request #501 from cardano-foundation/staging
Browse files Browse the repository at this point in the history
EVM and Glow updates
  • Loading branch information
iohkwebdev committed Feb 25, 2021
2 parents 843f750 + 53764e2 commit f4b2f1c
Show file tree
Hide file tree
Showing 27 changed files with 635 additions and 8 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Expand Up @@ -2,6 +2,6 @@
title: IELE
description: IELE section
parent: 2020-05-04_07-00-00_virtual-machines
order: 3
order: 4
last_updated: "2020-05-01T09:00:00+01:00"
---
Expand Up @@ -8,11 +8,11 @@ hasNoChildContent: true
---
## Overview

Glow is a new domain specific language (DSL) for developing decentralized applications (DApps) on blockchain. With Glow, you can write secure DApps and be assured that your smart contracts can run safely in an adversarial environment. Glow is the brainchild of [MuKn](https://mukn.io), a valued community partner within the Cardano ecosystem.
[Glow](https://glow-lang.org/) is a new domain specific language (DSL) for developing decentralized applications (DApps) on blockchain. With Glow, you can write secure DApps and be assured that your smart contracts can run safely in an adversarial environment. Glow is the brainchild of [MuKn](https://mukn.io), a valued community partner within the Cardano ecosystem.

Glow is a language to develop not just a smart contract, but an entire DApp itself, which also includes client code and formal proofs. It is backed by formal methods that are intrinsically built into the language and its actual implementation. It is this inherent correctness of the language that means the code will perform as expected and the DApp will behave as users want (so users do not have their transactions blocked or their assets locked).

Additionally, the Glow compiler generates matching client code, and a logical model of your DApp, so you can actually prove that it is correct prior to deploying it. From a single Glow specification, the compiler will generate matching code for both the DApp client and the smart contract itself. The runtime component tracks the code versions to ensure you are always using the correct, matching, and trusted versions of both the client and smart contract. Finally, since correctness is such a priority for DApps, Glow helps you specify a logical model of your DApp, so you can formally verify that it is indeed correct.

We are currently working on additional documentation to support our integration with Glow, and explain exactly how you can use and interact with this language. We’ll be expanding these pages over the weeks and months ahead; [take our short survey](https://input-output.typeform.com/c/OJsf0XcD) to be kept informed of all the latest updates.
Glow is the very latest addition to the suite of developer tools languages for Cardano. Here’s where to get started. We will be expanding the list of resources and documentation to support our integration with Glow over the weeks ahead. If you want to get involved, please join our dedicated devnets developer program by [taking our short survey](https://input-output.typeform.com/c/OJsf0XcD).

@@ -1,13 +1,13 @@
---
title: FAQs for KEVM and IELE
description: Frequently asked questions on KEVM
order: 4
title: FAQs for Virtual Machines
description: Frequently asked questions on Virtual Machines
order: 5
external_href: ""
parent: "2020-05-04_07-00-00_virtual-machines"
last_updated: "2020-12-15T11:30:00+01:00"
last_updated: "2021-02-25T11:30:00+01:00"
---

## FAQs for KEVM and IELE
## FAQs for Virtual Machines

Note: At this point in time, we are restarting and accelerating the K
Ethereum Virtual Machine (KEVM) program *only*. The IELE program will be coming very soon, but you can learn about IELE's features and benefits in this page.
Expand Down
@@ -0,0 +1,7 @@
---
title: Getting started
description: Study Glow using code examples
order: 2
parent: 2020-05-04_06-00-00_glow
last_updated: "2021-02-03T07:00:00+01:00"
---
@@ -0,0 +1,11 @@
---
parent: 2021-02-03_07-00-00_getting-started
title: Glow tutorial
description: Installation instructions
order: 3
last_updated: "2021-02-25T09:00:00+01:00"
---

# Glow Tutorial

We’ll update this section soon with tutorials and guides. Make sure you sign up to our [devnets newsletter](https://mailchi.mp/iohk/devdigest) to get the latest updates delivered to your inbox
@@ -0,0 +1,11 @@
---
title: Smart Contracts Architecture
description: EVM Smart Contracts Architecture
parent: 2021-02-25_11-00-00_about
order: 2
last_updated: "2021-02-25T09:00:00+01:00"
---

## Smart Contracts Architecture

The smart contract architecture is the same for the KEVM and EVM; see [smart contracts architecture](/en/virtual-machines/kevm/about/iele_vm_architecture/) for more details.
@@ -0,0 +1,22 @@
---
title: Installing Glow
description: Installing Glow
parent: 2021-02-03_07-00-00_getting-started
order: 1
last_updated: "2021-02-25T09:00:00+01:00"
---
## Installing Glow

The first step is to install Glow so that you can get started. Glow can be installed on either Linux or MacOs. You can run the installation inside a virtual machine and for extra security we recommend that you use [Qubes OS](https://www.qubes-os.org/).

To install Glow, follow these steps:
1. Open a terminal window (or any application on your system that allows you to enter shell commands).
2. Type the following command line:

`curl -L https://glow-lang.org/install/glow-install | sh`

This installation script first installs the [Nix](https://nixos.org/) package manager, which may require you to manually type yes, or y and/or type the administrator password to authorize parts of the installation. If you were not using Nix before, you may have to start a new shell for the PATH to be set up correctly and be able to run glow.

**Note**: If you use Linux or macOS on x86_64, all the binary packages for the software are cached, and the installation should only take a few minutes, depending on the speed of your internet connection. This software may require over 2GB of memory, so please ensure that you have enough available space on disk. If you use another platform, your computer may recompile code from source, so you should let it run overnight.

We plan to release a Docker image soon, so please check back for updates.
@@ -0,0 +1,160 @@
---
title: Setting up the Test Network
description: Setting up the Test Network
parent: 2021-02-03_07-00-00_getting-started
order: 2
last_updated: "2021-02-25T09:00:00+01:00"
---
## Setting up the Test Network

By default, Glow will use the Cardano EVM Devnet (“ced”)—a public network on which you can interact with other users. You may experience a short delay of a minute or so when confirming each step of the interaction.

For faster local-only tests with confirmations in a couple of seconds, you can instead run your own private Ethereum test network (“pet”) on your computer with these instructions. You should add the flags --evm-network pet to your invocations of Glow, as follows:

`git clone https://github.com/fare/gerbil-ethereum.git
cd gerbil-ethereum
./scripts/run-ethereum-test-net.ss`

### Creating Keys
Each participant must first generate their own identity on their own machine, with their own secret key, as follows:

Alice:

`glow generate-identity --nickname Alice`

Bob:

`glow generate-identity --nickname Bob`

### Sharing Contact Information
After creating your key, you must share it with the other participant in the interaction (for example, using a chat application such as Slack).

First, each participant lists their address using:

`glow list-identities`

The listed addresses will appear in the following format (these are examples):

`Alice [ 0xa71CEb0990dD1f29C2a064c29392Fe66baf05aE1 ]`
`Bob [ 0xb0bb1ed229f5Ed588495AC9739eD1555f5c3aabD ]`

Each participant then uses a copy and paste function to share their address with the other participant, who will register it as follows:
Alice replaces the address with Bob’s actual address, as follows:

`address=0xb0bb1ed229f5Ed588495AC9739eD1555f5c3aabD`
`glow add-contact --nickname Bob --address ${address}`

Bob replaces the address with Alice’s actual address, as follows:

`address=0xa71CEb0990dD1f29C2a064c29392Fe66baf05aE1`

`glow add-contact --nickname Alice --address ${address}`

### Getting Tokens from the Faucet:
As your address is a new address it does not have any tokens to spend, or to use to pay for gas. To get some tokens for your address you can use the test network’s faucet, as follows:

Alice runs:

`glow faucet --to Alice --evm-network pet`

Bob runs:

`glow faucet --to Bob --evm-network pet`

(If you are using your own private Ethereum test network, the two commands above and every command below (with the exception of the digest command) are where you must add the flags --evm-network pet to your invocations of glow.)

### Configuring the Interactions
This section outlines how you should configure the contract interactions of Alice and Bob.

#### Setting up Alice’s Interaction
One of the two participants writes a document for the other to sign. For example, Alice prepares the following document and sends it to Bob for review:

`echo “Bob sells BLAH to Alice” > document.txt`

When both agree on the document, they should each compute its digest with:

`glow digest document.txt`

Now, Alice can sign the interaction. In the scenario where you are running the interactions on the same machine, you should specify a database so the two users will not conflict with each other’s data; the extra database specification is not necessary if the users are running on different machines.

`glow start-interaction --database run/Alice --evm-network pet`

The CLI will then prompt Alice to select an application, choose which identity to use for the interaction, which role they will play in it, assign addresses to roles of the other identities, enter the interaction parameters, and finally, print the interaction agreement for Alice to send to Bob, so that he can configure his side of the interaction with the same parameters.

Here is an example of what the setup should look like from Alice’s side:
```
Choose application:
1) coin_flip
2) buy_sig
3) rps_simple
Enter number
> 2
```
```
Choose your identity:
1) Alice - 0xa71CEb0990dD1f29C2a064c29392Fe66baf05aE1
Enter number
> 1
```
```
Choose your role:
1) Buyer
2) Seller
Enter number
> 1
```
```
Assign roles
Select address for Seller:
1) Bob - 0xb0bb1ed229f5Ed588495AC9739eD1555f5c3aabD
Enter number
> 1
```
```
Define parameters
Enter digest
> 0x07887c5873ad098e96297f041eb0736ed50d33cf7010f1786f63cddf3b0b8b20
Enter price
> 1000
```
```
Max initial block [ Current block number is 350 ]
> 500
```
One line command for other participants to generate the same agreement:
```
./glow start-interaction --agreement '{"glow-version":"Glow v0.0-894-g575c859","interaction":"mukn/glow/examples/buy_sig#payForSignature","participants":{"Buyer":"0xa71CEb0990dD1f29C2a064c29392Fe66baf05aE1","Seller":"0xb0bb1ed229f5Ed588495AC9739eD1555f5c3aabD"},"parameters":{"digest":"0x07887c5873ad098e96297f041eb0736ed50d33cf7010f1786f63cddf3b0b8b20","price":"0x3e8"},"reference":{},"options":{"blockchain":"Private Ethereum Testnet","timeoutInBlocks":"0x1f4","maxInitialBlock":"0x1f4"},"code-digest":"0x16c5659f6e3c70f0c53ac5abf3977e658093f1f5880bd478de8d3a87c92d9607"}'
```

#### Setting up Bob’s Interaction
Bob’s interaction does not require as many steps since the agreement contains all of the parameters already. He just needs to specify which identity and role he is going to use in the interaction. Note also the database option that was appended to separate Bob’s database from Alice’s, when running both participants on the same machine.

```
glow start-interaction --agreement '{"glow-version":"Glow v0.0-894-g575c859","interaction":"mukn/glow/examples/buy_sig#payForSignature","participants":{"Buyer":"0xa71CEb0990dD1f29C2a064c29392Fe66baf05aE1","Seller":"0xb0bb1ed229f5Ed588495AC9739eD1555f5c3aabD"},"parameters":{"digest":"0x07887c5873ad098e96297f041eb0736ed50d33cf7010f1786f63cddf3b0b8b20","price":"0x3e8"},"reference":{},"options":{"blockchain":"Private Ethereum Testnet","timeoutInBlocks":"0x1f4","maxInitialBlock":"0x1f4"},"code-digest":"0x16c5659f6e3c70f0c53ac5abf3977e658093f1f5880bd478de8d3a87c92d9607"}' --evm-network pet --database run/B
```
```
Choose your identity:
1) Bob - 0xb0bb1ed229f5Ed588495AC9739eD1555f5c3aabD
Enter number
> 1
```
```
Choose your role:
1) Buyer
2) Seller
Enter number
> 2
```

#### Starting Alice’s Interaction
After setting up the interaction, the Glow runtime component will deploy an EVM smart contract to the configured network and generate a handshake to send to Bob. The handshake is for Bob to verify that the on-chain contract corresponds to everything that is specified in the agreement.

Send the handshake below to the other participant:
```
{"agreement":{"glow-version":"Glow v0.0-894-g575c859","interaction":"mukn/glow/examples/buy_sig#payForSignature","participants":{"Buyer":"0xa71CEb0990dD1f29C2a064c29392Fe66baf05aE1","Seller":"0xb0bb1ed229f5Ed588495AC9739eD1555f5c3aabD"},"parameters":{"digest":"0x07887c5873ad098e96297f041eb0736ed50d33cf7010f1786f63cddf3b0b8b20","price":"0x3e8"},"reference":{},"options":{"blockchain":"Private Ethereum Testnet","timeoutInBlocks":"0x1f4","maxInitialBlock":"0x1f4"},"code-digest":"0x16c5659f6e3c70f0c53ac5abf3977e658093f1f5880bd478de8d3a87c92d9607"},"contract-config":{"contract-address":"0x9533A6610DBd92fa5C9E46364b2b36b8D37C1874","code-hash":"0x30e92fcb774f9f205242dce3f112025f999f18c6d45971f4fc48ed8fa807c1d9","creation-hash":"0xb9a04dea24f5fee9b7cbb3f4446d124bc884e869195e9d91e975ad2e3bc2a30b","creation-block":"0x16de"},"published-data":"0x"}
```

#### Running the Alicea and Bob Interaction
All Bob has left to do is paste the handshake when prompted and the runtime will handle everything from there. First by generating a signature of the digest and then publishing it on-chain. Alice’s runtime will then watch the network for transactions against the contract to see Bob’s move, and both runtimes should run to completion without requiring any more user input.

The last thing the runtime does is print all the variables that were bound during execution of the contract, with the signature being purchased highlighted for both participants.
@@ -0,0 +1,13 @@
---
title: Support and help
description: EVM resources
order: 2
parent: 2021-02-25_11-00-00_resources
last_updated: "2021-02-25T09:00:00+01:00"

---
## Support and help

Thank you for your interest in using EVM. If you are a developer and want to get involved, register your interest today via our short [Typeform](https://input-output.typeform.com/to/OJsf0XcD) survey and we will be in touch soon. Invites will be sent out in stages as we roll out the program.

We encourage you to draw on community feedback and support as much as possible.
7 changes: 7 additions & 0 deletions resources/content/articles/en/2021-02-25_11-00-00_about-en.md
@@ -0,0 +1,7 @@
---
title: About
description: EVM
parent: 2021-02-25_11-00-00_evm
order: 2
last_updated: "2021-02-25T09:00:00+01:00"
---
@@ -0,0 +1,11 @@
---
title: Block explorer
description: EVM getting started
parent: 2021-02-25_11-00-00_getting-started
order: 6
last_updated: "2020-12-17T09:00:00+01:00"

---
## Block explorer

The EVM devnet provides a link to the blockchain explorer. This is a useful tool that displays information about activity on the blockchain. The block explorer shows transaction history and other details, making it easy for users to find information about the cryptocurrency. Importantly, it shows the latest blocks in the chain as well as identifying the first block in the chain.
@@ -0,0 +1,16 @@
---
title: Devnet skill set
description: EVM about
parent: 2021-02-25_11-00-00_about
order: 1
last_updated: "2021-02-25T09:00:00+01:00"

---
## Devnet skill set

As in the case of the KEVM to use the EVM devnet the following skills are required:

- Familiarity with writing smart contracts in Solidity. You will need a suite of well-defined smart contracts to use on the devnet.
- Knowledge of the JSON remote procedure call (RPC) protocol.

No registration is required to use the devnet.
7 changes: 7 additions & 0 deletions resources/content/articles/en/2021-02-25_11-00-00_evm-en.md
@@ -0,0 +1,7 @@
---
title: EVM
description: EVM section
parent: 2020-05-04_07-00-00_virtual-machines
order: 3
last_updated: "2021-02-25T09:00:00+01:00"
---
@@ -0,0 +1,8 @@
---
title: Explorer
description: EVM tools
parent: 2021-02-25_11-00-tools
order: 2
last_updated: "2020-12-17T09:00:00+01:00"
external_href: https://explorer-evm.portal.dev.cardano.org/
---
@@ -0,0 +1,7 @@
---
title: Getting Started
description: EVM
parent: 2021-02-25_11-00-00_evm
order: 3
last_updated: "2021-02-25T09:00:00+01:00"
---

0 comments on commit f4b2f1c

Please sign in to comment.