Smart contracts

Smart contract

A smart contract is a program that runs on a blockchain, such as Ethereum, Polygon, Arbitrum, BNB Chain, Solana, etc. It is deployed at a specific address on the blockchain. Smart contracts enable self-executing agreements with predefined rules and conditions, eliminating the need for intermediaries.

Keccak256

Keccak256 is a cryptographic hash function that generates a unique, fixed-size string of bytes for each unique input it receives. This feature makes it useful for ensuring data integrity, as any change in the input data leads to a different hash output. It's virtually impossible to derive the original input from the hash output, making it a one-way function.

In Ethereum:

  1. Keccak256 is used to generate Ethereum addresses from public keys.
  2. It's used to verify the integrity of transactions.
  3. It's used for efficient and secure data storage and retrieval in Merkle Trees.
  4. It's used to identify functions in Ethereum's contract ABI.

Keccak256 is crucial for the security and functionality of Ethereum and similar blockchain systems.

Account

An account in the context of Ethereum refers to an entity with an ether (ETH) balance that can send transactions on the Ethereum network. There are two types of accounts: externally owned accounts (EOAs), which are controlled by private keys, and contract accounts, which are deployed smart contracts.

Address

In the context of blockchain, an address refers to the hashed form of a public key that belongs to a specific user or contract. It is used to identify participants on the blockchain network. In Ethereum, addresses are typically represented as hexadecimal strings and are used to send and receive transactions.

Address checksumming

A checksummed address is a standard Ethereum address with certain characters capitalized to include a checksum validation. Checksumming is a way of including error-detection codes in an Ethereum address. The goal of checksumming is to prevent errors when an address is typed manually.

An Ethereum address is a 40 character hexadecimal string derived from the last 20 bytes of the Keccak256 hash of the public key. To create a checksummed address, the address (excluding the '0x' prefix) is hashed using Keccak256, which outputs a 64 character hexadecimal string. This string is used to determine the capitalization of each alphanumeric character in the original address: if the Nth digit of the Keccak hash is 8 or more, the Nth character in the original address is capitalized, if it is a letter.

Here's a simplified explanation of how it works:

  1. You have an original Ethereum address: 0xae2fc483527b8ef99eb5d9b44875f005ba1fae13 (all lowercase).
  2. You hash the lowercase hexadecimal address using Keccak256, which produces a new hash.
  3. You go through each character of the original address:
    • If the corresponding digit in the hash is 8 or greater, you capitalize that character.
    • If the corresponding digit in the hash is less than 8, the character remains lowercase.
  4. The resulting Ethereum address with this specific capitalization is the checksummed address.

The capitalization adds an extra layer of validation: if the address is mistyped, the chances are high that the capitalization will not match the correct one, and the address can be recognized as invalid. It's important to note that not all tools and services recognize checksummed addresses, and they may treat the addresses as case-insensitive. However, using checksummed addresses can significantly reduce the risk of funds being sent to incorrect addresses due to typing errors.

Chainlink VRF

Chainlink Verifiable Random Function (VRF) is a provably-fair and verifiable source of randomness designed for smart contracts. It's a solution to one of the major challenges in blockchain development: generating a secure and truly random number.

Here's how it works:

Request: A smart contract requests randomness from the Chainlink VRF. This request includes a seed value, which can be any number - often, the current block's hash or timestamp is used.

Generate: Chainlink VRF generates a random number and a cryptographic proof. The random number is generated based on the seed and the private key of the oracle node.

Respond: The random number and the proof are sent back to the smart contract.

Verify: The smart contract verifies the proof. It checks that the Oracle node used its known public key and the seed from the original request to generate the random number. If the proof is valid, the random number is accepted.

This process ensures that the random number is truly random and that the oracle node cannot tamper with the result. It provides a reliable way for smart contracts to obtain secure and provably fair random numbers.

Chainlink VRF is often used in blockchain games, gambling apps, and anywhere else a random input is needed in a smart contract.

Token

A token represents an asset or value on a blockchain. Tokens can be fungible or non-fungible. Fungible tokens, such as ERC-20 tokens, are identical and mutually interchangeable, while non-fungible tokens (NFTs), such as ERC-721 tokens, are unique and have distinct characteristics.

ERC-20

ERC-20 is a widely adopted standard for creating and issuing tokens on the Ethereum blockchain. It defines a set of rules and functions that allow for the implementation of fungible tokens. Many popular cryptocurrencies, such as USDT, Apecoin, Dogecoin, and Shiba Inu are ERC-20 tokens.

ERC-721

ERC-721 is a standard for creating and managing non-fungible tokens (NFTs) on the Ethereum blockchain. Unlike ERC-20 tokens, each ERC-721 token is unique and has its own distinct properties and ownership. ERC-721 tokens are commonly used to represent digital collectibles, in-game assets, or unique items.

Renounced ownership of smart contracts

Renouncing ownership of a smart contract means the original developer or owner relinquishes control over the contract and the associated assets. This is often done to enhance trust and decentralization within the Web3 ecosystem. When ownership is renounced, the contract becomes immutable, and nobody can change how it operates.

Smart contract ABI

ABI stands for Application Binary Interface and is a standardized way to interact with smart contracts on the Ethereum network. It defines the functions and data structures of a smart contract in a format that can be understood and used by external entities. The ABI specifies the encoding and decoding rules for data exchange between contracts and external applications.

Smart contract audit

A smart contract audit is a comprehensive review and analysis of a protocol's smart contract code to identify potential security vulnerabilities or flaws. The audit aims to ensure that the smart contract functions as intended, without any loopholes or weaknesses that could compromise the security or user funds. Audits are typically conducted by specialized firms or security experts.

Solidity

Solidity is the most popular programming language used by Web3 developers to write smart contracts for the Ethereum blockchain. It is a statically-typed, high-level language specifically designed for creating smart contracts. Solidity enables developers to define the behavior and logic of contracts and is supported by a range of development tools and frameworks.

Total value locked

Total value locked (TVL) is a metric used to assess the total value of assets locked or invested in a specific decentralized finance (DeFi) platform or smart contract. It represents the sum of all the assets (tokens or cryptocurrencies) users have deposited or staked within the protocol. TVL is often used as an indicator of a protocol's popularity and the amount of trust users place in it.

Transactions

Transactions in the context of blockchain are cryptographically signed instructions initiated by accounts. A transaction represents a state-changing operation on the Ethereum network, such as transferring ETH from one account to another, invoking a smart contract function, or deploying a new smart contract. Transactions contain relevant information, such as sender and recipient addresses, transaction value, gas price, and data payload.