Giter VIP home page Giter VIP logo

nitro-tutorial's Introduction

Nitro protocol contracts tutorial

This repository represents a minimal, example package that consumes @statechannels/nitro-protocolas a dependency. It provides a testing environment for interacting with the nitro solidity contracts, using jest.

Clone the repository and cd into the new directory.

Installing dependencies

Make sure you have Yarn v1.17.3 installed. For easy management of specific Yarn versions, we recommend using Yarn Version Manager (YVM).

To install the dependencies:

yarn

Running the tutorial test

Executing

yarn tutorial lesson1.test

will

  • start a local blockchain
  • import precompiled contract bytecode from @statechannels-nitro-protocol
  • deploy this bytecode
  • run a jest test test for lesson 1 only

Your task is to make this tests pass, and then move on with yarn tutorial lesson2.test and so on up to lesson 16. Hopefully, you should learn something about the nitro contracts in the process. This exercise would be very useful for anyone interested in building a state channel wallet that runs on nitro protocol.

DApp developers may wish to build against our State Channel Wallet API (coming soon), which abstracts most of the complexity away into a much simpler interface.

Fixing the test

Open tutorial/lesson1.test.ts in your text editor. Follow the instructions in a given test case block (starting with it("...) and make the necessary changes. If you have left the test runner open, it should automatically re-run the tests for you (with a brand new, clean blockchain). Individual tests are independent.

Troubleshooting

You might find that you need to kill the test runner and/or the underlying ganache server, and start again following the steps above if things get into a bad state.

nitro-tutorial's People

Contributors

geoknee avatar dependabot[bot] 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.