No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
certificates
config
cordapp-contracts-states
cordapp
gradle/wrapper
lib
.gitignore
LICENCE
README.md
TRADEMARK
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

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