Coder Social home page Coder Social logo

isabella232 / gallery-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from corda/gallery-demo

0.0 0.0 0.0 9.77 MB

As Corda 5 separates applications into distinct networks the need arises for reliable inter-operation between applications/networks. This repository demonstrates a cross-chain swap mechanism.

Kotlin 13.18% Shell 0.02% Dockerfile 0.18% Groovy 3.59% HTML 0.10% CSS 78.69% JavaScript 0.29% TypeScript 2.98% SCSS 0.96%

gallery-demo's Introduction

Cross-chain Swaps - gallery-demo

A demo of swaps in an auction scenario with three distinct Corda Networks. This worked example is an implementation of the design presented at CordaCon2021. The slides from this presentation outlining the architecture are available here in the repo.

The example simulates an Auction scenario with potentially distrusting parties spread across distinct Cordapp domains (Corda Networks). For brevity, the example uses a single Cordapp to encapsulate the artwork and consideration states (ArtworkState, TokenType-GBP, TokenType-CBDC) and their associated contracts and flows; additionally, a single Spring/Orchestration layer is used to coordinate and execute cross-network interactions between an organization's Auction Network identity, and their associated consideration network identity.

In a more "REAL" deployment you can imagine the structure of the total solution would include three distinct Cordapps (Auction, GBP, CBDC) as well as individual off-ledger orchestration services managed, and controlled exclusively by each party.

The key to this 'simulation' is that we have limited these actions to operate completely independently and disjoint from each other. Whereby, the Gallery can only receive a result or instruction from its own identity on another network, and the same holds for the Bidding parties. Additionally, in the Cordapp a ContractState and its associated flows cannot transact or interact directly with another ContractState or its flows. Any evolutions based on data from an asset represented on another network will receive its instruction or payload via the orchestration service triggered from the source network.

Problems not addressed in this demo

This demo sidesteps the problem of inter-chain identity, discovery and messaging by co-ordinating all actions via an independent controller, the Spring Boot service which also provides the REST API used by the front-end. Thus, instead of the Bidder on the Auction network sending a message directly to the Buyer on a Token network, instructing it to send encumbered tokens, the controller first uses Corda RPC to run a flow on the Bidder, then makes a second Corda RPC call to the Buyer instructing it to run the flow which sends encumbered tokens, passing across the details retrieved from the first call. The controller also holds (via up-front configuration) all the details of the various networks and parties.

Participants:


  • Alice: an art seller
  • Bob: buyer with CBDC consideration
  • Charlie: buyer with GBP (fiat) consideration

Networks and Identities:


Art/Auction Network:

  • Alice (as Gallery)
  • Bob (Bidder)
  • Charlie (Bidder)

Consideration Network #1 - CBDC

  • Alice (Seller)
  • Bob (Buyer)

Consideration Network #2 - GBP

  • Alice (Seller)
  • Charlie (Buyer)

** Note: That each identity across distinct networks with the same identifier is owned/controlled by the same organization.

Modules:


gallery-contracts - ContractState, Contract, and asset def/models

gallery-workflows - Business logic and services

buildSrc - Docker and K8s deployment builder classes

deploy - Local Cordformation configuration/tasks, Azure K8s configuration and Dockerfiles

frontend - Frontend sources and associated proxies

spring-api - Spring api controller and orchestration services

Running the Demo


Warning: Because the solution requires three separate networks running in parallel, we recommend for best performance to use a machine which has 32GB of Ram. You may still run the demo with less, but if you encounter problems you may have to adjust or tweak your docker resource settings or additionally reinitialize a downed node periodically.

Prerequisites

  • Docker and docker-compose installed. See /deploy/README.md for further details.
  • Java 1.8

Network Initialization Steps (can be executed from Gradle pane in IntelliJ or via command-line)

  1. ./gradlew prepareAllDockerNodes
    1. Generates persistent node file structures and docker-compose yaml configuration.
  2. ./gradlew allNetworksUp
    1. Brings up Auction, GBP, and CBDC networks locally via docker-compose.
  3. ./gradlew runSpringApp
    1. Launches Spring Orchestration service and REST controller.

Launching Frontend

See /frontend/galleryapp/README.md

After installing, the frontend will be available at http://localhost:3000

Loading Initial Data

To bring Gallery Artwork and Buyer tokens on ledger, click the Reset Data tab in the configuration menu of the Frontend.

gallery-demo's People

Contributors

anixon604 avatar pbienek-r3 avatar r3domfox avatar arnab-r3 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.