Smart Contracts
Last updated
Last updated
A smart contract is a computer program that directly controls the transfer of digital currencies or assets between parties under certain conditions. Smart contracts are executed on the Ethereum Virtual Machine which can be thought of as a computer that runs all over the world on each ethereum node, hence you may see Ethereum referred to as the world computer. Smart contracts are independent of any central authority, making them transparent and secure by design and once deployed onto the blockchain a smart contract cannot be stopped. They are also self-executing, which means they automatically execute when all conditions are met, so no one needs to oversee the operation after a smart contract is deployed on the blockchain. On Ethereum, smart contracts are created in a programming language called Solidity, which is similar in design to C++, Python and JavaScript with many object oriented features.
Smart contracts are currently used for a wide range of applications, including real estate transactions, financial derivatives, gaming and any other arbitrary program imaginable. Some notable examples are included in the image below:
This list of smart contracts was pulled directly from Ultrasound.Money which sorts them by how much network resources have been used to run them. Each of these smart contracts use gas as people call them, meaning that ETH is spent/burnt to run the programs on the Ethereum EVM.
Most smart contracts are paired with a webpage front-end creating what is referred to as a dApp (decentralized application)
Smart contracts have an associated address just like your accounts have addresses. The main difference is that a contract address also has what is called an ABI (Application Binary Interface) that can take in certain parameters and, given that the parameters are sufficient, the smart contract will then execute and perform its pre-programmed functions. For most dApps, this interface is neatly tucked away in the background and all the end user interacts with is a polished front-end website.
Anyone can create a contract on Ethereum and name it anything they like, so always be certain you are interacting with the contract you expect, especially if you are interacting with a newly released contract or project.
A good way to view a token/contract and confirm it's legitimacy is by using a blockchain explorer like Etherscan.io and make sure that the token metrics match what you expect regarding the contract address, token holders, and transaction analytics. Here is an example from etherscan's page for the DAI Stablecoin contract:
Notice that there are nearly 500k holders and 16 million transactions on mainnet Ethereum with this contract. This gives a certainty that this is the correct contract address for DAI as these metrics would be extremely expensive to fake using a newer malicious contract.
Now that we can see that this is the correct DAI token, we may wish to add this to our Lattice1's address tags list making it so every time we interact with the DAI contract our Lattice1 screen displays the name DAI instead of the contract address.