orange and yellow neon lights

Smart Contract Basics

A smart contract is a computer protocol that facilitates, executes and enforces negotiation or performance of an agreement (i.e., contract). Smart contracts allow the performance of credible transactions without third parties. These transactions are trackable and irreversible. Smart contracts often emulate the logic of contractual clauses. They are usually executed on a blockchain to be protected from modification or deletion, unless specific provisions are made in their programming. A smart contract is only triggered if particular conditions are met, usually using data and value tokens that have been approved by both parties involved.

Condition – Conditions are what the code will be testing to see if it is true or false. Typically, a condition is represented in the programming language as a comparison between numbers, characters or strings and is only true when the comparison works out. An example of a condition could be if(x > 0). If the comparison is true (x is greater than 0), then the code branches right and runs commands. However, if the comparison is false (x is less than or equal to 0), the code branches left instead and skips these commands.

Placement – Placement is where this condition exists within the program and how it affects what happens next. Once the contract has been authorized, it can be added to an existing blockchain where it cannot be altered and will receive updates from a secure data source known as an oracle. Chainlink oracles play a primary leadership role in the current Defi Ecosystem.

Execution – Execution is what actually happens after the placement. Code that can be run on the Ethereum EVM, secure enclaves like SGX, or could be run on side chains to save on cost.

To tie all the elements together in an example: Condition – If a customer has over $300 in their account then the code is going to execute the payment for their order. Placement – The condition will take place in the purchase order page of our website. Execution – After this customer has made over $300 worth of purchases from us, we will receive a notification that their card has been charged.

Smart contracts are self-executing, meaning that once contract terms are agreed and signed, the network of nodes verify execution and automatically execute code without downtime or reliance on third party entities. Smart contracts decrease the potential for disagreements and ambiguity, errors and fraud, as these agreements are immutable. In addition, smart contracts can improve internal and external communication between parties by referencing notes or specific actions during routine tasks. Normally if you have a dispute with another party, the entire legal system kicks in. Smart Contracts allow the terms of an agreement to be written into code and stored on the blockchain, making them immutable and publicly auditable. This means disputes can be resolved personally or through an intermediary, allowing for greater flexibility and faster resolution.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Discover more from Enclave

Subscribe now to keep reading and get access to the full archive.

Continue reading