Code Monkey home page Code Monkey logo

cairo-playground's Introduction

Cairo Playground

Playground environment for those who want to learn and get to know Cairo language better.
Build and debug simple Cairo programs or even build, compile and deploy Cairo smart contracts.

This project was bootstrapped with Create React App.

App Modes

We are managing 2 different build flows to support Cairo and StarkNet modes. Components will dynamically build the UI according to the mode value in the AppProvider.

Cairo - The default mode. Here you can write simple Cairo programs, run, debug and prove them using SHARP.

StarkNet - Dedicated mode for StarkNet, our L2 network over Ethereum. In this mode you can write Cairo smart contracts, compile and deploy them to the network.

Prerequisites

  1. Install npm and Node.js. See Guide.
  2. Make sure you've yarn installed globally on your machine npm i -g yarn.

Installation

Clone and run yarn to install dependencies:

git clone https://github.com/starkware-libs/cairo-playground.git
cd cairo-playground
yarn install

Development

yarn run start - starts the development server with the default Cairo mode.

yarn run start:starknet - starts the development server with StarkNet mode.

Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.

Production

yarn run build - builds the default Cairo mode.

yarn run build:starknet - builds the StarkNet mode.

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

.env Files

.env files are increasingly popular as a way to configure an application. Their values are injected into the application bundle during build time.
The appropriate files are loaded according to the NODE_ENV value.
.env (global values for all environments)
.env.development (values for development env, i.e NODE_ENV=development)
.env.test (values for testing env, i.e, NODE_ENV=test)
.env.production (values for production env, i.e, NODE_ENV=production)

Note: each file can be overridden on a local environment using matching .env.[ENV].local file.

Shuffle Environments Variables

yarn run start --use-real-sharp

By default, SHARP endpoint isn't available on local environment. i.e, you can't prove programs when running on local machine.
For making this feature available so the app will use SHARP endpoint, you can use the above flag.

yarn run start --use-starknet-alpha

By default, StarkNet endpoint isn't available on local environment. i.e, you can't deploy programs when running on your local machine.
For making this feature available so the app will use StarkNet endpoint, you can use the above flag.

yarn run start --use-starknet-alpha --starknet-mode

Runs the app on local env in StarkNet mode with deploy feature available.

yarn run start --use-real-sharp --cairo-mode

Runs the app on local env in Cairo mode with prove feature available.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

TBD

cairo-playground's People

Contributors

carmitkl avatar dan-ziv avatar ilyalesokhin-starkware avatar roeegross avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.