Skip to content

dfinity/motoko-playground

Repository files navigation

Motoko Playground

A playground for the Internet Computer's native Motoko language.

The Motoko playground allows users to build and deploy Motoko canisters directly in the browser, without downloading SDK, setting up a local dev environment, and without a wallet.

The Motoko playground consists of

  • its frontend, a web application served by the asset canister, which consists of the following components,
    • A Motoko compiler produced by js-of-ocaml.
    • A Monaco editor that supports Motoko syntax validation.
    • A Vessel package manager that loads libraries from the vessel package set.
    • A deploy module that integrates canister upgrade, actor class and Candid UI.
    • A code import module that allows to import any Motoko code from Github.
  • its backend, a canister on the IC that controlls all canisters deployed by the users.
    • Each deployed canister has an initial cycle of 0.5T and is available for 20 minutes.
    • To avoid wasting cycles, the deployed canister is not allowed to transfer cycles. The cycle transfer instructions will be removed by the backend at the Wasm level.
    • To ensure resource fairness, we require a proof of work when the user requests for a canister id.

We plan on adding many more features to make playground a full-featured web IDE for the Internet Computer. See our issues for more details. Community contributions are highly welcomed!

Running Locally

Prerequisites:

  • Install Internet Computer SDK

  • Install npm

  • Install Vessel

    • Download the latest release to your /usr/local/bin folder
    • Rename from vessel-{platform} to vessel
    • Run chmod +x /usr/local/bin/vessel
  • Install Rust

  • Add wasm32 target to Rust

    rustup target add wasm32-unknown-unknown
    
  • Install binaryen

    apt install binaryen
    

    or

    brew install binaryen
    

To run the Motoko playground locally, proceed as follows after cloning the respository.

npm install
dfx start [--clean] [--background] [--no-artificial-delay]
dfx deploy --argument '(null)'

Update Vessel package list