The Chorus One SDK is a all-in-one toolkit for building staking dApps. It supports non-custodial staking on Cosmos, Near, Ethereum, Polkadot, and Avalanche networks. With this SDK, you can build, sign, and broadcast transactions as well as retrieve staking information and rewards for user accounts.
You can review the GitHub repository here:
Key Features
Transaction Management: Seamlessly build, sign, and broadcast staking, unstaking, delegation, and reward withdrawal transactions.
Information Retrieval: Fetch detailed staking information and reward data for any account.
Non-Custodial Operations: Transactions are generated and signed locally by the user, ensuring enhanced security and decentralization. This setup allows code audits and protects against malicious actors.
Flexible Custody Options: Users can employ various custody solutions; including mobile wallets, browser extensions, hardware wallets, Fireblocks, or custom custodial wallets.
Fireblocks Integration: The Chorus One SDK provides easy-to-use tools for securely signing transactions with Fireblocks across supported blockchain networks, offering a convenient custodial solution.
Chorus One Validator Support: The SDK includes built-in support for Chorus One validators across all networks. It also allows users to specify their own validator addresses.
Supported Networks
Ethereum ()
()
()
Polkadot ()
Avalanche ()
Supported Signers (Custody Solutions)
Installation
The Chorus One SDK is available as a set of npm packages and supports both Node.js and browser environments.
Please ensure you have Node.js (v20) installed on your machine.
To install the SDK, run some of the following commands depending on your setup:
# Networks
bun add @chorus-one/ethereum
bun add @chorus-one/cosmos
bun add @chorus-one/near
bun add @chorus-one/polkadot
bun add @chorus-one/avalanche
# Signers
bun add @chorus-one/signer-fireblocks
bun add @chorus-one/signer-local
Example Usage
Here is a basic example of how to use the Chorus One SDK to build, sign, and broadcast a staking transaction using Fireblocks as the signer.
// Configuration
// --------------
import { CosmosStaker, CHORUS_ONE_COSMOS_VALIDATORS } from '@chorus-one/cosmos';
import { FireblocksSigner } from '@chorus-one/signer-fireblocks';
const signer = new FireblocksSigner({...});
await signer.init();
const staker = new CosmosStaker({
signer: signer,
rpcUrl: 'https://rpc.cosmos.network:26657',
bechPrefix: 'cosmos',
denom: 'uatom',
denomMultiplier: "1000000",
gas: 200000,
gasPrice: '1',
});
await staker.init();
// Building the transaction
// ------------------------
const delegatorAddress = 'cosmos1x88j7vp2xnw3zec8ur3g4waxycyz7m0mahdv3p';
// You can use the Chorus One validator address or specify your own
const validatorAddress = CHORUS_ONE_COSMOS_VALIDATORS.COSMOS
// 'cosmosvaloper15urq2dtp9qce4fyc85m6upwm9xul3049e02707'
const { tx } = await staker.buildStakeTx({
delegatorAddress: delegatorAddress,
validatorAddress: validatorAddress,
amount: '1', // 1 ATOM
});
// Signing the transaction with Fireblocks
// ---------------------------------------
const { signedTx } = await staker.sign({
signerAddress: delegatorAddress,
tx,
memo: 'Staking 1 ATOM',
});
// Broadcasting the transaction
// ----------------------------
const { transactionHash } = await staker.broadcast({ signedTx });
// Configuration
// --------------
import { NearStake, CHORUS_ONE_NEAR_VALIDATOR } from '@chorus-one/near';
import { FireblocksSigner } from '@chorus-one/signer-fireblocks';
const signer = new FireblocksSigner({...});
await signer.init();
const staker = new NearStaker({
signer: signer,
networkId: "mainnet",
rpcUrl: "https://rpc.mainnet.near.org",
});
await staker.init();
// Building the transaction
// ------------------------
const delegatorAddress = 'your-near-account.near';
// You can use the Chorus One validator address or specify your own
const validatorAddress = CHORUS_ONE_NEAR_VALIDATOR;
// 'chorusone.poolv1.near'
const { tx } = await staker.buildStakeTx({
delegatorAddress: delegatorAddress,
validatorAddress: validatorAddress,
amount: '1', // 1 NEAR
});
// Signing the transaction with Fireblocks
// ---------------------------------------
const { signedTx } = await staker.sign({
signerAddress: delegatorAddress,
tx,
});
// Broadcasting the transaction
// ----------------------------
const { transaction: { hash } } = await staker.broadcast({ signedTx });
Next Steps
To help you get started with specific blockchain networks, please check out the detailed guides for each supported chain below.