Code Monkey home page Code Monkey logo

corda-features-test's Introduction

Corda Features Test

This repository demonstrates various features of Corda.

To deploy different CorDapps:

  1. Change the configurations in settings.gradle to include desired projects.
  2. Change the 'app' property in gradle.properties.
  3. Run ./gradlew jar to generate new jar files
  4. Run ./update $app to copy these files to Node cordapp directories.

Persistence

The database provided by Corda nodes can store both on-ledger data and off-ledger data. Database can be accessed via native jdbc connection or JPA.

States can be made queryable by implementing QueryableState interface. Off-ledger data storage needs to be registered with hibernate.

Concepts

To use the Corda node built-in database, you need to subclass MappedSchema, which allows Corda knows what you want to do to the database.

Your created schema is required to belong to a schema family, which allows smooth future upgrade. Also required are various tables and constraints (hence Schema).

The way it works is that during the node start-up, Corda will read information defined in your cordapps and update database (migration) accordingly. Database migration currently (it seems) must be done manually by running java -jar corda.jar run-migration-scripts --core-schemas --app-schemas --allow-hibernate-to-manage-app-schema or else node start-up would fail.

Queryable State

QueryableState is a convenient feature in that it automates the process of creating new entries when new states are recorded. To implement it, you need to define two methods: supportedSchema() which tells Corda which schema this state will be recorded in, and generateMappedObject which maps the State object to Entity object based on the given schema.

Sample Usage

Account

Concept

An account is a LinearState, associated with arbitrary key-pairs certified by the host node. Transactions belonging to an account are signed by the node using one of the account's keys.

Use Case

Sample Usage

corda-features-test's People

Contributors

mcxd avatar

Watchers

 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.