BlockX supports different clients in order to support Cosmos and Ethereum transactions and queries:
Cosmos gRPC
BlockX exposes gRPC endpoints for all the integrated Cosmos SDK modules. This makes it easier for wallets and block explorers to interact with the Proof-of-Stake logic and native Cosmos transactions and queries.
Cosmos gRPC-Gateway (HTTP REST)
gRPC-Gateway reads a gRPC service definition and generates a reverse-proxy server which translates RESTful JSON API into gRPC. With gRPC-Gateway, users can use REST to interact the Cosmos gRPC service.
Ethereum JSON-RPC
BlockX supports most of the standard JSON-RPC APIs to connect with existing Ethereum-compatible web3 tooling.
# connect to tendermint websocet at port 8546 as defined abovewsws://localhost:8546/# subscribe to new Ethereum-formatted block Headers> {"id":1,"method":"eth_subscribe","params": ["newHeads", {}]}< {"jsonrpc":"2.0","result":"0x44e010cb2c3161e9c02207ff172166ef","id":1}
Tendermint Websocket
Tendermint Core provides a Websocket connection to subscribe or unsubscribe to Tendermint ABCI events.
For more info about the how to subscribe to events, please refer to the official Tendermint documentation.
{"jsonrpc":"2.0","method":"subscribe","id":"0","params":{"query":"tm.event='<event_value>' AND eventType.eventAttribute='<attribute_value>'" }}
List of Tendermint Events
The main events you can subscribe to are:
NewBlock: Contains events triggered during BeginBlock and EndBlock.
Tx: Contains events triggered during DeliverTx (i.e. transaction processing).
ValidatorSetUpdates: Contains validator set updates for the block.
The list of events types and values for each Cosmos SDK module can be found in the Modules Specification section. Check the Events page to obtain the event list of each supported module on BlockX .
List of all Tendermint event keys:
Below is a list of values that you can use to subscribe for the tm.event type:
Users can use the blockxd binary to interact directly with an BlockX node though the CLI.
To use the CLI, you will need to provide a Tendermint RPC address for the --node flag. Look for a publicly available addresses for testnet and mainnet in the Establishing Connections page.
Transactions: blockxd tx
The list of available commands, as of v3.0.0, are:
The list of available commands, as of v3.0.0, are:
AvailableCommands:accountQueryforaccountbyaddressauthQueryingcommandsfortheauthmoduleauthzQueryingcommandsfortheauthzmodulebankQueryingcommandsforthebankmoduleblockGetverifieddataforatheblockatgivenheightclaimsQueryingcommandsfortheclaimsmoduledistributionQueryingcommandsforthedistributionmoduleepochsQueryingcommandsfortheepochsmoduleerc20Queryingcommandsfortheerc20moduleevidenceQueryforevidencebyhashorforall (paginated) submitted evidenceevmQueryingcommandsfortheevmmodulefeegrantQueryingcommandsforthefeegrantmodulefeemarketQueryingcommandsforthefeemarketmodulegovQueryingcommandsforthegovernancemoduleibcQueryingcommandsfortheIBCmoduleibc-transferIBCfungibletokentransferquerysubcommandsincentivesQueryingcommandsfortheincentivesmoduleinflationQueryingcommandsfortheinflationmoduleparamsQueryingcommandsfortheparamsmodulerecoveryQueryingcommandsfortherecoverymoduleslashingQueryingcommandsfortheslashingmodulestakingQueryingcommandsforthestakingmoduletendermint-validator-setGetthefulltendermintvalidatorsetatgivenheight tx Query for a transaction by hash, "<addr>/<seq>" combination or comma-separated signatures in a committed block
txsQueryforpaginatedtransactionsthatmatchasetofeventsupgradeQueryingcommandsfortheupgrademodulevestingQueryingcommandsforthevestingmodule
When querying Ethereum transactions versus Cosmos transactions, the transaction hashes are different. When querying Ethereum transactions, users need to use event query. Here's an example with the CLI:
curl -X GET "http://localhost:26657/tx_search?query=ethereum_tx.ethereumTxHash%3D0x8d43464891fac6c113e809e14dff1a3e608eae124d629799e42ca0e36562d9d7&prove=false&page=1&per_page=30&order_by=asc" -H "accept: application/json"