The term "Smart Contract" has seen a lot of evolution since originally coined by Nick Szabo in the 1990s.These days, in the context of distributed applications, a smart contract is a pre - agreed and shared piece of data and code, which can be executed on the distributed system to alter its state.They can be seen as a natural evolution of stored procedures in centralised databases, but for shared, low - trust infrastructures.
The most well known example of a smart contract these days is one concerning transferrable fungible assets.The smart contract defines the shared rules of who can create or destroy the asset, how ownership changes, and how positions of the asset can be split or merged. However, there are rich examples for a wide range of industries and use - cases. Some examples available in DAML:
- Games like chess or tic tac toe
- Airline seat assignment
- Distributed chats
- Kanban boards
Our marketplace (https://daml.com/marketplace/) and repos (https://github.com/digital-asset,https://github.com/digital-asset/danban, https://github.com/digital-asset/ex-models,https://github.com/digital-asset/) contain many varied examples for you to explore.
In general, smart contracts are designed to be deterministic and only reversible to the extent their predefined rules allow.This can be problematic if unforeseen corrections or reversals are required.
Fortunately, DAML contracts always foresee this possibility by design. Every DAML contract has a clearly defined set of signatories, which can mutually agree to make changes to the smart contract, including reversal.
In DAML, smart contracts are not deployed as one - offs.Instead, application developers deploy contract templates to the shared infrastructure.These templates are similar to classes in object oriented programming in the sense that they must be instantiated to get concrete contracts.Part of the rules the template specifies is the set of signatories, those parties which need to agree to the creation of the instance.Once the signatories' agreement has been obtained, creating a contract instance is just a normal transaction.
The DAML smart contract language is a core component of the DAML ecosystem for distributed applications.It is a language purpose - made to capture the core concerns of distributed applications, whilst at the same time abstracting away any infrastructure concerns so that developers can focus on just those things that are differentiating for their apps.