Corda Smart Contracts
Smart contract is a term that is often used in the distributed ledger/ blockchain space but not often used in the context of discussing Corda. Corda has the building blocks of other blockchains’ smart contracts, but they are chopped up and split into different parts:
- The data of a smart contract is stored in the
ContractState
s on ledger. - The functions or things you can do to that data are defined in the Contract.
- The way which those functions are enacted is via building new transactions in the Flows which uses the states and conform to the Corda Contracts.
So it’s all there, but not in a neat encapsulated package. This is an intended benefit because this approach leads to a great deal of flexibility. For example, the flows are not limited to enacting a transition on the Ledger, they are a powerful messaging framework which allows you to confidently send anything you like to counterparties.
For the purposes of CDL you will see how to define a Corda smart contract as the combination of one or more types of ContractState
which are constrained by a Corda Contract. The flows are not included in this process as you can be agnostic as to how the transactions get built up: you only need to concern yourself with the validity of the final transaction.
So, Corda smart contracts are basically a combination of data (ContractStates) and what a party is permitted to do with it (Contracts).
As you follow these examples, when drawing a Smart Contract view diagram, you will always specify the ContractState
(s) and the contract which will implement the behaviour we are articulating.
Was this page helpful?
Thanks for your feedback!
Chat with us
Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.
Propose documentation improvements directly
Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.
We're sorry this page wasn't helpful. Let us know how we can make it better!
Chat with us
Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.
Create an issue
Create a new GitHub issue in this repository - submit technical feedback, draw attention to a potential documentation bug, or share ideas for improvement and general feedback.
Propose documentation improvements directly
Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.