What is a smart contract?
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.
What are examples of smart contracts?
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.
Are smart contracts reversible?
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.
How do you deploy a smart contract?
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.
What is the Daml smart contract language?
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.