Coder Social home page Coder Social logo

canvas-node's Introduction

Canvas ‒ A Smart Contracts Parachain

linux matrix discord

This is a node implementation for Canvas, a Substrate parachain for smart contracts.

If you have any questions, feel free to talk to us on Element or on Discord (in the ink_smart-contracts channel).

Note: This used to be a standalone smart contracts node used for the ink! workshop. We have moved the standalone node to substrate-contracts-node.

Developing Smart Contracts for Canvas

How it works

This node is based on the substrate-parachain-template, which we configured to use Substrate's smart contracts module ‒ the contracts pallet. This contracts pallet takes smart contracts as WebAssembly blobs and defines an API for everything a smart contract needs (storage access, …). As long as a programming language compiles to WebAssembly and there exists an implementation of this API in it, you can write a smart contract for this pallet ‒ and thus for Canvas ‒ in that language.

This is a list of languages you can currently choose from:

There are also different user interfaces and command-line tools you can use to deploy or interact with contracts:

If you are looking for a quickstart, we can recommend ink!'s Guided Tutorial for Beginners.

Run it Locally

Installation

You need to have executables of both Polkadot and Canvas.

Binary releases can be found here: Polkadot releases, Canvas releases.

Alternatively you can install (or build) the projects yourself:

  • cargo install --git https://github.com/paritytech/polkadot.git --force --locked
  • cargo install --git https://github.com/paritytech/canvas.git --force --locked

The --locked flag makes the installation (or build) use the same versions as the Cargo.lock in those repositories ‒ ensuring that the last known-to-work version of the dependencies is used.

Launching

Starting this project is best done using the polkadot-launch tool ‒ it starts Polkadot and registers the Canvas parachain on it automatically.

To use polkadot-launch you must ensure that you're using Node.js v14.x or newer. If you're on macOS, you must also ensure that your machine's firewall is disabled. You can do this by going to "System Preferences" > "Security & Privacy" > "Firewall" and ensuring that it's off.

Now that you have the prerequisites:

  1. Install it with yarn global add polkadot-launch or npm i polkadot-launch -g
  2. Check that the paths in polkadot-launch/config.json point to the polkadot and canvas executables
  3. Launch the network with polkadot-launch polkadot-launch/config.json

At this point you should be able to use Polkadot JS Apps to connect to the Polkadot relay chain nodes as well as the Canvas collator.

Building from source

Follow the official installation steps to set up all Substrate prerequisites.

Afterwards you can install this node via

git clone https://github.com/paritytech/canvas.git 
cd canvas/
cargo build --release --locked 

Substrate Compatibility

The latest confirmed working Substrate commit which will then be used is c000780dba99a611fadbf83873073e024be1be0b.

Unstable Features

If you're the type of person that likes to drink your soup before it cools, you might also be wondering about how to activate unstable pallet-contracts features. To do this you can run the previous installation command with the following flag: --features contracts-unstable-interface.

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.