Learn how to build a distributed, blockchain application in one hour! Join us online to learn everything you need to know about blockchain programming, and build your first blockchain application on the Corda blockchain platform.
Led by the R3 Developer Relations team, this is the best way to kick off your journey to become a professional blockchain developer. This free one-hour crash course is for aspiring Corda developers or just developers who want to learn about the Corda blockchain platform.
Learn more about Corda: www.corda.net
Join our community: slack.corda.net
3. CorDapp
Corda - Decentralized - Application
• Decentralized Application: computer application that runs on a distributed computing system. It is also sometimes
referred as smart contracts.
Whistle-blowing-cordapp.jars
A B
C
hello-world-cordapp.jars
hello-world-cordapp.jars
hello-world-cordapp.jars
Whistle-blowing-cordapp.jars
• CorDapps are binary jars that are stored inside the Corda nodes, and each node can carry multiple CorDapps.
4. Components of a CorDapp (Smart Contracts on a Corda network)
2. Contract:
Verify the transactions
3. Flow:
Execute the business logic
1. State:
The object in Corda State
1. Get consumed
2. Get updated
3. Get stored
5. Live Coding Session!
Objective:
• Building a Token Cordapp to showcase the
issuance of a Token
What files do we need implement:
• TokenState.java
• TokenContract.java
• TokenIssueFlowInitiator.java
6. Corda States in Cordapp
• States are the objects we want to represent digitally.
• They only exist in the participating nodes of the specific transactions.
• Our State lives in TokenState.java
TokenState
implements ContractState
PROPERTIES
Party issuer
Party owner
int amount
7. Existing State
Input
Desired
Output State
Output
Calculation
Encapsulate into
Transaction
Desired
Output State
Output
Existing StateInput
Transaction
Corda Contracts in CorDapp
✅
✅
✅
Contract Rules:
Rule #1
Rule #2
Rule #3
Rules need to be
followed during a
transaction
Ledger update
Recording
• Ledger update is done through transactions in the flows
• Contracts verify the validity of a transaction: SUCCESS ✅
8. Existing State
Input
Desired
Output State
Output
Encapsulate into
Transaction
Desired
Output State
Output
Existing StateInput
Transaction
✅
✅
❌
Contract Rules:
Rule #1
Rule #2
Rule #3
Rules need to be
followed during a
transaction
!REJECT!
Ledger update
Recording
Calculation
Corda Contracts in CorDapp
• Ledger update is done through transactions in the flows
• Contracts verify the validity of a transaction: FAILURE ❌
9. Issuance Transaction
No inputs
One output,
amount is positive
One issue command,
issuer is required signer
TokenState
issuer
owner
amount > 0
participants = issuer, owner
Issue
(issuer)
Inputs Outputs
Corda Contracts in CorDapp
• In our Token CorDapp, we will implement an issuance transaction.
10. Corda Contracts in CorDapp
sss
1. No inputs
2. One output
3. Output is TokenState
4. Issuer is required signer
5. Owner must be required signer
6. Owner's Amount field is positive
TokenContract.java
implements Contract
public void verify(LedgerTransaction tx) {
}
• Our contract code in TokenContract.java
11. SIGN
UPDATE
PROPOSE
UPDATE
SEND
(UPDATE + 2 SIGS)
CHECK
UPDATE
NOTARY
POOL
SIGN
UPDATE
SEND
(UPDATE + 3 SIGS)
END
SEND
(UPDATE + 3 SIGS)
RECORD
UPDATE
RECORD
UPDATE
END
END
NODE A
NODE B
SIGN
UPDATE
SEND
(UPDATE + 1 SIG)
SEND
(UPDATE + 2 SIGS)
CHECK
UPDATE
Corda Flows in CorDapp
• Flows execute the business logic
• Flows consist of two classes (Initiator & Responder)
13. London
2 London Wall Place,
London, EC2Y 5AU
San Francisco
655 Montgomery St., 6th floor
San Francisco, CA 94111
www.r3.com | corda.net
Thank you
New York
11 West 42nd Street, 8th Floor
New York, NY 10036
Singapore
18 Robinson Road, Level #14-02
Singapore, 048547
Dublin
Lennox Building
50 Richmond St South
Saint Kevin’s, Dublin,
D02FK02
Hong Kong
Bonham Strand, 7F Office 18-
121
Hong Kong
São Paulo
Av. Angélica, 2529
Bela Vista- 6th Floor
São Paulo - SP, 01227-200, Brazil
Mumbai
01A108, WeWork Enam Samhav, C-
20, G Block, Bandra Kurla Complex,
Mumbai, 400051, India
Tokyo
Izumi Garden Tower 19F,
1–6-1 Roppongi, Minato-ku,
Tokyo 106-6019, JAPAN
Headquarters:
@inside_r3 | @cordablockchain
linkedin.com/company/r3cev-llc
Regional: