A Bird’s eye view of NEAR contracts
An overview of the concept of smart contracts , its implementation and use in the near ecosystem.
Introduction
What are smart contracts đŸ¤”?
contracts are translated into computer language an d stored in blocks. The parties to the contracts, which are copied to distributed ledgers, are kept 100 percent anonymous. The code snippet is ready with specific tasks and details (time limit, what goes where, from where to where, etc.). When the time comes, it takes action to fulfill the transaction, and if the necessary conditions are met, the transaction is successfully completed or canceled before completion. - vitalik buterin (founder of ethereum).
Source :
Vitalik Buterin explains Ethereum
Smart contracts are simply logical instructions stored and executed on the blockchain . They can fundamentaly read , write and delete data to the blockchain .
Smart contracts or simply contracts can serve as back-end programs for decentralized applications (dapps). They can perform logical operations, store multi type data to the blockchain.
When a user interacts with a smart contract , either directly or through a decentralized application ; the smart contract function is called through the RPC Api , the call is then routed to the available node of the blockchain,the node then initiates the virtual environment to run the smart contract , the result of the contract’s logic is then returned to the user while its state is stored on the blockchain , if there's change in the logic of the contract, the node broadcasts it to the network .
Th virtual environment is then torn down by the node.
Programming languages for NEAR Contracts
Near smart contracts can be written in any language that compiles to webassembly (wasm) which is a native format for web browsers.
These languages are numerous ,some of which are :
- Rust
- JavaScript
- Assembly language