logo

Chủ đề:

Ngôn ngữ:

logo

Icon DeFiMetaChain networkDeFiMetaChain

Chain ID

1133

Currency symbol

DFI

Trang web

https://defichain.com

Block explorer URL

https://meta.defiscan.live

DeFiMetaChain - Danh sách RPC Endpoint
RPC EndpointThêm vào ví
https://testnet-dmc.mydefichain.com:20551

Cách sử dụng DeFiMetaChain RPC Endpoint

Bạn có thể sử dụng DeFiMetaChain RPC Endpoint để kết nối với các thư viện web3 như: ethejs, web3 hoặc các ví web3 như: Metamask, WalletConnect, WalletConnect.. cho phép bạn có thể dễ dàng tương tác với blockchain cũng như sử dụng cho các ứng dụng phi tập trung trên DeFiMetaChain

Thư viện Web3

web3js

   const Web3 = require('web3');

   // Replace 'YOUR_RPC_URL' with the DeFiMetaChain RPC endpoint URL
   const rpcURL = https://testnet-dmc.mydefichain.com:20551;

   // Create a new Web3 instance using the RPC endpoint
   const web3 = new Web3(new Web3.providers.HttpProvider(rpcURL));

   // Now you can use the 'web3' object to interact with DeFiMetaChain
   web3.eth.getBlockNumber()
      .then(blockNumber => {
         console.log('Latest block number:', blockNumber);
      })
      .catch(error => {
         console.error('Error:', error);
      });
   

ethersjs

   const ethers = require('ethers');

   // Replace 'YOUR_RPC_URL' with the DeFiMetaChain RPC endpoint URL
   const rpcURL = https://testnet-dmc.mydefichain.com:20551;

   // Create a provider using the DeFiMetaChain RPC endpoint
   const provider = new ethers.providers.JsonRpcProvider(rpcURL);

   // You can use the 'provider' object to interact with DeFiMetaChain
   provider.getBlockNumber()
      .then(blockNumber => {
         console.log('Latest block number:', blockNumber);
      })
      .catch(error => {
         console.error('Error:', error);
      });
   

Các ví web3 (Metamask, WalletConnect, Coinbase Wallet, Taho, Argent...)

Bạn có thể sử dụng DeFiMetaChain Thư viện Web3