Skip to main content

Smart Contracts Development

Smart Contracts will only be as Smart as the data they are provided with enables them to be.

Dapps enable people to make transactions via their Wallets to a decentralized blockchain database through a Smart Contract Interface.

Interacting with a smart contract is done via it's ABI. Application Binary Interface in the context of computer science is an interface between two program modules, often between operating systems and user programs.

A Smart Contract's ABI is the product of compiling Solidity code (in the case of Ethereum).

Functions

To execute functions on a smart contract, you need to have:

  • Address
  • Contract ABI (Interaction Blueprint)
  • Function (to be called)
  • node connection (metamask)

Node Connection

Metamask to Infura most common

Alternatives Alchemy, Moralis see Web3 Tech Stack

Characteristics

Smart Contract source code should be available for all to see.

  • Verifiable
  • Trustless
  • Self-governing
  • Permissionless
  • Distributed and robust
  • Stateful
  • Native built-in payments

Development Flow

Basic steps in Ethereum development:

  1. Write a Contract's business logic in Solidity
  2. Compile Solidity to produce the ABI
  3. Load the ABI in a frontend application (e.g. React)
  4. Use libaries to interact with the ABI

Hybrid Smart contracts hold the key to unlocking real value for across traditional business sectors and processes. Read more about business case for Smart Contracts

Hybrid contracts are dependent on:

  1. Data Integrity of ETL Pipelines
  2. Machine Learning / AI analysis
  3. Deployment as blockchain node

Reactive Smart Contracts

Article

Developer Experience

What questions to choose the best developer tools?

Checklist:

  • Smart Contracts must have strict security checks
  • Enforcing Strict security checks takes strong domain knowledge
  • Dev tools that enforce strict security checks are essential
  • Running tests must be as fast possible to save money
  • Test Smart Contracts using same language to code them
    • avoids context shifting
    • shortens time to language mastery

Rules

Contracts exist on a single network, but EVM code can be copied and pasted

Deploying a contract is a one way decision. You can't change the contract after it's deployed. Therefore Security/Trust is vitally important in the blockchain programming.

The best way to pick up good security habits is to read code of Established Ventures that have withstood the test of time and routinely review common hacks.

Transactions

  • Cost (Ether Gas) money
  • Take time to execute - UX Implications
  • Returns a transaction hash

Structure

Anatomy of a Smart Contract:

StackDescription
BalanceAmount of ether this account owns
StorageData stored on the contract
CodeMachine Code logic for how to process transactions that change the balance

Standards

The most popular token standards on Ethereum:

  • ERC-20: A standard interface for fungible (interchangeable) tokens, like voting tokens, staking tokens or virtual currencies.
  • ERC-721: A standard interface for non-fungible tokens, like a deed for artwork or a song.
  • ERC-777: Allows people to build extra functionality on top of tokens such as a mixer contract for improved transaction privacy or an emergency recover function to bail you out if you lose your private keys.
  • ERC-1155: Enables more efficient trades and bundling of transactions to save costs. This standard enables creating both utility tokens (such as $BNB or $BAT) and Non-Fungible Tokens like CryptoPunks.
  • ERC-725: Identity

Learn more

Topics

Question

A Standardised Visual Language for Diagraming Blockchain Components?

Repositories

NameNotes
DAO VenturesETF Investing
DeFi ExamplesDeFi
Andre CronjeDeFi
YearnDeFi
Colony NetworkDAOs
MoonshotDAOs
Collection of Smart Contract patterns with tutorialsCollection