dApp Setup
This guide covers how to configure and deploy a dApp on HyperEVM.
1. Setting Up Your Application
Before deploying contracts, your dApp needs a proper setup with wallet integration and blockchain connectivity. HyperEVM supports standard Ethereum libraries, ensuring compatibility with tools like:
Wagmi / Viem & Ethers – for seamless wallet connections.
Hyperliquid RPC endpoints – to interact with the blockchain.
For a step-by-step guide on setting up a Next.js application with Wagmi, refer to the Builder Codes Guide.
2. Deploying a Smart Contract on Hyperliquid EVM
Deploying a smart contract on Hyperliquid follows a similar workflow to Ethereum. You can use Foundry or Hardhat, two popular development frameworks.
This guide focuses on Foundry, but you can find additional Hardhat resources here.
1️⃣ Deploying with Foundry
Note: This is an old data sheet, so some details may not be accurate for HyperEVM. I haven’t tested deployment on HyperEVM yet, but an update is coming soon. For now, consider this a summary rather than a full guide.
Create a New Project
(Optional) Link to GitHub:
Install Dependencies
Configure remappings in
foundry.toml
:
Compile & Test
Deploy on a Local Devnet (Anvil) Start Anvil in a separate terminal:
Deploy the contract: Create a Script and run this command:
Deploy on Testnet Add your testnet credentials to
.env
:Deploy on Sepolia:
Verify the contract automatically:
Check deployment on Etherscan: Take the transaction hash from the deployment output and search for it on Etherscan to view your contract.
Verify an already deployed contract:
2️⃣ Interacting with a Smart Contract
You can use Cast for direct terminal interaction or leverage Etherscan’s UI to read contract data and interact with smart contracts.
Managing Wallets
Import a wallet:
List available wallets:
Delete a wallet:
Calling Smart Contract Functions:
Read function:
Convert hex to decimal:
Write function
Send a transaction:
Send a transaction with multiple arguments:
Call a contract function and retrieve a stored value:
3️⃣ Understanding the Dual-Block Architecture
Hyperliquid EVM uses a dual-block system for transaction processing. By default, transactions go to small blocks, but deploying contracts efficiently may require big blocks. To enable this, submit an L1 action.
💡 For a deep dive into Dual-Block transactions, visit this guide.
3. dApp <--> Blockchain
To interact with a smart contract from your dApp’s frontend, you can use Ethers.js, Viem, or Wagmi. These tools allow you to read and write blockchain data, handle transactions, and manage wallet connections.
1️⃣ Setting Up the Contract ABI & Address
Extract the ABI from Foundry output: The ABI is located in
out/ContractName.sol/ContractName.json
.Store the contract address as a constant:
2️⃣ Using Ethers.js
📌 Documentation: Ethers.js Docs
🔹 Read Data (Call a View Function)
🔹 Write Data (Send a Transaction)
3️⃣ Using Viem
📌 Documentation: Viem Docs
🔹 Read Data (Call a View Function)
🔹 Write Data (Send a Transaction)
4️⃣ Using Wagmi
📌 Documentation: Wagmi Docs
🔹 Setting Up Wagmi Config - here
🔹 Read Data (Use Wagmi Hook)
🔹 Write Data (Use Wagmi Hook)
You can use Wagmi Core instead of React hooks. Hooks must follow React rules (e.g., they cannot be called inside functions or conditionally).
🔗 Learn more: Wagmi Core Documentation
Last updated