Security News
JavaScript Leaders Demand Oracle Release the JavaScript Trademark
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
@cosmjs/tendermint-rpc
Advanced tools
@cosmjs/tendermint-rpc is an npm package that provides a client for interacting with Tendermint-based blockchains. It allows developers to query blockchain data, subscribe to events, and broadcast transactions using Tendermint's RPC protocol.
Querying Blockchain Data
This feature allows you to query various pieces of information from the blockchain, such as the current status, block information, and more. The code sample demonstrates how to connect to a Tendermint node and fetch its status.
const { Tendermint34Client } = require('@cosmjs/tendermint-rpc');
async function queryBlockchain() {
const client = await Tendermint34Client.connect('http://localhost:26657');
const status = await client.status();
console.log(status);
}
queryBlockchain();
Subscribing to Events
This feature allows you to subscribe to various events happening on the blockchain, such as new blocks being created. The code sample demonstrates how to subscribe to new block events and handle them.
const { Tendermint34Client, SubscriptionEventType } = require('@cosmjs/tendermint-rpc');
async function subscribeToEvents() {
const client = await Tendermint34Client.connect('http://localhost:26657');
const subscription = client.subscribe({
query: 'tm.event = "NewBlock"'
});
subscription.addListener(SubscriptionEventType.NewBlock, (event) => {
console.log('New block event:', event);
});
}
subscribeToEvents();
Broadcasting Transactions
This feature allows you to broadcast transactions to the blockchain. The code sample demonstrates how to connect to a Tendermint node and broadcast a sample transaction.
const { Tendermint34Client } = require('@cosmjs/tendermint-rpc');
async function broadcastTransaction(tx) {
const client = await Tendermint34Client.connect('http://localhost:26657');
const result = await client.broadcastTxCommit({ tx });
console.log(result);
}
const sampleTx = new Uint8Array([0x00, 0x01, 0x02]);
broadcastTransaction(sampleTx);
The 'tendermint' npm package provides a client for interacting with Tendermint nodes. It offers similar functionalities such as querying blockchain data, subscribing to events, and broadcasting transactions. However, it may not be as actively maintained or feature-rich as @cosmjs/tendermint-rpc.
The 'cosmos-client' npm package is designed for interacting with Cosmos SDK-based blockchains. It provides functionalities for querying blockchain data, managing accounts, and broadcasting transactions. While it offers similar features, it is more focused on the Cosmos SDK ecosystem compared to the more general Tendermint focus of @cosmjs/tendermint-rpc.
The 'tendermint-rpc' npm package is another client for interacting with Tendermint nodes. It provides basic functionalities for querying blockchain data and broadcasting transactions. It is simpler and may lack some of the advanced features and optimizations found in @cosmjs/tendermint-rpc.
This package provides a type-safe wrapper around
Tendermint RPC. Notably, all binary
data is passed in and out as Uint8Array
, and this module is reponsible for the
hex/base64 encoding/decoding depending on the field and version of Tendermint.
Also handles converting numbers to and from strings.
This package is part of the cosmjs repository, licensed under the Apache License 2.0 (see NOTICE and LICENSE).
FAQs
Tendermint RPC clients
We found that @cosmjs/tendermint-rpc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.