Alephium Documentation
website·Indexed 35 days ago
https://wiki.alephium.org/Technical documentation for the Alephium blockchain, featuring the Ralph smart contract language, sUTXO programming model, and Asset Permission System (APS). Includes guides on the TypeScript SDK, dApp development with Next.js, wallet configuration, and infrastructure components like the explorer backend and price oracles.
What's inside Alephium
- Developing dApps on Alephium involves two primary components: Ralph, the dedicated smart contract programming language, and the Web3 SDK, which provides the framework for compiling, testing, deploying smart contracts, and interacting with the blockchain.
Overview of Alephium Technical Architecture
Alephium is a scalable Proof-of-Work (PoW) blockchain that utilizes a 'Proof-of-Less-Work' consensus mechanism to reduce energy consumption by over 87% compared to traditional PoW. It features a stateful UTXO model, combining the security of Bitcoin's UTXO with the flexibility of Ethereum's smart contracts. Key performance metrics include an 8-second block time, an average network throughput of 2 blocks per second, and the ability to process over 20,000 transactions per second (TPS) via BlockFlow sharding.Overview of the Alephium Extension Wallet
The Alephium extension wallet is a browser-based tool used to store and manage assets on the Alephium blockchain, including the native ALPH token, other fungible tokens, and NFTs. It serves as a secure bridge for dApps, allowing users to sign transactions and interact with smart contracts directly from their browser.Overview of Alephium Asset Permission System (APS)
The Asset Permission System (APS) is a security layer for managing assets on the Alephium blockchain. It eliminates the 'token approval' risk common in EVM (Ethereum Virtual Machine) environments by allowing users and contracts to approve tokens on demand within the same transaction.
Key benefits include:
- Protection against Reentrancy attacks, Bitflip attacks, Smart Contract Draining, and Malicious NFTs.
- Enhanced efficiency by allowing predefined approvals and asset transfers in a single TxScript-based transaction.
- No need for manual revocation of smart contracts.
Overview of the Alephium Stratum Protocol
The Alephium Stratum protocol is based on the EIP-1571 specification and utilizes JSON-RPC-2.0 for messaging between mining clients and servers. It supports a set of request methods for client-to-server communication and notification methods for server-to-client updates.Overview of the Ralph smart contract language
Ralph is the domain-specific language (DSL) used for writing smart contracts on the Alephium blockchain. Its design is centered around three primary goals: security, simplicity, and efficiency. The language is built on the principles of maintaining a simple DSL, providing a single obvious way to accomplish tasks, and incorporating security best practices as built-in features.Overview of SignerProvider
TheSignerProvideris an abstraction of an Alephium account. It is used to sign messages and transactions, and to submit signed transactions to the Alephium blockchain.Overview of Powfi DeFi foundations
Powfi is a DeFi platform on Alephium that provides two primary foundations: Concentrated Liquidity Market Maker (CLMM) and xALPH liquid staking. It supports both CLMM for efficient capital allocation within specific price ranges and traditional Constant-Product Market Maker (CPMM) pools for token markets.Overview of Ralph Unit Testing Framework
Ralph provides an experimental testing framework for writing unit tests directly within smart contracts. It is particularly well-suited for testing pure functions. For complex contract interactions, using the TypeScript SDK is recommended.
Requirements:
- Alephium full node version
3.15.2or higher - Web3 SDK version
2.0.0-rc.2or above
- Alephium full node version
Overview of the Alephium Desktop Wallet
The Alephium desktop wallet is a user-friendly application designed for storing and managing assets on the Alephium blockchain. By default, it connects to a public node. For users requiring higher security or privacy, the wallet can be built from the official GitHub repository to connect to a local node, or it can be created entirely offline.Understand Alephium's VM and Smart Contract Language
Alephium uses a stateful UTXO (sUTXO) model, which is incompatible with account-model VMs like the EVM. Consequently, Alephium developed its own virtual machine called Alphred and a corresponding domain-specific language called Ralph. Ralph is designed to be expressive, secure by design, and optimized for the sUTXO model to mitigate common security issues found in Solidity and the EVM.Compare Alephium's consensus and node model to other L1s
Alephium uses a Proof of Work (PoW) consensus mechanism rather than Proof of Stake (PoS) to ensure a more robust, decentralized, and trustless system.
Key design choices include:
- Node Accessibility: Similar to Bitcoin, Alephium is designed so that anyone can run a full node to verify the network, avoiding the high resource costs associated with some modern L1s.
- PoW Rationale: PoW was chosen for its simplicity, consistency, and better alignment with sharding algorithms, as well as to mitigate issues like MEV and censorship common in PoS systems.