LogoLogo
Blockchain ExplorerGitHubCertikWebsite
  • 🚀Metacces is coming !!!
  • 🎯Mission & Vision
  • 📈Market Analysis
  • 🤝Partnerships
  • METACCES: GENERAL
    • 🎮Metacces: AR/VR Game
      • 👉Introduction
      • 🔑Key features
      • 📈Earning mechanics
      • 👽Unique Oli AI
      • 🧬Blacxes
        • What is Blacxes
        • Utilites
        • Unique DNA
        • DAO Governance
        • Technology
        • Distribution
        • Swap
      • ⛓️Bridging Web2 Simplicity with Web3 Power
      • 🚀How Does Metacces Outperform the Competition?
      • 🎮Game Structure
        • Origin Story: Oli & the Blacxes
        • Game theme (Access Journey)
          • Overview
          • Basic level
          • Intermediate level
          • Final level
        • Activities and Gameplay
        • Game seasons
          • Introduction
          • Season Concept
          • What Does Each Season Include?
          • Importance of Seasons in Metacces
        • Skins & Tools
          • Introduction
          • Core Principles
          • Core Uses of Tools
          • Main Categories of Tools
          • Rarity and Value
          • Symbolism of Tools
          • Verification and Security Mechanisms
        • Clans
          • Introduction
          • Core Pillars of the Clan System
          • Clan Activities
          • Ownership and Economy Within the Clan
          • The Reputation System
          • The Future of Clans in Metacces
          • How to Create a Clan in Metacces
    • 🪙Acces Coin
      • Coin Utility
      • Smart-Contracts
      • Tokenomecs
      • Metacces Listings Roadmap
    • ⛓️Blockchain Layer 1
      • Developers
        • Public Endpoints
        • MetaMask
        • Node Setup
        • JSON RPC Server
        • Connect to RPC
        • API Methods
        • Client Libraries
        • Smart Contracts
          • Deploy
          • Interact
          • Transfer
          • Fixed Cap Asset
          • Variable Cap Asset
  • DEVELOPMENT
  • 📅Roadmap
    • Main Roadmap
      • ✔️2022
      • ✔️2023
      • 🔛2024
      • 2025
    • Coin Roadmap
      • 2022
      • 2023
      • 2024
  • TEAM
    • 7️⃣Core 7 values
    • 👨‍🚀Meet The Team
  • SECURITY
    • 🫂 Team KYC Gold Verified by CERTIK (2024)
    • 🪙Coin Audit by CERTIK
    • 🗓️Smart Contract Vesting Audit by CERTIK
    • 🪙Coin Audit by SOLIDPROOF
    • 🪙Coin Audit by HACKEN
  • OTHER INFO
    • Contact Us
    • Community
      • Website
      • Telegram
      • X.Twitter
      • Discord
      • Youtube
      • Instagram
      • Facebook
Powered by GitBook
On this page
  • Connect to a node
  • Use geth attach​
  • Use the RPC interface​
  • Use the WebSocket interface​

Was this helpful?

  1. METACCES: GENERAL
  2. Blockchain Layer 1
  3. Developers

Connect to RPC

PreviousJSON RPC ServerNextAPI Methods

Last updated 9 months ago

Was this helpful?

Connect to a node

Use geth attach

The Geth JavaScript console exposes the Web3 JavaScript API for development use, and can be started using the console or attach Geth subcommands. The console subcommand starts the Geth node and opens the console, while the attach subcommand attaches an already-running Geth instance to the console.

Run the attach subcommand and connect to the IPC socket, or, if enabled, to the RPC or WebSocket API endpoints:

  • IPC socket

  • RPC API endpoint

  • WebSocket API endpoint

  • Geth console result

Copy

geth attach /path/to/geth.ipc

Once connected you can execute commands as normal. For example, check existing validators using the following command:

  • Geth console request

  • JSON result

Copy

istanbul.getValidators();

Exit the console using the following command:

Copy

exit;

You can connect to a running node by making HTTP REST requests on the RPC endpoint, which is exposed on port 8545 by default.

To enable the RPC interface, start the Metacces node with the following parameters:

Copy

--http                           # Enable the HTTP-RPC server endpoint
--http.addr localhost            # HTTP-RPC server listening interface (default: "localhost")
--http.port 8545                 # HTTP-RPC server listening port (default: 8545)
--http.corsdomain "localhost"    # Comma-separated list of domains from which to accept cross origin requests (browser enforced)
--http.vhosts "localhost"        # Comma-separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.
--http.api admin,db,...          # APIs offered over the HTTP-RPC interface

Metacces supports the standard web3 JSON-RPC APIs.

For example, run the following command to get the list of validators at a given block:

  • curl HTTP request

  • JSON result

Copy

curl -X POST http://localhost:8545 --data '{"jsonrpc":"2.0","method":"istanbul_getValidators","params":[10],"id":1}' --header "Content-Type: application/json"

You can any tool to make requests, such as curl, Postman, or Web3.

You can connect to a running node using a WebSocket endpoint, which is exposed on port 8546 by default.

To enable the WebSocket interface, start the Metacces node with the following parameters:

Copy

--ws                           # Enable the WS-RPC server endpoint
--ws.addr localhost            # WS-RPC server listening interface (default: "localhost")
--ws.port 8545                 # WS-RPC server listening port (default: 8545)
--ws.origins "localhost"       # Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard
--ws.api admin,db,...          # APIs offered over the WS interface
--ws.rpcprefix "/"             # Path prefix on which WS-RPC is served. Use '/' to serve on all paths.

For example, to connect to an endpoint and get logs, run the following JavaScript:

Copy

const Web3 = require("web3");
var web3 = new Web3("wss://localhost:8546");
var subscription = web3.eth.subscribe(
  "logs",
  {
    address: "0x123456..",
    topics: ["0x12345..."],
  },
  function (error, result) {
    if (!error) console.log(result);
  },
);

Use the RPC interface

Use the WebSocket interface

⛓️
​
​
​