ONINO Docs
  • Introduction to ONINO
    • Welcome to ONINO
    • The Tokenization Opportunity
    • ONINO Blockchain
  • ONINO Tokenization Platform
  • ONINO Developer Platform
  • Tokenomics
    • Incentive and Mechanism Design
    • Token Distribution & Emission Schedules
  • For Developers
    • Building on ONINO
    • Mainnet Configuration
    • Testnet Configuration
    • Solidity Compiler Versions
    • Nodes & Validators
      • For Validators & Node Operators
      • Validator Ramp-Up Phases
    • Developer Platform Overview
      • Quickstart Guide
      • Overview
      • Templates
      • Brainstorming AI
      • Code Generator AI
      • Contract Import
      • Development Studio
      • Deployment Suite
      • Smart Contract API
      • Integration AI
      • Contract Manager
      • How-To: Using AWS KMS wallets with the ONINO Smart Contract API
      • Smart Contract Templates
        • Template Overview
        • Creating Tokens
          • Token with Fixed Supply
          • Token with Mintable Supply
        • Creating NFTs
          • Standard NFT
          • NFT with fixed Supply
        • Create your Custom Project
  • For Users
    • Welcome to ONINO
    • Staking Guide
    • Token Upgrade Process
    • Getting Started with ONINO
      • How to add the ONINO Network to your Wallet
      • How to create a Wallet
    • The ONINO Tokenization Platform
      • Walkthrough & Guide
  • FAQs
    • General Blockchain FAQs
    • What is tokenization?
    • ONINO General FAQs
    • Learn more about blockchain
      • How to use different blockchain networks?
      • What is the Ethereum Virtual Machine (EVM)?
      • What is a Smart Contract?
    • What are Crypto Tokens & Coins
Powered by GitBook
On this page
  • Building on ONINO
  • Get Started
  • Hardhat Configuration for ONINO

Was this helpful?

  1. For Developers

Building on ONINO

Guides, Tipps and Toolkits to build on ONINOs tokenization infrastructure.

PreviousToken Distribution & Emission SchedulesNextMainnet Configuration

Last updated 1 month ago

Was this helpful?

Building on ONINO

ONINO is a fully EVM-compatible Layer-1 blockchain, meaning it behaves just like Ethereum and any other EVM-based blockchain from a smart contract perspective. Smart contracts written in Solidity will run on ONINO without modification, and developers can use their favorite Ethereum development libraries and tools to interact with ONINO. This compatibility allows native interoperability with existing Ethereum tooling, making the developer experience very familiar.

Developers can work with ONINO using standard Web3 libraries such as ethers.js, web3.js, and wagmi, among others. Below are brief examples of how to connect to ONINO using these tools (simply change the RPC endpoint to switch between Mainnet and Testnet):

Get Started

Using ethers.js

You can use thers.js to connect to ONINO by pointing a JSON RPC provider to ONINO’s RPC URL. For example, to connect to ONINO and fetch the latest block number:

import { ethers } from "ethers";

// Connect to ONINO (Mainnet in this example)
const provider = new ethers.providers.JsonRpcProvider("<https://rpc.onino.io>");

// Fetch the latest block number (returns a Promise)
provider.getBlockNumber().then(blockNumber => {
  console.log("Latest ONINO block:", blockNumber);
});

This code uses the ONINO Mainnet RPC. To target the Testnet instead, you would use the Testnet RPC URL (see details below). All other ethers.js functionalities (like sending transactions, reading contract data, etc.) work the same way as they do on Ethereum.

Using web3.js

With web3.js, connecting to ONINO is also straightforward. You just initialize a Web3 instance with the ONINO RPC endpoint. For example:

const Web3 = require('web3');

// Connect to ONINO (Mainnet)
const web3 = new Web3('<https://rpc.onino.io>');

// Get the ONINO chain ID to verify connection
web3.eth.getChainId().then(chainId => {
  console.log("Connected to chain:", chainId);
});

This snippet will output ONINO’s chain ID (e.g., 1425 for Mainnet). You can use all usual web3.eth methods on ONINO as you would on Ethereum (for example, sendTransaction, contract calls, etc.), since ONINO’s nodes use the same JSON-RPC interface as an Ethereum node.

Using wagmi (for React)

If you're building a front-end with wagmi (a React hooks library for Ethereum), you can integrate ONINO as a custom chain. Define ONINO’s chain parameters and include them in wagmi’s configuration. For example, to add ONINO Mainnet:

import { configureChains, createConfig, Chain } from 'wagmi';
import { publicProvider } from 'wagmi/providers/public';

const oninoMainnet: Chain = {
  id: 1425,
  name: 'ONINO Mainnet',
  network: 'onino',
  nativeCurrency: { name: 'ONINO', symbol: 'ONI', decimals: 18 },
  rpcUrls: {
    default: { http: ['<https://rpc.onino.io>'] },
  },
  blockExplorers: {
    default: { name: 'ONINO Explorer', url: '<https://explorer.onino.io>' },
  },
  testnet: false,
};

const { chains, publicClient } = configureChains(
  [oninoMainnet],
  [publicProvider()]
);

const wagmiClient = createConfig({
  autoConnect: true,
  publicClient,
  chains,
});

This configuration snippet creates a custom chain object for ONINO Mainnet and sets up a wagmi client. Once configured, your dApp can connect wallets to ONINO, and wagmi’s hooks (like useAccount, useContractRead, etc.) will operate on ONINO’s network. For ONINO Testnet, you would use the Testnet chain ID and RPC (and mark testnet: true).

Tip: Other developer tools such as Hardhat, Truffle, or Remix are also compatible with ONINO. For example, you can deploy contracts via Hardhat by setting the network URL to ONINO’s RPC and chain ID in the Hardhat config, just as you would for any other Ethereum-compatible network.

Hardhat Configuration for ONINO

To deploy and interact with smart contracts on the ONINO network using Hardhat, you need to configure the hardhat.config.js file to include ONINO's network settings. Below is an example configuration:

require("@nomicfoundation/hardhat-toolbox");
require("dotenv").config();

module.exports = {
  solidity: {
    version: "0.8.19", // Use Solidity 0.8.19 or set evmVersion to "paris" for compatibility (see below for more details)
    settings: {
      optimizer: {
        enabled: true,
        runs: 200,
      },
      evmVersion: "paris", // Target the Paris EVM version to avoid PUSH0 opcode issues (see below for more details)
    },
  },
  defaultNetwork: "oninoMainnet",
  networks: {
    oninoMainnet: {
      url: "<https://rpc.onino.io>",
      chainId: 1425,
      accounts: [process.env.PRIVATE_KEY], // Load your private key from env
    },
    oninoTestnet: {
      url: "<https://rpctestnet.onino.io>",
      chainId: 211223,
      accounts: [process.env.PRIVATE_KEY],
    },
  },
};

Using Reown (Previously Web3Modal)

To integrate ONINO with Reown's AppKit (previously known as Web3Modal), first install the necessary packages:

npm install @reown/appkit @reown/appkit-adapter-wagmi wagmi viem @tanstack/react-query

Then, configure AppKit with ONINO's network details:

import { createAppKit } from '@reown/appkit/react';
import { WagmiAdapter } from '@reown/appkit-adapter-wagmi';
import { mainnet } from '@reown/appkit/networks';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { WagmiProvider } from 'wagmi';

const oninoNetwork = {
  id: 1425,
  name: 'ONINO Mainnet',
  network: 'onino',
  nativeCurrency: { name: 'ONINO', symbol: 'ONI', decimals: 18 },
  rpcUrls: {
    default: { http: ['<https://rpc.onino.io>'] },
  },
  blockExplorers: {
    default: { name: 'ONINO Explorer', url: '<https://explorer.onino.io>' },
  },
  testnet: false,
};

const projectId = 'YOUR_PROJECT_ID'; // Obtain from Reown Cloud

const metadata = {
  name: 'Your App Name',
  description: 'Your App Description',
  url: '<https://yourapp.com>',
  icons: ['<https://yourapp.com/icon.png>'],
};

const wagmiAdapter = new WagmiAdapter({
  networks: [oninoNetwork],
  projectId,
});

const appKit = createAppKit({
  adapters: [wagmiAdapter],
  networks: [oninoNetwork],
  projectId,
  metadata,
  features: {
    analytics: true,
  },
});

const queryClient = new QueryClient();

function App() {
  return (
    <WagmiProvider config={wagmiAdapter.wagmiConfig}>
      <QueryClientProvider client={queryClient}>
        {/* Your app components */}
      </QueryClientProvider>
    </WagmiProvider>
  );
}

Ensure you replace 'YOUR_PROJECT_ID' with your actual project ID from the Reown Cloud Dashboard. For more details, refer to the .

Reown AppKit documentation
Cover

Developer Platform

Rapidly build and deploy blockchain solutions with ease.

Developer Platform Overview
Cover

Mainnet Configuration

Set up and connect smoothly to the ONINO main network.

Mainnet Configuration
Cover

Testnet Configuration

Quickly configure and test your apps on ONINO’s test network.

Testnet Configuration
Cover

Solidity Compiler Versions

Guidelines on supported Solidity versions for smart contracts.

Solidity Compiler Versions
Cover

Nodes & Validators

Learn how to operate nodes and validate transactions.

Nodes & Validators
Cover

Start Building

Explore how to build directly on the ONINO Mainnet.

Building on ONINO