Elysium Network Documentation
website·Indexed 34 days ago
https://docs.elysiumchain.tech/An Ethereum-compatible smart contract platform on Polkadot. Documentation covers building with the Ethereum API using libraries like Web3.js, Ethers.js, EthersRs, and Web3.py, as well as Substrate API integration via Polkadot.js. Includes guides for node operators, validator setup, MetaMask integration, and the Elysium Launchpad for IDOs and INOs.
What's inside Elysium
- The Elysium Launchpad is a blockchain ecosystem designed to support innovators and project developers through three primary service pillars: funding via IDO (Initial Dex Offering) and INO (Initial NFT Offering) platforms, community and partnership building for market exposure, and a comprehensive support system providing marketing, technical, and legal assistance.
Overview of Polkadot.js API for Elysium
The Polkadot.js API is a JavaScript library used to interact with Elysium nodes. It allows developers to read and write data to the network, query on-chain data (runtime constants, chain state, events, and transaction data), and send extrinsics from the Substrate side of Elysium.Understand native token transfer methods on Elysium
Elysium supports two primary ways to initiate balance transfers of the base network token (e.g., ELY). Developers must account for both when monitoring network activity:
- Ethereum API: Users can transfer tokens via Ethereum JSON-RPC using tools like MetaMask or MathWallet. These rely on
eth_sendRawTransaction. - Substrate API: Users can transfer tokens via the Polkadot.js Apps website or directly using the Substrate RPC.
Important Note: This dual-API support applies only to the base layer network token. Transfers of other assets (such as ERC-20 tokens) are handled exclusively via Ethereum APIs as they are smart contract interactions.
- Ethereum API: Users can transfer tokens via Ethereum JSON-RPC using tools like MetaMask or MathWallet. These rely on
Elysium Ethereum JSON-RPC Compatibility Overview
Elysium uses the Frontier compatibility layer (for Substrate-based chains) to support Ethereum DApps. While it strives for Web3 API and EVM compatibility, not all Ethereum JSON-RPC methods are supported. Some methods return default values, particularly those related to Ethereum's Proof of Authority (PoA) or Proof of Work (PoW) consensus mechanisms.Understand Elysium Consensus and Finality
Elysium uses a consensus protocol based on Delegated Proof-of-Authority (PoA) and follows the deterministic finality model used by Polkadot and Kusama via GRANDPA. In this system, validators are allocated based on their stake in the network. Once a block or transaction is marked as final, it cannot be reverted except through on-chain governance or a network fork.Set up a JavaScript project for Elysium Ethers.js development
To interact with Elysium nodes using Ethers.js, create a project directory and install the necessary dependencies: theetherslibrary for blockchain interaction and thesolccompiler for Solidity contracts.mkdir ethers-examples && cd ethers-examples npm install ethers solc@0.8.1Install MetaMask provider detection utility
To detect the Ethereum provider injected atwindow.ethereumfor both the MetaMask browser extension and MetaMask Mobile, it is recommended to use the@metamask/detect-providerpackage.npm install @metamask/detect-providerInitialize a Hardhat project
Set up a new Hardhat project by creating a directory, initializing npm, and installing the Hardhat core and Ethers plugin. It is recommended to install Hardhat locally per project to maintain version control.mkdir hardhat && cd hardhat npm init -y npm install hardhat npx hardhat # When prompted, choose 'Create an empty hardhat.config.js' # Install Ethers plugin for network interaction npm install @nomiclabs/hardhat-ethers ethersChoose between Ethereum and Substrate API explorers
Elysium provides two types of explorers based on the API used. Use the Ethereum API explorer for full access to all EVM-based transactions. Use the Substrate API explorer for Substrate-native functions; while it contains information on EVM transactions, the detail provided is limited.Generate and set validator session keys
Validators must rotate their session keys (AURA and GRANDPA). First, generate the keys via an RPC call. Then, these keys must be set on-chain using the account generated in the account key step. The account must have ELY tokens to pay for the transaction gas fee.# Step 1: Generate session keys via RPC curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "author_rotateKeys", "params":[]}' http://localhost:9933 # Step 2: Set session keys using polkadot-js-tools docker run -it --entrypoint /bin/bash jacogr/polkadot-js-tools:latest -c "polkadot-js-api --ws ws://127.0.0.1:9944/ --seed \"{your generated substrate account private seed}\" tx.session.setKeys {private key returned from rotate keys} 0x"Install Polkadot.js API and Prerequisites
The Polkadot.js API requires Node.js (v16.x recommended) and npm. After installing Node.js, install the API library using a package manager like yarn.# Ubuntu installation curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash - sudo apt install -y nodejs # MacOS installation (via Homebrew) brew install node # Install the API library yarn add @polkadot/apiListen for MetaMask account changes
Subscribe to theaccountsChangedevent to keep your dApp updated when the user switches accounts or disconnects their wallet. If the returned accounts array is empty, the wallet is locked or no accounts have provided access permissions.provider.on("accountsChanged", (accounts) => { if (accounts.length === 0) { console.log('Please connect to MetaMask.'); } });