Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Plutus Core backend #212

Open
kwannoel opened this issue Sep 22, 2021 · 9 comments
Open

Support for Plutus Core backend #212

kwannoel opened this issue Sep 22, 2021 · 9 comments

Comments

@kwannoel
Copy link
Contributor

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

Support for Plutus Core backend

TODO

  • Design Glow IR. This will either be interpreted / compiled to plutus core.
  • Off-chain communication with plutus core.
    Plutus smart contract support is still not yet available on testnets.
    However, we can use the plc executable provided in plutus-core as a means of "off-chain" communication.
  • We will need plc executable / plutus-core haskell libraries if we want to run plutus-core code in glow.

Setup Plutus Core

  1. git clone [email protected]: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:

  • Deployment for Plutus Core.
  • Low level interface to interact with on-chain plutus core. PAB provides a high level interface, for interacting with Plutus.Contract.

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
Copy link
Contributor Author

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

changed the description

2 similar comments
@kwannoel
Copy link
Contributor Author

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

changed the description

@kwannoel
Copy link
Contributor Author

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

changed the description

@kwannoel
Copy link
Contributor Author

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

changed the description

@kwannoel
Copy link
Contributor Author

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

changed the description

@kwannoel
Copy link
Contributor Author

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

changed the description

@kwannoel
Copy link
Contributor Author

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

changed the description

@kwannoel
Copy link
Contributor Author

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

changed the description

@kwannoel
Copy link
Contributor Author

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

changed the description

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant