Glow-Lang / glow

The Glow language for Blockchain Decentralized Applications.
https://glow-lang.org
Apache License 2.0
58 stars 8 forks source link

Support for Plutus Core backend #212

Open kwannoel opened 3 years ago

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Jul 26, 2021, 23:48

Support for Plutus Core backend

TODO

Setup Plutus Core

  1. git clone git@github.com:input-output-hk/plutus.git
  2. Setup binary caches: https://github.com/input-output-hk/plutus#how-to-set-up-the-iohk-binary-caches.
  3. Setup plutus-core executables: https://github.com/input-output-hk/plutus/tree/master/plutus-core#via-nix.

Sanity check for Plutus Core

Apply

Input

echo "(program 1.0.0 \
  (lam x \
    (con integer) \
    [(builtin multiplyInteger) (con integer 2) x]))" > two-times-x.plc

echo "(program 1.0.0 \
  (con integer 3))" > three.plc

./plc apply --if textual two-times-x.plc three.plc -o two-times-three.plc
cat two-times-three.plc

Output

(program 1.0.0
  [
    (lam x_0 (con integer) [ [ (builtin multiplyInteger) (con integer 2) ] x_0 ]
    )
    (con integer 3)
  ]
)

Eval

Input

./plc evaluate -i two-times-three.plc

Output

(con integer 6)

Investigate state of glow/cardano

Does not compile glow DApps to plutus-core. Instead, it uses the State Machine contract (See: Plutus Pioneers Program - State Machine for a step-by-step explanation) which provides Smart Contract Backend (SCB) (now renamed more accurately to Plutus Application Backend (PAB)) and the on-chain code.

Using output from glow, it interprets relevant sections into HTTP calls to interact with the state machine on-chain code. The HTTP API / CLI is provided by the SCB of the state machine contract (see: glow/cardano/scripts/execute-contract, where closing DApp is being interpreted).

This is an interesting approach, however it is not what we want as we need to target plutus-core directly.

Investigate plutus-pab

Plutus Application Backend (PAB) is used by clients to interface with contracts, and manage state of plutus contract instances.

Eventually we might have to reproduce certain features from this.

What we need for off-chain:

As such it seems more appropriate to use plc / import the plutus core library to interface locally with plutus core, until there is actual on-chain support for plutus core code.

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Jul 27, 2021, 00:40

changed the description

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Jul 27, 2021, 00:40

changed the description

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Jul 27, 2021, 00:40

changed the description

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Jul 27, 2021, 01:13

changed the description

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Jul 27, 2021, 01:40

changed the description

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Jul 27, 2021, 01:51

changed the description

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Jul 27, 2021, 01:52

changed the description

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Jul 27, 2021, 01:53

changed the description

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Jul 27, 2021, 13:35

changed the description