R3 Corda Resp
R3 Corda Resp
Blockchain
Blockchain is a DLT where data is stored in the form of a block.
Each block in a blockchain contains the hash of the previous block which links the blocks
together. Hence, the name blockchain.
If any data in a block changes, it affects the hash of the corresponding block and the
block it is linked with. Therefore, it is not possible to tamper with any block without
affecting the other blocks in the chain. This makes blockchain technology immutable.
Corda - Introduction
Corda is an open-source project that provides enterprise blockchain solutions. It is a
private and permissioned blockchain platform. Privacy, identity, finality, and open
governance are the core principles of Corda. It was initially developed for financial
institutions, but now is used in other sectors too.
Corda blockchain architecture is designed in such a manner that multiple applications
can execute and automate real-world business and financial transactions in a
transparent manner without any intermediaries, across an open network.
Corda - Introduction
The following video describes the working of the Corda blockchain platform:
Why Corda?
Modern industries thrive on data, and the data is stored in large databases. This
requires a significant time and effort to maintain data integrity, and to keep the data
synchronized across departments. The solution to this problem is to maintain a
decentralized and distributed database, where data can be stored securely and
synchronized easily.
Corda is a decentralized and distributed database platform with unique features:
The Corda network is like a graph where all the nodes are connected.
Communication in the Corda network occurs directly, and on a need to know basis
between the nodes. There is no broadcasting of information or use of gossip protocols.
Transactions can be defined by writing programs called Smart Contracts.
Transactions can run parallelly on different nodes without affecting each other.
CorDapps is the application that executes smart contracts on the Corda platform.
The actual definition of a Smart Contract depends on the model of computation.
In DLT, there are two types of computational models:
o Virtual computer model
o UTXO model
The Virtual computer model is used by Hyperledger and Ethereum, and the UTXO
model is used by Bitcoin and Corda.
Corda uses the UTXO models because the transactions in Corda are structured similar
to Bitcoin, and consists of input, output, and a signature.
Corda Vision
The Corda vision is a shared global logical ledger in which all economic factors
(organizations, individuals, and machines) transact with full privacy, autonomy, and
security in an auditable manner. Large companies, suppliers, consumers, and third-
parties should be able to transact using diverse agreements and contracts on a single
platform, through the deployment of a large number of CorDapps on a single globally-
shared secure, private, and openly-governed Corda network.
This vision of Corda is different from other enterprise blockchains in the sense that
those are designed to be deployed as separate isolated instances for each application.
Corda Features
R3 Corda's design is inspired by other blockchain platforms, however, it overcomes the
limitations and setbacks of the previous implementations.
The basic building block of Corda is a state object, which represents a specific
instance of a specific contract in the Corda network. A state object is immutable, and
during state transition, new states are created from the old states.
The main features of Corda are:
Smart Contracts - Computer codes that represent real-world contracts and legal
agreements, they are responsible for state transition as per the preset rules mentioned
in the contract. They are a part of CorDapps.
Notary Pools - Unique timestamping services that order transactions, and are
responsible for consensus in the Corda network.
Flow Framework - A component that simplifies the process of writing complex protocols
between multiple mutually-distrusting parties.
Immutable states.
Transactions have an input, output, and signature, and use the UTXO computational
model.
Contracts are pure functions.
Differences
Bitcoin has a single rigid-data format that can hold very little data, mostly related to
Bitcoin quantity and spendings.
Corda states can contain arbitrary typed data.
Bitcoin scripts are not Turing complete, while Corda contracts are Turing complete.
Like Ethereum, the CorDapp code runs in a powerful virtual machine, and can contain
complex logic.
Both Ethereum and Corda contracts are Turing complete, and contain complex logic that
run in powerful virtual machines.
Both are intended for the modeling of different types of financial contracts.
Differences
Permissioned.
Governed by an authority or consortium.
Differences
Corda aims at building a secure global distributed ledger where different companies,
suppliers, and consumers can transact in a secure, private, and auditable network.
Corda Ledger
The Corda Ledger is a decentralized and distributed ledger that is distributed among
the different nodes (peers) of a network. It is subjective from the perspective of each
node, which means that the view of the ledger for every peer in the network is different,
and depends on the on-chain facts of the node, and the shared facts of the node. The
peers that contain the same set of shared facts, get the same view of the ledger.
Ledger Data
In Corda Ledger there is no central storage of data, and each node maintains its own
database based on the known facts.
The known facts can be shared or unilateral:
Shared facts include the data that is shared between two more or more nodes in the
network.
Unilateral facts include the data that belongs to the database of the node, but which is
not shared with other nodes of the network, and is visible only to the node to which it
belongs.
In the above Venn diagram, Alice has facts 1 and 2 shared with Bob, and these
facts are available in both Alice's and Bob's database's. The fact 11 is present
only with Alice, and is visible only in Alice's database. This is a unilateral fact.
Similarly, Bob has facts 1 and 2 shared with Alice, and facts 3 and 4 shared with
Carl. Therefore, Bob's database contains shared facts 1, 2, 3, and 4.
Carl has facts 3 and 4 shared with Bob, 5 and 6 shared with Matt, and 7, 8, and 9
shared with Elena. Therefore, Carl's database contains shared facts 3, 4, 5, 6, 7,
8, and 9.
Matt has facts 5 and 6 shared with Carl, and 9 shared with Ed. Therefore, Matt's
database contains shared facts 5, 6, and 9.
Elena has facts 7 and 8 shared with Carl, and 9 shared with Matt. Therefore,
Elena's database contains shared facts 7, 8, and 9.
Elena and Alice share no facts. Ttherefore, their view of the Corda Ledger is
entirely different.
States in Corda
States in Corda are immutable objects, and they represent the on-ledger facts shared
between nodes. States represent things like business contracts, and legal agreements
at any specific instance of time, and every node in a Corda network has a set of states
that represent it.
States
The following video explains what states and shared facts are in a Corda Ledger:
State Lifecycle
States are immutable, however shared facts in different nodes change during
transactions.
The lifecycle of states is represented by a state sequence.
States cannot be updated when changes occur in shared facts. Instead, new states are
created and replaced, by copying the required data from the old states.
Old states are not deleted, but are marked as historic and stored for auditing purposes.
The sequence of state replacements provides a full view of the evolution of a shared
fact.
Vault
A Vault is a database inside every node, where the current and historic states associated with it
are tracked and stored. For auditing purposes, vaults are used to check historic states.
Reference States
All states need not be updated by the parties that use them. In the case of reference
data, one party creates the reference data, which in turn is used by other parties to
create new states. These states are called reference states. Syntactically, they are
similar to regular states but are treated differently by Corda transactions.
Corda Transactions
Transactions are used to update the Corda Ledger by changing the states. Like
Bitcoin, Corda uses a UTXO computational model where the states are immutable
objects. Since states are immutable, transactions mark the previous states as historic,
and place the current state at the head of the state sequence.
Transaction Types
Transactions contain many inputs, outputs, and reference types. This includes different
types of states that represent cash, legal bonds, contracts, etc. Transactions could be
issuances that have zero inputs, or exits that contain zero outputs, and can even merge
or split states. Transactions are atomic in nature, which means that an entire transaction
is either processed or discarded (there is no partial transaction).
The two types of transactions are:
Transaction Commits
Transactions are proposals to update the states of a Corda Ledger. Initially,
transactions represent only the desired output, and not the actual output states.
Transactions must receive signatures from all the required signers to create the output
states. When the required signatures are gathered, the transactions are committed,
input states are marked as historic, and the output represents the new states of the
ledger.
Transaction Validation
For transactions to be valid, the following conditions must be satisfied:
The proposed transaction and every other transaction in the chain of transactions that
created the current proposal must be digitally signed by all the required parties, and
contractually valid.
Transaction uniqueness: Each transaction should be unique, which means that no
other committed transaction that consumes any of the same inputs must exist.
Even if a transaction gets all the required signatures, but the conditions are not met, the
transaction is considered invalid and is not accepted.
Transaction Components
Apart from input states and output states, a transaction contains the following
components:
Commands - Describes what a transaction does, and dictates the validity of a
transaction. For example, there is a transaction where Alice pays £10 to Bob to pay off a
£10 I owe you (IOU). This transaction constitutes two commands: a settlement
command which reduces the outstanding amount on the IOU, and a payment command
which changes the ownership of £10 from Alice to Bob. Commands are also associated
with a list of one or more signers. By taking the union of all the public keys listed in the
commands, you get the list of the required signers.
Attachments - Large chunks of data that can be reused across different transactions.
Attachments are ZIP/JAR files containing arbitrary content. Transactions use a hash
value to refer to attachments. The information in these files can then be used when
checking the validity of a transaction.
Time window - There are instances when transactions need to be validated within a
certain time. In such cases, a time window is used. The time window specifies the time
period during which a transaction has to be completed.
Notary pool - A network service that provides consensus, and validates transactions in
a Corda network. The notary pool provides the point of finality in the system.
Transactions that do not have any input states (issuance/genesis transactions), do not
require notaries, and are not notarized. Notary pools are also responsible for time
window validity.
Transactions
The following video explains how transactions are used to update a Corda Ledger:
Contracts
Contracts are a set of rules that determine the execution of a transaction. In Corda,
Smart contracts are a set of computer programs written in languages like Java or Kotlin.
Transactions are contractually valid if all the input/output states are inline with the rules
defined by the contracts.
Contracts
The following video explains the working of Contracts in the Corda platform:
Contractual Validity
A transaction is valid if it has all the required signatures, and is contractually valid.
Contractual validity is defined as follows:
Contract Sandbox
Transaction validity is a deterministic process, a contract is either completely validated
or rejected. Transaction validity cannot depend on the time of validation, or the amount
of information available in the node running the contract. This is a necessary condition
that ensures all nodes on the network reach consensus regarding the validity of a given
ledger update.
A contract sandbox prevents a contract from importing libraries that may cause non-
deterministic results. This includes libraries that provide current time, file system
access, or networking libraries. The only information that should be available to a
contract when verifying a transaction is the information included in the transaction.
Contracts refer to a legal prose document that state the rules governing the evolution of
the state over time. This document can be relied upon in the case of legal disputes.
Contract Limitations
Since a contract has no access to information from the outside world, it can only check
the internal validity of a transaction. It cannot check, for example, if a transaction is in
accordance with originally agreed stipulations.
Peers should therefore verify the contents of a transaction before signing it, even if the
transaction is contractually valid. A peer is under no obligation to sign a transaction just
because it is contractually valid.
Flows
Flows describe the interaction that occurs in a Corda network to achieve consensus,
and change the ledger state. They automate the process of reaching a consensus in a
Corda network. Communication between nodes occur in the context of flows, and is
point to point. There is no gossip protocol involved in the communication process. To
communicate, the peers must mention the recipients.
Built-in flows are available for common tasks.
Flow Framework
A Flow framework is the core business logic on which CorDapps run. It is a sequence of
steps that automate the process of agreeing upon ledger updates, and is designed for
multi-party, multi-step coordination between the two parties. Only the parties involved in
a transaction proposal form part of a flow framework.
The above image illustrates the steps involved in the flow of a simple ledger update.
Flow Framework
The following video describes the flow framework for a transaction:
Running Flows
Running flows describe the working of a flow framework, and shows how
communication happens between nodes. To run a flow, a Remote Procedure Call
(RPC) is used which describes the core business logic to run a particular CorDapp. The
flow abstracts all the internal workings of the business logic from the node owner.
Example
Assume that Alice is a node on the Corda network that wants to agree on a ledger
update with another node Bob. Alice must do the following to communicate with Bob:
Concurrency
The flow framework allows nodes to keep multiple flows active simultaneously. These
flows may last for days, across node restarts and upgrades. This is achieved by
serializing flows to a disk whenever they enter a blocking state (e.g., when waiting on an
I/O or networking call). Instead of waiting for the flow to be unblocked, the node starts
working on other scheduled flows, and returns to the original flow at a later date.
Consensus
Consensus is the process by which network participants reach an agreement regarding
shared facts in a ledger. Transactions are finalized and committed to the Corda ledger
when consensus is achieved.
Consensus Types
There are two types of consensus, and both must be satisfied for a transaction to be
successful and updated in the Corda ledger.
Validity Consensus
Uniqueness Consensus
Validity Consensus
Validity Consensus is the process of verifying the following for a proposed transaction
and every transaction chain that generated the inputs for the proposed transaction:
For example, a transaction proposing transferring of a treasury bond. For the transfer to
be valid, the following points must be verified:
The treasury bond was issued by the central bank in a valid issuance transaction.
Every subsequent transaction in which the bond changed hands is valid.
To verify a proposed transaction, a party may not have all the transactions of the
transaction chain. In such cases, they may request the missing transactions from the
transaction proposer.
Uniqueness Consensus
When transactions that have already achieved validity consensus utilize one or
more input states that have been consumed by other transactions, the problem is
termed double spending.
To overcome this problem, uniqueness consensus is required.
Uniqueness consensus states that none of the inputs to a proposed transaction
have already been consumed in any other transaction. Therefore, it solves
the double spending problem.
Example
Bob holds a valid central bank-issued cash state of $1,000. Bob can create two
transaction proposals:
Notary
A notary cluster is a network service that provides Uniqueness Consensus in a
Corda network. This is done by ensuring that no other transaction with the same input
state as the proposed transaction is signed. Notary clusters provide finality to the Corda
network.
A notary cluster does the following to notarize a transaction:
Signs a transaction if it has not already signed other transactions consuming any of the
proposed transaction’s input states.
Rejects the transaction, and flags that a double spend attempt has occurred.
Consensus Algorithm
Corda provides a pluggable consensus,which means that a notary cluster can choose
the consensus algorithm based on requirements such as privacy, security, scalability,
legal system compatibility, and efficiency of the algorithm.
Notary clusters can be classified according to:
Validation
A notary cluster is also responsible for providing validity consensus by validating each
transaction before committing it. To decide whether to provide validity consensus or not,
notary clusters face the following trade-offs:
If a transaction is not checked for validity (non-validating notary), it creates the risk of
“denial of state” attacks. In such cases, a node knowingly builds an invalid transaction
which consumes a set of existing states and sends it to the notary cluster, causing the
states to be marked as consumed.
If a transaction is checked for validity (validating notary), the notary views the contents of
the transaction and its dependencies. This may leak private data to the notary cluster.
In the case of a non-validating model, Corda’s controlled data distribution model means
that information on unconsumed states is not widely shared.
A notary cluster can store the identity of the party that created the denial of state
transaction, allowing the attack to be resolved off-ledger.
In the case of the validating model, anonymous, freshly-generated public keys are used
instead of legal identities to identify parties in a transaction limit the notary cluster views.
Privacy - You can have both validating and non-validating notary clusters on the same
network, each running a different algorithm, which allows nodes to choose the preferred
notary cluster as per the transaction requirement.
Load balancing - Enables to spread transaction load over multiple notary clusters,
allowing higher transaction throughput for the platform.
Low latency - Enables to minimize latency by choosing a notary cluster physically
closer to the transacting parties.
Changing a Notary
Sometimes, the notary associated with a state must be changed for the following
reasons:
A single transaction consumes multiple states that have different notary clusters
associated with them.
A node prefers to use different notary clusters for a single transaction due to privacy or
efficiency reasons.
Before these transactions are created, the states must be repointed to the same notary
cluster. This is achieved by a special notary change transaction which involves:
Consumed states are immutable states used for the purpose of transaction reporting,
audit, and archival, including the ability to perform joins with app-private data (customer
notes).
Unconsumed states are fungible states available for spending, and linear states
available for evolution or transfer to another party.
Vault Components
Nodes
A Corda node is a JVM runtime environment that has a unique identity on the Corda
network. It hosts Corda services and CorDapps.
The main elements of the node architecture are:
Node Architecture
Persistence Layer, Network, and RPC
Interface
Persistence Layer
The vault where the node stores the data required by the node's owner.
The storage service where transactions, attachments, and flow checkpoints are stored.
Network Interface
The network interface handles all the communication with other nodes. The node owner
does not interact with other nodes directly.
RPC Interface
The RPC interface is used to make remote procedure calls that are used by node
owners to interact with the node.
Service Hub
A node has access to an extensive set of services that are provided by the Service
Hub. The key services provided by the service hub are:
Information about other nodes on the network, and the services they provide.
Access to the contents of the vault, and the storage service,
Access to, and generation of a node’s public-private key pairs.
Information about a node.
Current time, as tracked by a node.
CorDapp Provider
CorDapp Provider is where new CorDapps are installed to define the behavior of a
node. There are several CorDapps that are installed by default on a node to provide
basic functionalities like:
Network
A Corda network is a peer-to-peer network where each node is connected to every
other node of the network. The Corda network represents a complete graph.
The Corda network is a permissioned network, and identity certificates are required to
join the network.
Each node in a network has a certificate that is uniquely identified it in the Corda
network.
Communication in a Corda network is point-to-point communication, and does not
require broadcasting of messages or gossip protocols.
Discovery
Network map service is a service that is used to discover nodes in a Corda network.
This service is analogous to a phone book that provides a list of nodes and the
metadata about the identity and services provided.
CorDapps
CorDapps are distributed applications written using program languages like Java or
Kotlin that run on the Corda platform.
CorDapps are used to allow nodes to reach an agreement on updates to the Corda
ledger.
CorDapps define the flows that node owners invoke using RPC.
CorDapp Components
CorDapps are a set of JAR files that contain class files written in Java or Kotlin. The
class definitions usually include the following elements:
Flows defining a routine/function for a node to update the ledger. They subclass the
FlowLogic class.
States defining the shared facts over which an agreement is reached. They implement
the ContractState interface.
Contracts defining what constitutes a valid ledger update. They implement the Contract
interface.
Services providing long-lived utilities within a node. They subclass
SingletonSerializationToken.
Serialization whitelists restricting the types a node will receive off the wire. They
implement the SerializationWhitelist interface.
APIs and Static Web Content: These are served by Corda’s built-in webserver. This
webserver is not production-ready, and should be used for testing purposes only.
Utility classes
Java 8
IntelliJ IDEA community edition (IDE)
Corda has released an extension for VS code editor. The VS code editor can be used by
installing the extension.
Git - Version control software.
Gradle version 4.10 - Build automation system.
Summary
Topics covered in this course:
Every node in the R3 Corda network has the same view of the ledger.
FALSE
The Corda vision is a _______ in which all economic factors can transact with full privacy, autonomy, and
security, and in an auditable manner.
TRUE
Notary service
Vault
TRUE
Communication between nodes occur in the context of flows, and is point to point.
TRUE
A Flow Library contains a set of ______ used for common tasks like notarizing a transaction, gathering
required signatures, etc.
Flows
A ______ is a JVM runtime environment that has a unique identity on the Corda network.
node
double spending
TRUE
Validity Consensus and Uniqueness Consensus are the two types of consensus.
TRUE
______consensus is the process of verifying that a proposed transaction has all the required
transactions.
Validity
Financial
Virtual Computing
______ are large chunks of data that can be reused across multiple transactions, and are also used for
transaction validity.
Attachments
______ are applications that execute Smart contracts on the Corda platform.
CorDapps
When new states are created, old states are not deleted, but marked as ______.
Historic
TRUE
______ is a superset of blockchain technology, and both terminologies are used interchangeably.
Notary clusters are classified according to their ______ and consensus algorithms.
Structure
If the data of a block is changed, the ______ associated with it also changes.
hash
TRUE
________ are unique time-stamping services that order transactions, and are responsible for
consensus in the Corda network.
Notary pool
CorDapps are a set of JAR files that contain class files written in Java or Kotlin.
TRUE
Spreading transaction load over multiple notary clusters to allow higher transaction throughput is
called?
Load balancing
State sequence
The Corda network is like a complete graph where all the nodes are connected.
TRUE
Opening
Issuance
Digital: R3 Corda_FP
https://ievolveng.ultimatix.net/ievolve/coursedetails/61972
R3 Corda
0.25 Credits
50 Miles
120 Min
https://play.fresco.me/course/959
_______ include data shared between two more or more nodes in a network.
Messages
x Shared Facts
Contracts
Data
Smart Contracts in R3 Corda are written using programming languages like ______ and _____.
Solidity, Vyper
Java, Python
Go, C++
x Java, Kotlin
x Notary service
Verification service
Database Administrator
Consensus service
TRUE
x FALSE
__________ is a distributed ledger technology where data is stored in the form of blocks.
Database
x Blockchain
Cryptocurrency
Every node in the R3 Corda network has the same view of the ledger.
TRUE
x FALSE
The Corda vision is a _______ in which all economic factors can transact with full privacy,
autonomy, and security, and in an auditable manner.
platform
network
central database
FALSE
x TRUE
A Flow Library contains a set of ______ used for common tasks like notarizing a transaction,
gathering required signatures, etc.
Contracts
Transactions
CorDapps
x Flows
x Flow Framework
Legal Prose
Contract
Transaction
x TRUE
FALSE
x TRUE
FALSE
x states
private databases
objects
instances
Programs
x Contracts
Tables
Instructions
Communication between nodes occur in the context of flows, and is point to point.
FALSE
x TRUE
x Vault
Blockchain
State Database
Central Database
A ______ is a JVM runtime environment that has a unique identity on the Corda network.
contract sandbox
transaction
network identifier
x node
Validity Consensus and Uniqueness Consensus are the two types of consensus.
x TRUE
FALSE
verification
x double spending
agreement
zero spending
x TRUE
FALSE
x TRUE
FALSE
CorDapp VM
Contract docker
Contract sandbox
x CorDapp provider
Discovery service
Finder service
Searching service
______consensus is the process of verifying that a proposed transaction has all the required
transactions.
Transaction
Signature
x Validity
Uniqueness
X TRUE
FALSE
When new states are created, old states are not deleted, but marked as ______.
X historic
obselete
extinct
deprecated
________ are unique time-stamping services that order transactions, and are responsible for
consensus in the Corda network.
Flow framework
X Notary pool
Smart contracts
Transaction pool
______ are applications that execute Smart contracts on the Corda platform.
Distributed Apps
X CorDapps
Smart Apps
Dapps
Terminal
Genesis
Issuance
x Exits
Notary clusters are classified according to their ______ and consensus algorithms.
content
size
X structure
visibility
X TRUE
FALSE
CorDapps are a set of JAR files that contain class files written in Java or Kotlin.
X TRUE
FALSE
______ are large chunks of data that can be reused across multiple transactions, and are also used
for transaction validity.
Oracles
X Attachments
Transactions
Files
______ are large chunks of data that can be reused across many different transactions and are also
used for transaction validity.
Commands
x Oracles
Time-stamps
Attachments
genesis block
X previous block
next block
______ is a superset of blockchain technology, and both terminologies are used interchangeably.
Bitcoin
Ethereum
MultiChain
If the data of a block is changed, the ______ associated with it also changes.
code
transaction
X hash
function
The Corda network is like a complete graph where all the nodes are connected.
X TRUE
FALSE
Corda was initially developed for ______ institutions.
political
educational
cultural
X financial
Virtual Computing
Modular
Internal Execution
Spreading transaction load over multiple notary clusters to allow higher transaction throughput is
called?
Transaction processing
Transaction distribution
X Load balancing
Transaction split
State data
State machine
X State sequence
State fact
TRUE
x FALSE
Initial
x Issuance
Opening
Genesis