Vince Chain Documentation
  • Vince Chain x Users
    • Getting Started
      • What is Vince Chain?
      • Vince Chain dApps
      • Vince Chain Features and Offerings.
    • Connecting Wallet
      • Blithe Wallet
        • Install Blithe Wallet
        • Set up Blithe Wallet account
        • Secure Blithe Wallet.
      • Metamask
        • Install Metamask
        • Set up Metamask account
        • Adding Vince Chain account manually on Metamask
        • Importing wallet on Metamask
        • Resetting Account​
        • Downloading Account State​
        • Registering for Vince Chain Domains​
      • Keplr
      • Ledger
      • Transferring Tokens on Vince Chain
      • View Balances
      • Vince Chain Onramp
      • Sending and receiving assets on Vince Chain
      • Deposit and Withdraw Assets across Chains​
    • Using dApp on Vince Chain
      • Queries and Transactions​
      • Vince Chain dApps
        • Staking​
        • Governance​
    • Frequently Asked Questions (FAQs)
  • 2. Vince Chain x Developers
    • Overview
      • Why build on Vince Chain?
      • Building dApps on Vince Chain
      • Contributing to Vince Chain Ecosystem
    • Building DApps & Smart Contracts
      • Deploying EVM Smart Contracts on Vince Chain
      • What are EVM Smart Contracts?
      • Smart Contracts & Solidity​
      • Smart Contracts & EVM Extensions
      • Smart Contracts & Oracles
      • Smart Contracts & JSON-RPC
      • Vince Explorers
      • Contract Verification
      • Post-project features on Vince Chain
    • Building a dApp front-end
      • Indexers
      • Wallet Integration
    • Building a dApp backend
    • Testnet
      • Security Audits
    • Mainnet
      • Deployment
      • Token distribution
      • Revenue
      • Vince Chain Community
    • Developer Kit
      • Block Explorers
      • Oracles
        • Oracle features
        • How do oracles work?
        • Vince Chain oracles
        • DIA
        • SEDA Network
        • Adrastia
      • Vince Client Integrations
        • Ethereum Client Integrations​
      • Contract Verification
      • Tools x Plugins x IDE
      • Indexers
        • Covalent: Indexer
    • Tools
      • Vince Chain Explorers
      • Oracles
      • Contract Verification
      • Tools & Plugins
      • Indexers
      • Vince Chain Client Integrations
    • API
      • Networks
      • Vince Clients
      • Ethereum JSON-RPC
      • Cosmos gRPC and REST Routes
      • Tendermint RPC
      • Snapshots & Archive Nodes
    • Frequently Asked Questions
  • 3. Vince Chain Protocols
    • Technical Architecture
      • Cosmos SDK
      • What is CometBFT?
      • Is Vince Chain compatible with EVM?
      • Contributing to Vince Chain
    • Vince Chain CLI
      • Configuration
      • Working with Docker
      • Single Node
      • Multi Node
      • CLI Commands
    • Concepts
      • Accounts
      • Vince Chain Accounts
        • Addresses and Public Keys
        • Address conversion
        • Key output
      • Querying an Account
        • Cosmos gRPC and REST
        • JSON-RPC
      • Chain ID
      • Vince Chain’s Identifiers
      • The Chain ID
      • Vince Chain ID Structure/Format
      • Encoding
        • Ethereum’s Recursive-Length Prefix (RLP) Encoding
        • Cosmos SDK Encoding
      • IBC Relayers
        • IBC layers
        • Restore & Manage Keys
      • Restore & Manage Keys
      • Keyring
        • Operating Systems (OS) Backends
        • File
        • Password Store
        • KDE Wallet Manager​
      • Transactions
        • Ethereum transactions
        • Cosmos Transactions
        • Vince Chain Transaction
      • Tokens
        • Overview
        • Vince Chain (VCE)
        • Ethereum (ETH)
        • Cosmos (ATOM)
      • Gas and Fees
        • What is Gas?
        • Why transaction fees are important.
        • Calculating Network Gas
        • Are Gas also fees? —What’s the relationship?
    • Modules
    • Module Accounts
    • Bugs
    • IBC Channels
    • Security
    • Metrics
    • Frequently Asked Questions
  • 4. Technical Documentation
    • Quick Start
    • Vince Tokenomics
    • Staking/Delegation
    • Set Up Validators
    • Keys and Wallets
    • JSON RPC & WebSockets
    • Node Requirements
    • Vince Chain Validators
      • Disk Space Optimization
      • Rewards Management
      • Validator Concepts
      • FAQ
    • Vince Chain Governance
    • Grants & Bounties
    • Resources
Powered by GitBook
On this page
  • What is JSON and JSON-RPC?
  • JSON-RPC EVM Support on Vince Chain
  • How to define namespaces
  • Cross-Origin Resource Sharing (CORS)
  • EVM Websocket
  1. 4. Technical Documentation

JSON RPC & WebSockets

Learn about the blockchain communication protocol, JSON-RPC on Vince Chain

PreviousKeys and WalletsNextNode Requirements

Last updated 2 years ago

What is JSON and JSON-RPC?

(aka, JavaScript Object Notation) is a JavaScript-derived language-independent data interchange format that uses human-readable text to store and transmit data objects consisting of attributes such as numbers, strings, ordered sequences of values, and collections of names, value pairs, and arrays.

Encoded in JSON, is the , a stateless, lightweight remote procedure call (RPC) protocol, basically used to define data structures and the rules of their processing. JSON-RPC is one of several methods that enables a software application to invoke functionality from another application. I.e., allowing software to communicate with one another. It enables this communication over web sockets and HTTP. using the JSON () data format.

JSON-RPC EVM Support on Vince Chain

Vince Chain JSON-RPC APIs and all Web3 communication API protocols standards.

The Ethereum JSON-RPC APIs use a name-space system. The JSON-PRC Server provides an API that allows you to connect to Vince Chain's mainnet and interact with the EVM. Vince Chain supports JSON-RPC over HTTP and WebSocket, enabled through command-line flags or through the app.toml configuration file.

The remote procedure call protocol (RPC) methods may use several categories depending on their motive. All method names comprise the namespace, an underscore, and the actual method name within the namespace. A typical example is the eth_call method that resides in the eth namespace. You can enable access to RPC methods on a per-namespace basis.

How to define namespaces

Eth,Net and Web3 namespaces are enabled by default. In order to enable other namespaces, use the flag --json-rpc.api.

Example:

vinced start --json-rpc.api eth,txpool,personal,net,debug,web3,miner

Cross-Origin Resource Sharing (CORS)

CORS is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served.

If you do not put the RPC by a reverse proxy when accessing the RPC from a browser, you will need to enable CORS with an appropriate domain set. Otherwise, the JavaScript calls will be limited by the same origin policy, which could cause RPC requests to fail.

You can update the CORS setting from the app.toml

Example:

###############################################################################
###                           API Configuration                             ###
###############################################################################

[api]

# ...

# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk).
enabled-unsafe-cors = true # default false

EVM Websocket

Since Vince Chain's core consensus engine is the Tendermint Core (because of the Cosmos SDK framework), it assumes their event format.

You can start a connection with the Ethereum WebSocket using the --json-rpc.ws-address flag when starting the node (default "0.0.0.0:8546"):

vinced start --json-rpc.address"0.0.0.0:8545" --json-rpc.ws-address="0.0.0.0:8546" --evm.rpc.api="eth,web3,net,txpool,debug" --json-rpc.enable

Connect to JSON RPC tendermint WebSocket at port 8546 as defined above: ws ws://localhost:8546/

Nevertheless, to support the native Web3 compatibility for the WebSockets of the , Vince Chain needs to cast its retrieved Tendermint responses into the Ethereum types.

JSON
JSON-RPC
RFC 4627
Ethereum PubSubAPI (opens new window)