Browse Source

Clarity

master
Alejandro Criado-Pérez 3 years ago
committed by Jonathon Hammond
parent
commit
09880f385a
  1. 29
      src/pages/en/write-smart-contracts/overview.md

29
src/pages/en/write-smart-contracts/overview.md

@ -12,23 +12,21 @@ Clarity is a **decidable** smart contract language that optimizes for predictabi
## Smart contracts
Smart contracts encode and enforce rules for modifying a particular set of data that is shared among people and entities
who don't necessarily trust each other. For example, a smart contract can hold funds in escrow until multiple parties
agree to release them, create its own ledger and keep track of its own novel tokens (fungible or non-fungible), and
even help make supply chains more transparent.
Smart contracts encode and enforce rules for modifying a particular set of data that is shared among people and entities who don't necessarily trust each other.
For example, a smart contract can hold funds in escrow until multiple parties agree to release them, create its own ledger and keep track of its own novel tokens (fungible or non-fungible), and even help make supply chains more transparent.
Because smart contracts are programs that exist in a blockchain, anyone can query them, and anyone can submit transactions
to execute them. A smart contract execution can result in new transactions being written to the blockchain.
Because smart contracts are programs that exist in a blockchain, anyone can query them, and anyone can submit transactions to execute them.
A smart contract execution can result in new transactions being written to the blockchain.
Apps can take advantage of smart contracts to manage a global state that is visible to the public. Anyone can audit the
blockchain to independently verify that an app's global shared state has been managed correctly according to the smart contract's rules.
Apps can take advantage of smart contracts to manage a global state that is visible to the public.
Anyone can audit the blockchain to independently verify that an app's global shared state has been managed correctly according to the smart contract's rules.
There is a [Clarity Visual Studio Code plugin][] available for syntax assistance and debugging.
## Use cases
Not every decentralized application requires smart contracts, but Clarity unlocks interesting capabilities for
decentralized applications. Examples of use cases include, but are not limited to:
Not every decentralized application requires smart contracts, but Clarity unlocks interesting capabilities for decentralized applications.
Examples of use cases include, but are not limited to:
- Access control (for example pay to access)
- Non-fungible (for example collectibles) and fungible tokens (for example stablecoins)
@ -43,14 +41,11 @@ Clarity differs from most other smart contract languages in two essential ways:
- The language is interpreted and broadcast on the blockchain as is (not compiled)
- The language is decidable (not Turing complete)
Using an interpreted language ensures that the executed code is human-readable and auditable. A decidable language
like Clarity makes it possible to determine precisely which code is executed, for any function.
Using an interpreted language ensures that the executed code is human-readable and auditable. A decidable language like Clarity makes it possible to determine precisely which code is executed, for any function.
A Clarity smart contract consists of two parts, a data space and a set of functions. Only the associated
smart contract may modify its corresponding data space on the blockchain. Functions may be private and thus callable
only from within the smart contract, or public and thus callable from other contracts. Users call smart contracts'
public functions by broadcasting a transaction on the blockchain which invokes the public function. Contracts
can also call public functions from other smart contracts.
A Clarity smart contract consists of two parts, a data space and a set of functions. Only the associated smart contract may modify its corresponding data space on the blockchain.
Functions may be private and thus callable only from within the smart contract, or public and thus callable from other contracts. Users call smart contracts' public functions by broadcasting a transaction on the blockchain which invokes the public function.
Contracts can also call public functions from other smart contracts.
Note some of the key Clarity language rules and limitations.

Loading…
Cancel
Save