U2U Network Documentations
  • Introduction
    • Our Vision
    • Litepaper
      • Overview
        • U2U Network Diagram
        • U2U Network with DEPIN and Web3 Eco System
      • Consensus
  • Services
    • RPC
      • RPC Endpoints
      • Ethereum API Methods
        • eth_blockNumber
        • eth_call
        • eth_chainId
        • eth_estimateGas
        • eth_feeHistory
        • eth_gasPrice
        • eth_getBalance
        • eth_getBlockByHash
        • eth_getBlockByNumber
        • eth_getBlockTransactionCountByHash
        • eth_getBlockTransactionCountByNumber
        • eth_getCode
        • eth_getLogs
        • eth_getProof
        • eth_getStorageAt
        • eth_getTransactionByBlockHashAndIndex
        • eth_getTransactionByBlockNumberAndIndex
        • eth_getTransactionByHash
        • eth_getTransactionCount
        • eth_getTransactionReceipt
        • eth_getUncleByBlockHashAndIndex
        • eth_getUncleByBlockNumberAndIndex
        • eth_getUncleCountByBlockHash
        • eth_getUncleCountByBlockNumber
        • eth_maxPriorityFeePerGas
        • eth_sendRawTransaction
        • eth_subscribe
        • eth_unsubscribe
        • net_version
        • net_listening
        • net_peerCount
        • web3_clientVersion
        • web3_sha3
        • debug_traceTransaction
      • DAG API Methods
        • dag_getEvent
        • dag_getEventPayload
        • dag_getHeads
        • eth_currentEpoch
      • Trace API Methods
        • trace_block
        • trace_get
        • trace_transaction
        • trace_filter
    • Explorer
      • Explorer URLs
      • Explorer API
        • Account
        • Block
        • Contract
        • Logs
        • Stats
        • Token
        • Transaction
      • GraphQL
      • Explorer RPC API
      • Smart Contract Verification
        • Via explorer
        • Via hardhat plugin
      • Testnet Faucet
    • Wallets
      • Metamask
      • Wallet Connect
      • Coinbase Wallet
      • U2U Super App
        • Policy
    • Staking
      • How To Stake?
      • FAQ
    • The Graph
      • Deploy a Graph Node
      • Deploy a Subgraph
    • Bridge
      • Smart Contracts & EOA
    • Oracle
      • Smart Contracts & EOA
  • Network
    • Node Types
    • Requirements
    • Build Dependencies
    • Run Normal Node
      • Mainnet Normal Node
      • Testnet Normal Node
      • Run via Docker
    • Run Validator Node
      • Mainnet Validator Node
      • Testnet Validator Node
    • Run A Local Test Network
    • Troubleshooting
  • SUBNET
    • Overview
    • Subnet Node Type
    • Requirements
    • NFT Digital License
    • Subnet Node Setup
      • Master Node
      • Verifier Node
      • Edge Node CLI
  • For Developers
    • SDK
    • Smart Contract Development
      • What are smart contracts?
      • What is gas?
      • Structure of a smart contract
      • Your first smart contract
      • Test your smart contract
      • Deploy your smart contract
      • Submit your contract to explorer
      • Interact With Your Smart Contract
      • Integrate Your Smart Contract With a Frontend
      • Additional Resources
    • Smart Contract Deployment
      • Deploy with Remix
      • Deploy with Hardhat
Powered by GitBook
On this page
  • Background
  • Real-World Examples
  • Traits of Smart Contracts
  1. For Developers
  2. Smart Contract Development

What are smart contracts?

Background

Smart contracts represent the core foundation for the existence of blockchain development.

These contracts are essentially programs that outline a predefined set of rules, often referred to as a "contract," which trigger automatic execution when a user interacts with the blockchain. Notably, once a smart contract is deployed, it operates consistently without the possibility of being altered or hijacked by malicious entities.

Consequently, smart contracts are exceptionally well-suited for powering financial applications, as they can autonomously handle the sending and receiving of cryptocurrencies with a high degree of reliability and predictability.

Real-World Examples

Okay, but what are some real-world examples of tools that can be replaced by smart contracts?

  • Financial Instruments: Conventional financial transactions, like trading stocks or currencies, often necessitate third-party intermediaries like stockbrokers. Smart contracts can take on the role of this intermediary, enabling trades without requiring middlemen.

  • Property Ownership: In contrast to conventional legal documentation, smart contracts execute swiftly, offer public accessibility, and permit fractionalized ownership.

  • Token Creation: Remarkably, you can launch new token systems like Tether or Chainlink on Ethereum using smart contracts. Similarly, NFT projects like Bored Apes or CryptoPunks can be initiated through smart contracts.

And many, many more. In fact, we're likely still just scratching the surface of what systems can be eventually redesigned with blockchain.

Traits of Smart Contracts

What traits give smart contracts the ability to revolutionize or replace existing technical models? Unlike traditional programming languages, smart contracts have the following properties:

  • Transparency: Smart contracts are published to the blockchain, and can be read and written by anyone who has access to the blockchain.

  • Simplicity: Because smart contracts are expensive to deploy onto the blockchain and contain sensitive logic dictating the flow of financial transactions, they tend to be much smaller and simpler than most codebases.

  • Immutability: Once a smart contract has been deployed, it (typically) can't be modified and is guaranteed to function identically no matter when its called! This allows smart contracts to operate as reliable, trusted third parties - because no individual controls the smart contract, it can act as a financial intermediary, a trustworthy automated market maker, or much more by guaranteeing impartiality.

Once deployed, these smart contracts behave as independent actors that are fully transparent but can contain complex logic. Therefore, instead of only human users owning accounts on Ethereum, there are two types of accounts:

  • Externally Owned Accounts (EOAs) managed by a human user.

  • Contract Accounts which are managed by their underlying smart contract code.

What's the difference between EOAs and Contract Accounts?

Impressively enough, these two types of accounts can do basically the same things! Both of these account types can:

  • Receive or send fungible tokens (U2U) to any account

  • Receive or send non-fungible tokens (a CryptoKitty) to any account

  • Trigger another contract account - allowing a smart contract to run other smart contracts.

  • Generate new smart contracts - allowing a smart contract to act as a contract factory!

However, there are a few limitations of contract accounts:

  • Contract accounts can't instantiate actions on their own - they can only respond to transactions they receive (typically from EOAs).

  • Contract accounts are controlled entirely by their code, whereas EOAs are controlled by their associated private keys.

PreviousSmart Contract DevelopmentNextWhat is gas?

Last updated 11 months ago