Database tables

A Corda node database contains tables corresponding to the various services that the node provides. It also contains custom tables defined by the CorDapps that are installed on the node. Currently all these tables share the same database schema, but in a future release they will be isolated from each other.

Some tables, especially the ones where the Ledger is maintained are append-only and the data will never change.

Network map

Node Infos

These are tables that store the NodeInfo of other network participants. They are just a local cache that is kept in sync with the network map server. By calling rpc.clearNetworkMapCache() all these tables will be cleared and recreated from the network map server.

Read more here: The network map

node info tables

NODE_INFOSStores NodeInfo objects. The principal table.
NODE_INFO_IDPrimary key
NODE_INFO_HASHHash of the binary nodeInfo file
PLATFORM_VERSIONDeclared version of the participant node.
SERIALVersion of the NodeInfo
NODE_INFO_HOSTSMany-to-one addresses to node
HOSTS_IDPrimary key
HOST_NAMEHost name of the participant’s node
PORTPort
NODE_INFO_IDFK to NODE_INFOS
NODE_INFO_PARTY_CERTLegal identity for a network participant
PARTY_NAMEThe X500 name
OWNING_KEY_HASHThe public key
ISMAINIf this is a main identity
PARTY_CERT_BINARYThe certificate chain
NODE_LINK_NODEINFO_PARTYMany-to-Many link between the hosts and the legal identities
NODE_INFO_IDFK to Node_info
PARTY_NAMEFK to NODE_INFO_PARTY_CERT

Node identities

The following two tables are used by the IdentityService and are created from the NodeInfos. They are append only tables used for persistent caching. They will also be cleared on rpc.clearNetworkMapCache(). Read more in API: Identity and Node services

NODE_IDENTITIESMaps public keys to identities
PK_HASHThe public key.
IDENTITY_VALUEThe certificate chain.
NODE_NAMED_IDENTITIESMaps the X500 name of a participant to a public key.
NAMEThe x500 name
PK_HASHThe public key

Network parameters

Read more here: The network map. Each downloaded network parameters file will create an entry in this table. The historical network parameters are used when validating transactions, which makes this table logically part of the Ledger. It is an append only table and the size will be fairly small.

NODE_NETWORK_PARAMETERSStores the downloaded network parameters.
HASHThe hash of the downloaded file. Used as a primary key.
EPOCHThe version of the parameters
PARAMETERS_BYTESThe serialized bytes
SIGNATURE_BYTESThe signature
CERTFirst signer certificate in the certificate chain.
PARENT_CERT_PATHParent certificate path of signer.

Ledger

The ledger data is formed of transactions and attachments. In future versions this data will be encrypted using SGX. Read more in The ledger

Attachments

Read more in Using attachments and Node services

attachments tables

NODE_ATTACHMENTSStores attachments
ATT_IDThe hash of the content of the file.
CONTENTThe binary content
FILENAMENot used at the moment.
INSERTION_DATEDate.
UPLOADEROne of: p2p, app, rpc, unknown. Currently used for for determining if this attachment is safe to execute during transaction verification.
VERSIONThe version of the JAR file.
NODE_ATTACHMENTS_CONTRACTSMany-to-one contracts per attachment. Empty for non-contract attachments.
ATT_IDForeign key
CONTRACT_CLASS_NAMEThe fully qualified contract class name. E.g.: net.corda.finance.contracts.asset.Cash
NODE_ATTACHMENTS_SIGNERSMany-to-one JAR signers of an attachment. Empty if not signed.
ATT_IDForeign key
SIGNERHex encoded public key of the JAR signer.

Transactions

These are all the transactions that the node has created or has ever downloaded as part of transaction resolution. This table can grow very large. It is an append-only table, and the data will never change. Read more in Node services - DBTransactionStorage This is the key ledger table used as a source of truth. In the future the content will be encrypted to preserve confidentiality.

NODE_TRANSACTIONSCorda transactions in a binary format
TX_IDThe hash of the transaction. Primary key.
TRANSACTION_VALUEThe binary representation of the transaction.
STATE_MACHINE_RUN_IDThe flow id associated with this transaction.

Contract upgrades

Read more in Upgrading contracts

NODE_CONTRACT_UPGRADESRepresents an authorisation to upgrade a state_ref to a contract.
STATE_REFThe authorised state.
CONTRACT_CLASS_NAMEThe contract.

This table should be empty when no states are authorised for upgrade or after authorised states have been upgraded.

Scheduling

Read more in Event scheduling

NODE_SCHEDULED_STATESContains scheduled states
OUTPUT_INDEXReference to a state - index in transaction
TRANSACTION_IDReference to a state - transaction id
SCHEDULED_ATTimestamp when this state will execute.

This table should be empty when no events are scheduled.

Storage of private keys

NODE_OUR_KEY_PAIRSStores the anonymous identities
PUBLIC_KEY_HASHPrimary key
PUBLIC_KEYBinary public key
PRIVATE_KEYBinary private key
PRIVATE_KEY_MATERIAL_WRAPPEDBinary (encrypted) private key
SCHEME_CODE_NAMEString code representing the key algorithm

The columns PRIVATE_KEY_MATERIAL_WRAPPED and SCHEME_CODE_NAME are populated, instead of the column PRIVATE_KEY, if an HSM is configured for anonymous identities. For more details about this feature, read Options for confidential identities.

PK_HASH_TO_EXT_ID_MAPMaps public keys to external ids. Mainly used by CorDapps that need to simulate accounts.
IDPrimary key
EXTERNAL_IDExternal id
PUBLIC_KEY_HASHPublic key hash

These tables should be append only.

Node state machine

Read more in Node services

NODE_CHECKPOINTSStores the flow checkpoints.
CHECKPOINT_IDPrimary key
CHECKPOINT_VALUESerialized application stack.

This table will see the most intense read-write activity. Depending on the installed flows and the traffic on the node the I/O operations on this table will be the main bottleneck of the node performance. There will be an entry for every running flow. Draining the node means waiting for this table to become emtpy. Read more in: Upgrading CorDapps on a node.

NODE_MESSAGE_IDSUsed for de-duplication of messages received by peers.
MESSAGE_IDMessage id
INSERTION_TIMEInsertion time
SENDERP2p sender
SEQUENCE_NUMBERSequence number

The NodeJanitor is a background process that will clean up old entries from this table. The size should be fairly constant.

Key value store

NODE_PROPERTIESGeneral key value store. Currently only used for the flow draining mode.
PROPERTY_KEYThe key
PROPERTY_VALUEThe value

Vault tables

Read more about the vault here Vault.

Note that the vault tables are guaranteed to remain backwards compatible and are safe to be used directly by third party applications.

VAULT_STATESPrincipal vault table.
OUTPUT_INDEXReference to a state - index in transaction
TRANSACTION_IDReference to a state - transaction id
CONSUMED_TIMESTAMPWhen the state was consumed.
CONTRACT_STATE_CLASS_NAMEContract class
LOCK_IDThe soft lock id
LOCK_TIMESTAMPThe soft lock timestamp
NOTARY_NAMEThe notary
RECORDED_TIMESTAMPRecorded timestamp
STATE_STATUSCONSUMED or UNCONSUMED
RELEVANCY_STATUSRELEVANT or NOT_RELEVANT
CONSTRAINT_TYPEThe contract constraint.
CONSTRAINT_DATAThe hash or the composite key depending on the CONSTRAINT_TYPE

The VAULT_STATES table contains an entry for every relevant state. This table records the status of states and allows CorDapps to soft lock states it intends to consume. Depending on the installed CorDapps this table can grow. For example when fungible states are used.

In case this table grows too large, the DBA can choose to archive old consumed states. The actual content of the states can be retrieved from the NODE_TRANSACTIONS table by deserializing the binary representation.

VAULT_TRANSACTION_NOTESAllows additional notes per transaction
SEQ_NOPrimary key
TRANSACTION_IDThe transaction
NOTEThe note
STATE_PARTYMaps participants to states
OUTPUT_INDEXReference to a state - index in transaction
TRANSACTION_IDReference to a state - transaction id
PUBLIC_KEY_HASHThe pk of the participant
X500_NAMEThe name of the participant or null if unknown.
V_PKEY_HASH_EX_ID_MAPThis is a database view used to map states to external ids.
OUTPUT_INDEXReference to a state - index in transaction
TRANSACTION_IDReference to a state - transaction id
PUBLIC_KEY_HASHThe public key of the participant.
EXTERNAL_IDThe external id.

Fungible states

vault fungible states

VAULT_FUNGIBLE_STATESProperties specific to fungible states
OUTPUT_INDEXReference to a state - index in transaction
TRANSACTION_IDReference to a state - transaction id
ISSUER_NAMEIssuer
ISSUER_REFReference number used by the issuer
OWNER_NAMEX500 name of the owner, or null if unknown
QUANTITYThe amount.
VAULT_FUNGIBLE_STATES_PARTSMany-to-one participants to a fungible state
OUTPUT_INDEXReference to a state - index in transaction
TRANSACTION_IDReference to a state - transaction id
PARTICIPANTSX500 name of participant.

Linear states

vault linear states

VAULT_LINEAR_STATESProperties specific to linear states
OUTPUT_INDEXReference to a state - index in transaction
TRANSACTION_IDReference to a state - transaction id
EXTERNAL_IDThe external id of this linear state.
UUIDThe internal id of this linear state.
VAULT_LINEAR_STATES_PARTSMany-to-one participants to a linear state
OUTPUT_INDEXReference to a state - index in transaction
TRANSACTION_IDReference to a state - transaction id
PARTICIPANTSX500 name of participant.

Hot cold setup

NODE_MUTUAL_EXCLUSIONLock for hot-cold deployments. Only 1 entry with the active machine.
MUTUAL_EXCLUSION_IDPrimary key
MACHINE_NAMEThe machine holding the lock
PIDThe process id
MUTUAL_EXCLUSION_TIMESTAMPWhen the lock was taken.
VERSIONThe version

Liquibase database migration

These are Liquibase proprietary tables used by Corda internally and by CorDapps to manage schema change and evolution.

DATABASECHANGELOGRead more: DATABASECHANGELOG
ID
AUTHOR
FILENAME
DATEEXECUTED
ORDEREXECUTED
EXECTYPE
MD5SUM
DESCRIPTTION
COMMENTS
TAG
LIQUIBASE
CONTEXTS
LABELS
DEPLOYMENT_ID
DATABASECHANGELOGLOCKRead more: DATABASECHANGELOGLOCK
ID
LOCKED
LOCKGRANTED
LOCKEDBY