Skip to content

Repository files navigation

InterchainJS

A single, universal signing interface for any network. Birthed from the interchain ecosystem for builders. Create adapters for any Web3 network.

Table of Contents

InterchainJS: Universal Signing for Web3

InterchainJS is a universal signing interface designed for seamless interoperability across blockchain networks. It is one of the core libraries of the Interchain JavaScript Stack, a modular framework that brings Web3 development to millions of JavaScript developers.

At its core, InterchainJS provides a flexible adapter pattern that abstracts away blockchain signing complexities, making it easy to integrate new networks, manage accounts, and support diverse authentication protocols and signing algorithms—all in a unified, extensible framework.

Overview

InterchainJS sits at the foundation of the Interchain JavaScript Stack, a set of tools that work together like nested building blocks:

  • InterchainJS → Powers signing across Cosmos, Solana, Ethereum (EIP-712), and beyond.
  • Interchain Kit → Wallet adapters that connect dApps to multiple blockchain networks.
  • Interchain UI → A flexible UI component library for seamless app design.
  • Create Interchain App → A developer-friendly starter kit for cross-chain applications.

This modular architecture ensures compatibility, extensibility, and ease of use, allowing developers to compose powerful blockchain applications without deep protocol-specific knowledge.

Visualizing InterchainJS Components

The diagram below illustrates how InterchainJS connects different signer types to various network classes, showcasing its adaptability for a wide range of blockchain environments.

graph LR
signers --> cosmos_signer["Cosmos Network"]
signers --> injective_signer["Injective Network"]
signers --> solana_signer["Solana Network"]
signers --> ethereum_signer["Ethereum Network"]
signers --> implement_signer["ANY Network"]
cosmos_signer --> cosmos_amino["Amino Signer"]
cosmos_signer --> cosmos_direct["Direct Signer"]
ethereum_signer --> eip1559_signer["EIP-1559 Signer"]
ethereum_signer --> legacy_signer["Legacy Signer"]
injective_signer --> injective_amino["Amino Signer"]
injective_signer --> injective_direct["Direct Signer"]
solana_signer --> solana_std["Standard Signer"]
implement_signer --> any_signer["Any Signer"]
style signers fill:#f9f,stroke:#333,stroke-width:2px
Loading
graph LR
encoders[Encoders] --> auth["@interchainjs/auth"]
encoders --> utils["@interchainjs/utils"]
encoders --> cosmos_types["@interchainjs/cosmos-types"]
auth --> secp256k1_auth["Secp256k1 Auth"]
auth --> ethSecp256k1_auth["EthSecp256k1 Auth"]
utils --> signer_utils["Signer Utilities"]
utils --> crypto_utils["Crypto Utilities"]
style encoders fill:#f9f,stroke:#333,stroke-width:2px
style auth fill:#ccf,stroke:#333,stroke-width:2px
style utils fill:#ccf,stroke:#333,stroke-width:2px
Loading

Installation

This guide will walk you through the process of installing and setting up interchainjs for your project.

You can install interchainjs using Yarn:

pnpm add interchainjs
pnpm add @interchainjs/cosmos

or npm

npm i interchainjs
npm i @interchainjs/cosmos

Quick Start

Using Signers Directly

Create and use signers for transaction signing and broadcasting:

import{DirectSigner}from'@interchainjs/cosmos';import{Secp256k1HDWallet}from'@interchainjs/cosmos';import{HDPath}from'@interchainjs/types';// Create wallet from mnemonicconstwallet=awaitSecp256k1HDWallet.fromMnemonic("your twelve word mnemonic phrase here",{derivations: [{prefix: "cosmos",hdPath: HDPath.cosmos(0,0,0).toString(),// m/44'/118'/0'/0/0}]});// Create signerconstsigner=newDirectSigner(wallet,{chainId: 'cosmoshub-4',queryClient: queryClient,addressPrefix: 'cosmos'});// Sign and broadcast transactionconstresult=awaitsigner.signAndBroadcast({messages: [{typeUrl: '/cosmos.bank.v1beta1.MsgSend',value: {fromAddress: 'cosmos1...',toAddress: 'cosmos1...',amount: [{denom: 'uatom',amount: '1000000'}]}}],fee: {amount: [{denom: 'uatom',amount: '5000'}],gas: '200000'},memo: 'Transfer via InterchainJS'});console.log('Transaction hash:',result.transactionHash);

Using with External Wallets

For integration with browser wallets like Keplr:

import{DirectSigner}from'@interchainjs/cosmos';// Get offline signer from Keplrawaitwindow.keplr.enable(chainId);constofflineSigner=window.keplr.getOfflineSigner(chainId);// Create signer with offline signerconstsigner=newDirectSigner(offlineSigner,{chainId: 'cosmoshub-4',queryClient: queryClient,addressPrefix: 'cosmos'});// Use the same signing interfaceconstresult=awaitsigner.signAndBroadcast({messages: [/* your messages */],fee: {amount: [{denom: 'uatom',amount: '5000'}],gas: '200000'}});

Quick Setup with create-interchain-app

The easiest way to get started is by using the create-interchain-app tool, which sets up a complete project with all necessary dependencies:

npm install -g create-interchain-app
cia --example authz

Then an authz example website will be created and users can take a look how signing clients and helper functions are used.


Supported Networks

Cosmos Network

FeaturePackage
Transactions@interchainjs/cosmos
Cosmos Types@interchainjs/cosmos-types
Migration from @cosmjsMigration Guide

Injective Network

FeaturePackage
Transactions@interchainjs/injective

Solana Network

Build on the request-object query client with automatic protocol detection and wallet-aware workflows.

FeaturePackage
Query & Transactions@interchainjs/solana
Standard Signer (solana_std)Solana Signer Guide

Ethereum Network

FeaturePackage
Transactions@interchainjs/ethereum

Developer Documentation

For Contributors and Network Implementers

Architecture and Design

InterchainJS follows a modular, three-layer architecture that separates concerns and enables flexible blockchain integration:

  1. Auth Layer: Cryptographic operations and key management
  2. Wallet Layer: Account management and address derivation
  3. Signer Layer: Transaction building, signing, and broadcasting

This separation allows for maximum flexibility while maintaining type safety and consistent interfaces across different blockchain networks.


Interchain JavaScript Stack ⚛️

A unified toolkit for building applications and smart contracts in the Interchain ecosystem

CategoryToolsDescription
Chain InformationChain Registry, Utils, ClientEverything from token symbols, logos, and IBC denominations for all assets you want to support in your application.
Wallet ConnectorsInterchain Kit, Cosmos KitExperience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface.
Signing ClientsInterchainJS, CosmJSA single, universal signing interface for any network
SDK ClientsTelescopeYour Frontend Companion for Building with TypeScript with Cosmos SDK Modules.
Starter KitsCreate Interchain App, Create Cosmos AppSet up a modern Interchain app by running one command.
UI KitsInterchain UIThe Interchain Design System, empowering developers with a flexible, easy-to-use UI kit.
Testing FrameworksStarshipUnified Testing and Development for the Interchain.
TypeScript Smart ContractsCreate Hyperweb AppBuild and deploy full-stack blockchain applications with TypeScript
CosmWasm ContractsCosmWasm TS CodegenConvert your CosmWasm smart contracts into dev-friendly TypeScript classes.

Credits

🛠 Built by the Constructive team — makers of Hyperweb

Disclaimer

AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.

No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.

About

A single, universal signing interface for any network (CosmJS 2.0)

Resources

Stars

12 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages