LogoLogo
  • Welcome
    • About ENI
  • Getting Started
    • Quickstart
      • Account Structure
      • Token Standards
      • Gas
    • Divergence from Ethereum
    • Transactions
      • Creating Transaction
    • Governance
      • Proposals
    • Oracles
  • Build
    • Setup and Installation
    • Smart Contracts
      • EVM (General)
      • EVM (CLI)
      • Querying State
    • Frontend Development
      • Overview
      • How to Deploy Your First dApp
    • Ecosystem
      • Tools and Resources
      • Resources
  • Node
    • Getting Started
    • Node Operators Guide
    • Validator Operations Guide
    • Advanced Configuration & Monitoring
    • Technical Reference
  • Reference
    • Overview
    • enid
    • CLI
      • enid add-genesis-account
      • enid blocktest
      • enid collect-gentxs
      • enid compact
      • enid config
      • enid debug
      • enid export
      • enid gentx
      • enid help
      • enid init
      • enid keys
        • enid keys delete
        • enid keys add
        • enid keys export
        • enid keys import
        • enid keys list
        • enid keys mnemonic
        • enid keys parse
        • enid keys show
      • enid latest_version
      • enid migrate
      • enid prune
      • enid query
        • enid query accesscontrol
        • enid query upgrade
        • enid query account
        • enid query auth
        • enid query bank
        • enid query block
        • enid query authz
        • enid query distribution
        • enid query epoch
        • enid query evidence
        • enid query evm
        • enid query feegrant
        • enid query ibc-transfer
        • enid query gov
        • enid query ibc
        • enid query mint
        • enid query oracle
        • enid query params
        • enid query slashing
        • enid query staking
        • enid query tendermint-validator-set
        • enid query tokenfactory
        • enid query tx
        • enid query txs
      • enid rollback
      • enid start
      • enid status
      • enid tendermint
      • enid tools
      • enid tx
      • enid validate-genesis
      • enid version
Powered by GitBook
On this page
  1. Build
  2. Frontend Development

Overview

PreviousFrontend DevelopmentNextHow to Deploy Your First dApp

Last updated 2 months ago

Developing a frontend for a dApp on ENI involves connecting to wallets, interacting with the blockchain via RPC endpoints, and signing and broadcasting transactions. A dApp should choose either EVM or Cosmos as its connection method but can leverage interoperability features like precompiles and pointer contracts to support both environments.

Wallet Connection

Connecting to a wallet is a critical step in dApp development. Below are some recommended wallet connection libraries, each with its specific advantages:

EVM and EVM RPC dApps:

  • Wagmi: A React-based library for Ethereum dApps that simplifies wallet connections and interactions. It provides hooks for interacting with Ethereum wallets and contracts, making it suitable for modern frontend libraries and frameworks.

  • Viem: A lightweight and flexible Ethereum development library.

  • Ethers.js: A complete and compact library for interacting with the Ethereum blockchain and its ecosystem. Known for its simplicity and extensive functionality.

RPC Endpoints

dApps need to connect to RPC providers to broadcast transactions or query the chain. There are many free providers available on testnets and development networks, while mainnets have some rate-limited providers. For more information and links, refer to the RPC Providers section.

Polyfills Warning

When developing frontend applications for blockchain, it’s important to note that certain libraries may require polyfills, especially when used in a browser environment. For example, the Buffer class and other Node.js-specific features are not natively available in browsers and need to be polyfilled.

If you’re using Vite or another Rollup-based frontend library, you can add the following to your application’s entry point:

import { Buffer } from 'buffer';

// Polyfill self for browsers, global for Node.js
const globalObject = typeof self !== 'undefined' ? self : global;

Object.assign(globalObject, {
  process: process,
  Buffer: Buffer
});

If you’re using a Webpack-based bundler, you can use the following plugin in your Webpack configuration:

yarn add -D node-polyfill-webpack-plugin
import NodePolyfillPlugin from 'node-polyfill-webpack-plugin';

... // The rest of your Webpack configuration
plugins: [
    ...
    new NodePolyfillPlugin(),
    ...
],
...

Advice for New Developers

  1. Understand Gas Fees: Gas fees are essential for executing transactions on the blockchain. Ensure you understand how they work and how to optimize your contracts to minimize gas usage.

  2. Security Practices: Always follow best security practices. Regularly audit your code and stay informed about the latest security vulnerabilities and patches.

  3. Testing: Thoroughly test your dApps in different environments to ensure they function correctly. Use testnets and faucets to test transactions without spending real tokens.

  4. Documentation: Leverage the extensive documentation available for each library and tool. Good documentation can significantly speed up your development process.

  5. Community and Support: Join developer communities, forums, and chat groups. Engaging with other developers can provide valuable insights and help you resolve issues more efficiently.

Wagmi Documentation
Viem Documentation
Ethers.js Documentation