This repository demonstrates various features of Corda.
To deploy different CorDapps:
- Change the configurations in settings.gradle to include desired projects.
- Change the 'app' property in gradle.properties.
- Run
./gradlew jar
to generate new jar files - Run
./update $app
to copy these files to Node cordapp directories.
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.
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.
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.
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.