• Stars
    star
    594
  • Rank 72,736 (Top 2 %)
  • Language
    TypeScript
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The Swiss Army knife to power JavaScript based client solutions ranging from Web apps/explorers over browser extensions to server-side clients like faucets/scrapers.

CosmJS

CosmJS is the Swiss Army knife to power JavaScript based client solutions ranging from Web apps/explorers over browser extensions to server-side clients like faucets/scrapers in the Cosmos ecosystem.

"Cosm" is short for Cosmos and "JS" is short for runs everywhere – we actually develop in TypeScript.

Documentation

Here is a list of examples using the Stargate package for use with Cosmos SDK 0.41 applications (like gaia 4). Take a look at the wiki page, "What can CosmJS do for me?" and various tests (ex) for more example usage of the packages.

API documentation

The full API documentation is hosted at cosmos.github.io/cosmjs. This is a bit tricky to navigate and requires basic TypeScript understanding. It is helpful if you want to look up details for advanced use cases. This documentation is auto-generated based on the current main branch and can occasionally diverge from the latest release.

Using custom Stargate modules

Documentation on how to use your own custom modules with CosmJS for Stargate chains (Cosmos SDK v0.41) can be found here.

Packages

CosmJS is a library that consists of many smaller npm packages within the @cosmjs namespace, a so-called monorepo. Here are some of them to get an idea:

Package Description Latest
@cosmjs/stargate A client library for the Cosmos SDK 0.40+ (Stargate) npm version
@cosmjs/faucet A faucet application for node.js npm version
@cosmjs/cosmwasm-stargate Client for Stargate chains with the CosmWasm module enabled npm version
@cosmjs/crypto Cryptography for blockchain projects, e.g. hashing (SHA-2, Keccak256, Ripemd160), signing (secp256k1, ed25519), HD key derivation (BIP-39, SLIP-0010), KDFs and symmetric encryption for key storage (PBKDF2, Argon2, XChaCha20Poly1305) npm version
@cosmjs/encoding Encoding helpers for blockchain projects npm version
@cosmjs/math Safe integers; decimals for handling financial amounts npm version

Modularity

We're pretty proud of the modularity and a clean dependency tree in this monorepo. This ensures software quality on our side and lets users pick exactly what they need. Here you see how everything fits together (every item is a npm package; right depends on left):

CosmJS dependency tree

If this was not enough to scare you away, check out the version including app runtime dependencies: cosmjs-tree-full.png.

Supported JS environments

Currently the codebase supports the following runtime environments:

  1. Node.js 14+
  2. Modern browsers (Chromium/Firefox/Safari, no Internet Explorer or Edge Spartan)
  3. Browser extensions (Chromium/Firefox)

Our current JavaScript target standard is ES2020. We use WebAssembly to implement certain cryptographic functions.

We're happy to adjust this list according to users' needs as long as you don't ask for Internet Explorer support. If your environment does not support Wasm, we can work on a solution with swappable implementations.

Webpack Configs

With WebPack 5, you have to be explicit about the usage of Node.js types and modules that were simply replaced with re-implementations for browsers in Webpack 4.

Configs for 0.28 and later:

module.exports = [
  {
    // ...
    plugins: [
      ...,
      new webpack.ProvidePlugin({
        Buffer: ["buffer", "Buffer"],
      }),
    ],
    // ...
    resolve: {
      fallback: {
        buffer: false,
        crypto: false,
        events: false,
        path: false,
        stream: false,
        string_decoder: false,
      },
    },
  },
];

Configs for CosmJS < 0.28

module.exports = [
  {
    // ...
    plugins: [
      ...,
      new webpack.ProvidePlugin({
        Buffer: ["buffer", "Buffer"],
      }),
    ],
    // ...
    resolve: {
      fallback: {
        buffer: false,
        crypto: false,
        events: false,
        path: false,
        stream: require.resolve("stream-browserify"),
        string_decoder: false,
      },
    },
  },
];

Roadmap

We maintain a development board, use release milestones and share important updates in the CosmWasm Community Call. For higher level roadmap discussion please reach out to the team.

Known limitations

0.26

  1. When connecting to a Cosmos SDK 0.44+ backend, the verified queries from AuthExtension and BankExtension as well as StargateClient.getAccountVerified will fail because the storage keys are not stable. Unverified queries can be used instead. Those queries are deprecated now and will be removed in 0.27 (#910).

0.25

  1. Decoding blocks of height 1 is unsupported. This is fixed in #815 and will be released as part of CosmJS 0.26.

0.24

  1. AuthExtension and all higher level Stargate clients only support BaseAccounts for all functionality, including getting account numbers and sequences for transaction signing. This will be implemented for all common Cosmos SDK account types in the 0.25 series.

Get in touch

The CosmJS development team is happy to get in touch with you for all questions and suggestions.

Development

See HACKING.md.

More Repositories

1

cosmos-sdk

⛓️ A Framework for Building High Value Public Blockchains ✨
Go
5,983
star
2

cosmos

Internet of Blockchains ⚛
TeX
1,243
star
3

ibc

Interchain Standards (ICS) for the Cosmos network & interchain ecosystem.
TeX
846
star
4

ethermint-archive

Ethereum on Tendermint using Cosmos-SDK!
Go
661
star
5

gravity-bridge

A CosmosSDK application for moving assets on and off of EVM based, POW chains
TypeScript
490
star
6

sdk-tutorials

Tutorials for building modules for the Cosmos SDK
Go
479
star
7

chain-registry

Python
477
star
8

ibc-go

Inter-Blockchain Communication Protocol (IBC) implementation in Golang.
Go
474
star
9

awesome-cosmos

Collection of Cosmos related resources
457
star
10

gaia

Cosmos Hub
Go
420
star
11

iavl

Merkleized IAVL+ Tree implementation in Go
Go
409
star
12

ethermint

Ethermint is a scalable and interoperable Ethereum, built on Proof-of-Stake with fast-finality using the Cosmos SDK.
Go
402
star
13

relayer

An IBC relayer for ibc-go
Go
376
star
14

cosmos-rust

The home of all shared Rust resources for the Cosmos ecosystem.
Rust
280
star
15

ibc-rs

Rust implementation of the Inter-Blockchain Communication (IBC) protocol.
Rust
158
star
16

testnets

Cosmos Testnets
Shell
153
star
17

interchain-security

Replicated security (aka interchain security V1) is an open sourced IBC application which allows cosmos blockchains to lease their proof-of-stake security to one another.
Go
137
star
18

mainnet

It's happening!
Go
125
star
19

ics23

Building generic merkle proof format for IBC
JavaScript
102
star
20

gex

In-terminal explorer for Cosmos SDK blockchains.
Go
92
star
21

cosmos-multisig-ui

Create multisigs and multisig transactions on Cosmos chains
TypeScript
76
star
22

ibc-apps

IBC applications and middleware for Cosmos SDK chains.
Go
76
star
23

cosmos-academy

Content for Cosmos Academy
Go
67
star
24

stargate-launch

58
star
25

relayer-archive

An example of a server side IBC relayer to be used for Game of Zones and beyond
Go
56
star
26

scaffold

Scaffolding for Cosmos-SDK based application
Go
55
star
27

gogoproto

Protocol Buffers for Go with Gadgets for Cosmos
Go
52
star
28

game-of-stakes

Python
51
star
29

ledger-cosmos

C
49
star
30

modules

Go
45
star
31

ledger-cosmos-obsolete

Ledger Nano S support for Tendermint/Cosmos
C++
43
star
32

ibc-proto-rs

Rust crate for interacting with Cosmos and IBC structs.
Rust
42
star
33

governance

Resources for Cosmos governance
Shell
40
star
34

snap

Packages That Add Cosmos Support Into Metamask. The Cosmos is Expanding!
TypeScript
37
star
35

cosmos-proto

Go
36
star
36

amino-js

go-amino + GopherJS + TypeScript
Go
32
star
37

b9-checkers-academy-draft

TypeScript
32
star
38

cips

The Cosmos Improvements Proposals
JavaScript
25
star
39

atlas

An open source Cosmos SDK module registry.
Vue
25
star
40

faucet

Token faucet web app for the Cosmos Hub and Gaia testnets.
Vue
24
star
41

research

21
star
42

developer-portal

JavaScript
21
star
43

cosmos-sdk-js

(NOTICE: Very out of date) JavaScript client for the Cosmos SDK API
JavaScript
20
star
44

cosmos-db

Go
18
star
45

gosec

Go
17
star
46

burner-chains

Low-security temporary experimental application-specific blockchains
17
star
47

vuepress-theme-cosmos

This repository is deprecated and is not maintained. Please, use another system for documentation.
Vue
16
star
48

stargate

Stargate Roadmap Website
Vue
16
star
49

qa-integration

Python
15
star
50

ethermint_abci

DEPRECATED - moved to https://github.com/cosmos/ethermint
Go
14
star
51

vega-test

Shell
12
star
52

fundraiser-cli

CLI tool for participating in Cosmos Fundraiser
Go
12
star
53

v1.cosmos.network

DEPRECATED - The website for Cosmos - Internet of Blockchains
HTML
12
star
54

registry

11
star
55

cosmos-registrar

A tool for pulling data from cosmos networks and pushing it to git repos
Go
10
star
56

community

10
star
57

fundraiser-lib

JS module for participating in Cosmos Fundraiser
JavaScript
9
star
58

composer

TypeScript
9
star
59

ledger-cosmos-go

Go
8
star
60

groups-ui

TypeScript
7
star
61

security

Cosmos Security contains guidelines (and tools in the future) for a responsible security incident disclosure
7
star
62

interchain-security-gravity

Python
6
star
63

ibc-docs

5
star
64

chainparse

Go
5
star
65

iavl-bench

Go
5
star
66

faucet-backend

Faucet Backend
Go
5
star
67

advocates

Cosmos Advocates
5
star
68

images

Cosmos Docker Images
Shell
4
star
69

keystone

Go
4
star
70

rosetta

Rosetta implementation for cosmos zones
Go
4
star
71

cosmos-sdk-docs

HTML
4
star
72

academy-checkers-ui

TypeScript
4
star
73

.github

GitHub Actions, Workflows, and templates used across the Cosmos org.
4
star
74

vanity

HTML
4
star
75

fundraiser

Code for the fundraiser subdomain
Vue
3
star
76

did-cosmos

3
star
77

tools

Tools used in our various repos
Go
3
star
78

gravity-dex-site

Gravity DEX: The Cosmos Interchain Exchange
Vue
3
star
79

hackatom2021

HackAtom VI
Vue
3
star
80

cosmos-sdk-ics-fork

2
star
81

jobs

PHP
2
star
82

nightly-stack

2
star
83

gravity-bridge-site

Vue
1
star
84

temp-archive

1
star
85

conversations-site

CSS
1
star
86

hackatom2020

HackAtom V
Vue
1
star
87

wallet-registry

1
star
88

gogogateway

Go
1
star