Coder Social home page Coder Social logo

olive-oyl's Introduction

CryptoFishies

CryptoFishies is a CorDapp for managing fishing rights.

Running the nodes

Run the NodeDriver run configuration from IntelliJ. This starts four nodes:

  • RegulatoryBody
  • FishermanOne
  • FishermanTwo
  • Buyer

Front-ends

The source files for the front-ends can be found under cordapp/src/main/resources.

APIs

  • GET me
  • GET regulatory-body
  • GET buyer
  • GET fishermen
  • GET other-fishermen
  • GET buyers
  • GET cryptofishies
  • GET consumed-cryptofishies
  • GET issue-cryptofishy?owner=<INSERT>&type=<INSERT>&location=<INSERT>&quantity=<INSERT>
  • GET fish-cryptofishy?id=<INSERT>
  • GET transfer-cryptofishy?id=<INSERT>&newOwner=<INSERT>

Example usage

  • Regulatory body issues a new CryptoFishy
  • Regulatory body transfers the CryptoFishy to the first fisherman
  • First fisherman transfers the CryptoFishy to the second fisherman
  • Second fisherman fishes the CryptoFishy
  • Second fisherman transfers the CryptoFishy to the buyer

Architecture

This CorDapp has a single state, CryptoFish:

-------------------
|                 |
|   CryptoFish    |
|                 |
|   - year        |
|   - owner       |
|   - type        |
|   - location    |
|   - isFished    |
|                 |    
-------------------

Initially, isFished == false. The state represents the right to fish a fish of the given type in the given location:

-------------------------------------------------------------------------------------
|                                                                                   |
|    - - - - - - - - - -                                     -------------------    |
|                                              ▲             |                 |    |
|    |                 |                       | -►          |   CryptoFish    |    |
|            NO             -------------------     -►       |                 |    |
|    |                 |    |      Issue command       -►    |    isFished     |    |
|          INPUTS           |     signed by issuer     -►    |    == false     |    |
|    |                 |    -------------------     -►       |                 |    |
|                                              | -►          |                 |    |
|    - - - - - - - - - -                       ▼             -------------------    |
|                                                                                   |
-------------------------------------------------------------------------------------

After fishing the corresponding fish, we update the state to isFished == true. The state represents a fish of the given type fished in the given location.

-------------------------------------------------------------------------------------
|                                                                                   |
|    -------------------                                     -------------------    |
|    |                 |                       ▲             |                 |    |
|    |   CryptoFish    |                       | -►          |   CryptoFish    |    |
|    |                 |    -------------------     -►       |                 |    |
|    |    isFished     |    |      Fish command        -►    |    isFished     |    |
|    |    == false     |    |     signed by fisher     -►    |    == true      |    |
|    |                 |    -------------------     -►       |                 |    |
|    |                 |                       | -►          |                 |    |
|    -------------------                       ▼             -------------------    |
|                                                                                   |
-------------------------------------------------------------------------------------

By requiring that a CryptoFish state of the correct type and location be transferred whenever a fish is sold, we prevent overfishing:

-------------------------------------------------------------------------------------
|                                                                                   |
|    -------------------                                     -------------------    |
|    |                 |                       ▲             |                 |    |
|    |   CryptoFish    |                       | -►          |   CryptoFish    |    |
|    |                 |    -------------------     -►       |                 |    |
|    |    isFished     |    |  TransferFished command  -►    |    isFished     |    |
|    |    == true      |    |     signed by owner      -►    |    == true      |    |
|    |                 |    -------------------     -►       |                 |    |
|    |                 |                       | -►          |                 |    |
|    -------------------                       ▼             -------------------    |
|                                                                                   |
-------------------------------------------------------------------------------------

This requires three flows:

  • IssueCryptoFishyFlow
  • FishCryptoFishyFlow
  • TransferCryptoFishyFlow

olive-oyl's People

Contributors

florian-f avatar

Watchers

James Cloos avatar Min Luo 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.