Skip to content

Repository files navigation

Dart Cosmos SDK

A comprehensive Dart library for interacting with Cosmos SDK and Cosmos EVM networks. Create, sign, encode, decode, and broadcast transactions using RPC, REST, or gRPC with support for multiple cryptographic algorithms and Protocol Buffers.


⚠️ Breaking Changes (v4.0.0)

Version 4.0.0 introduces a major change to protobuf code generation.

  • All protobuf messages are now generated by the onchain_proto package.
  • Generated class names may have changed.
  • Generated file locations have changed.
  • Existing import paths will likely need to be updated.

Features

  • ✅ Cosmos SDK transaction builder
  • ✅ Direct, Amino, and Protobuf transaction signing
  • ✅ RPC, REST, and gRPC clients
  • ✅ Protobuf, JSON, Amino, and binary encoding/decoding
  • ✅ Dynamic message decoding using typeUrl
  • ✅ Pre-generated protobuf models for popular Cosmos chains
  • ✅ Generate Dart models from any Cosmos SDK protobuf repository

Supported Protocol Buffer Packages

The package includes pre-generated protobuf models for the following ecosystems:

  • cosmos.*
  • ibc.*
  • tendermint.*
  • chain4energy.*
  • circle.*
  • cosmwasm.*
  • ethermint.*
  • evmos.*
  • initia.*
  • injective.*
  • opinit.*
  • osmosis.*
  • secret.*
  • stratos.*
  • stride.*
  • thorchain.*

Generating Protobuf Models

Need support for a Cosmos SDK chain that isn't included?

  1. Download the chain's .proto files.
  2. Copy them into the project's proto/ directory.
  3. Run:
dart run proto/builder.dart

The generated Dart files will be placed under proto_messages/, preserving the original protobuf package structure.

Example imports:

import 'package:cosmos_sdk/proto_messages/cosmos/bank/v1beta1/models.dart';
import 'package:cosmos_sdk/proto_messages/cosmos/base/node/v1beta1/src/query.dart';
import 'package:cosmos_sdk/proto_messages/cosmos/base/v1beta1/src/coin.dart';

Note

The complete set of generated protobuf models exceeds 20 MB, so only import the packages your application actually uses.


CosmosMessageRegistry

CosmosMessageRegistry maps protobuf message types to their corresponding typeUrl.

It enables decoding Cosmos messages from:

  • Protobuf binary
  • JSON
  • Amino JSON

This is useful when working with google.protobuf.Any or dynamically decoding transaction messages when the concrete type is not known in advance.

Note: Referencing CosmosMessageRegistry causes all registered message types to be retained in your application, which increases the final binary size. If you don't need dynamic message decoding, avoid using this class and decode message types directly instead.


Supported Cryptography

  • Secp256k1
  • Ethereum-style Secp256k1 (used by Cosmos EVM chains such as Injective, XRPL EVM, etc.)
  • Secp256r1
  • Ed25519

Examples

Transactions

Create, sign, and broadcast:

  • Direct (Protobuf) transactions
  • Amino transactions

See the transaction examples: example

Providers

The library supports:

  • RPC
  • REST
  • gRPC

See the provider documentation: example


Contributing

Contributions are welcome!

  1. Fork the repository.
  2. Create a feature branch.
  3. Make your changes.
  4. Ensure all tests pass.
  5. Open a pull request with a clear description of your changes.

Issues & Feature Requests

Found a bug or have an idea for a new feature?

Please open an issue in the GitHub issue tracker.

About

Experience effortless interaction with a Cosmos SDK-based network in Dart, facilitating the seamless creation, signing, and transmission of transactions. (Beta version)

Topics

Resources

Stars

11 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages