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

Overview

ibc-rs

Cosmos ecosystem

Docs Build Status Apache 2.0 Licensed Rust Stable Rust 1.60+

Rust implementation of the Inter-Blockchain Communication (IBC) protocol. This project hosts the ibc rust crate which defines the main data structures and on-chain logic for the IBC protocol.

See the ibc crate's README.md for more detailed information on the ibc crate.

Contributing

IBC is specified in English in the cosmos/ibc repo. Any protocol changes or clarifications should be contributed there.

This repo contains the Rust implementation for the IBC modules. If you're interested in contributing, please comment on an issue or open a new one!

See also CONTRIBUTING.md.

Versioning

We follow Semantic Versioning, though APIs are still under active development.

Resources

License

Copyright © 2022 Informal Systems Inc. and ibc-rs authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use the files in this repository except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Comments
  • Tracking issue for verification functions of TendermintClient

    Tracking issue for verification functions of TendermintClient

    Crate

    IBC

    Summary of Bug

    Almost all verification functions in ibc::ics07_tendermint::client_def::TendermintClient are not implemented.

    Version

    0.6.0

    Steps to Reproduce

    Call verification functions such as ibc::ics03_connection::handler::verify::verify_proofs with a TendermintClient

    Acceptance Criteria

    All verification functions are implemented

    • [x] informalsystems/ibc-rs-tmp#71
    • [ ] verify_client_consensus_state
    • [ ] verify_connection_state
    • [ ] verify_channel_state
    • [ ] verify_client_full_state

    For Admin Use

    • [X] Not duplicate issue
    • [x] Appropriate labels applied
    • [x] Appropriate milestone (priority) applied
    • [ ] Appropriate contributors tagged
    • [ ] Contributor assigned/self-assigned
    opened by yito88 10
  • ADR for redesigning the modules' API

    ADR for redesigning the modules' API

    Summary

    Create an ADR for redesigning the modules' API in a way that is more robust and usable for our customers.

    Requirements

    • async - The API must be usable in an async context.
    • Usability - The API must be usable with a variety of execution models and must avoid making assumptions about the host blockchain env.
    • Composability - The API must be flexible and extensible by its users. It should additionally provide building blocks that are composable.

    For Admin Use

    • [ ] Not duplicate issue
    • [ ] Appropriate labels applied
    • [ ] Appropriate milestone (priority) applied
    • [ ] Appropriate contributors tagged
    • [ ] Contributor assigned/self-assigned
    O: ADR05 
    opened by hu55a1n1 10
  • Client update based on Beefy protocol

    Client update based on Beefy protocol

    In Beefy protocol, there's one data structure, MMR root, "one level higher" than block header. The MMR root of chainA is generated and broadcasted once every N new blocks are generated. After ChainA's light client on ChainB receives a tx containing a new MMR root, it will verify the MMR root, and then verify any of the N headers based on the verified MMR root asynchronously.

    From the architectural perspective, is it a good idea to do the 2 asynchronous verifications in the existing function check_header_and_update_state?

    Kindly reply if any comments. thank you.

    opened by livelybug 9
  • How to write acknowledgement (commitments) in the IBC module?

    How to write acknowledgement (commitments) in the IBC module?

    Hello,

    I have a question about the usage of the function Writing acknowledgments.

    In the life cycle of a packet, there's a functionWriting acknowledgements.

    After reading the PR about it, no suggestion on the integration was found.

    Is there any suggested place to call the function Writing acknowledgments? How about ibc-rs provides an option to call the function after this line?

    Or it's suggested to call the function on the IBC app?

    Thank you

    opened by livelybug 9
  • Use abci-tag proc_macro for event attributes

    Use abci-tag proc_macro for event attributes

    Closes: #214

    Description

    This is my implementation of the abci_tag proco marco implementation of the feeling that there is still a toy Everyone see what other improvements, this implementation is to solve the problems raised in this issue.


    PR author checklist:

    • [ ] Added changelog entry, using unclog.
    • [ ] Added tests.
    • [ ] Linked to GitHub issue.
    • [ ] Updated code comments and documentation (e.g., docs/).
    • [ ] Tagged one reviewer who will be the one responsible for shepherding this PR.

    Reviewer checklist:

    • [ ] Reviewed Files changed in the GitHub PR explorer.
    • [ ] Manually tested (in case integration/unit/mock tests are absent).
    opened by DaviRain-Su 7
  • Add codec borsh feature

    Add codec borsh feature

    Closes: #259

    Description


    PR author checklist:

    • [ ] Added changelog entry, using unclog.
    • [ ] Added tests.
    • [ ] Linked to GitHub issue.
    • [ ] Updated code comments and documentation (e.g., docs/).
    • [ ] Tagged one reviewer who will be the one responsible for shepherding this PR.

    Reviewer checklist:

    • [ ] Reviewed Files changed in the GitHub PR explorer.
    • [ ] Manually tested (in case integration/unit/mock tests are absent).
    opened by DaviRain-Su 7
  • Add serialization and deserialization features for codec and borsh to the host type in ics24

    Add serialization and deserialization features for codec and borsh to the host type in ics24

    Summary

    ## this for codec 
    codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
    scale-info = { version = "2.1.2", default-features = false, features = ["derive"] }
    sp-runtime = {  version = "7.0.0", default-features = false }
    ## this for borsh
    borsh = {version = "0.9.3", default-features = false }
    

    example case ClientId:

    use serde::{Deserialize, Serialize};
    
    use codec::{Decode, Encode};
    use scale_info::TypeInfo;
    use sp_runtime::RuntimeDebug;
    use borsh::{BorshSerialize, BorshDeserialize};
    
    
    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
    pub struct ClientId(pub String);
    
    #[cfg(feature = "codec")]
    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, Encode, Decode, RuntimeDebug, TypeInfo)]
    pub struct ClientId(pub String);
    
    #[cfg(feature = "borsh")]
    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, BorshSerialize, BorshDeserialize)]
    pub struct ClientId(pub String);
    

    Problem Definition

    Proposal

    Acceptance Criteria


    For Admin Use

    • [ ] Not duplicate issue
    • [ ] Appropriate labels applied
    • [ ] Appropriate milestone (priority) applied
    • [ ] Appropriate contributors tagged
    • [ ] Contributor assigned/self-assigned
    opened by DaviRain-Su 7
  • Refactor error system

    Refactor error system

    Closes: #164

    Description


    PR author checklist:

    • [ ] Added changelog entry, using unclog.
    • [ ] Added tests.
    • [ ] Linked to GitHub issue.
    • [ ] Updated code comments and documentation (e.g., docs/).
    • [ ] Tagged one reviewer who will be the one responsible for shepherding this PR.

    Reviewer checklist:

    • [ ] Reviewed Files changed in the GitHub PR explorer.
    • [ ] Manually tested (in case integration/unit/mock tests are absent).
    opened by DaviRain-Su 7
  • Introduce `(PortId, ChannelId)` domain type

    Introduce `(PortId, ChannelId)` domain type

    Crate

    ibc

    Summary

    Since we started working on ICS04 handlers(https://github.com/informalsystems/ibc-rs/pull/452) we noticed that there is a recurring need to encapsulate the tuple (PortId, ChannelId) as a type. This tuple is needed in error types:

    https://github.com/informalsystems/ibc-rs/blob/d6250014e8d8fcddde651f9e3ceb6be5c93cbeae/modules/src/application/ics20_fungible_token_transfer/error.rs#L19-L20

    or as parameters to structures:

    https://github.com/informalsystems/ibc-rs/blob/71d9baa6a2eed5a9286f9fe88f1cfacbd51e19d8/modules/src/mock/context.rs#L86-L86

    or as parameters to methods:

    https://github.com/informalsystems/ibc-rs/blob/71d9baa6a2eed5a9286f9fe88f1cfacbd51e19d8/modules/src/mock/context.rs#L279-L282

    So there's ample reasons to introduce a new type for capturing the two.

    Proposal

    The new type should probably reside in ICS04. Potential names:

    pub struct PortChannel(PortId, ChannelId);
    pub struct BoundChannel(PortId, ChannelId);
    pub struct AuthorizedChannel(PortId, ChannelId);
    

    For Admin Use

    • [X] Not duplicate issue
    • [x] Appropriate labels applied
    • [x] Appropriate milestone (priority) applied
    • [ ] Appropriate contributors tagged
    • [ ] Contributor assigned/self-assigned
    A: good first issue 
    opened by adizere 7
  • tendermint-rs should expose traits for crypto operations

    tendermint-rs should expose traits for crypto operations

    Problem Definition

    In order for this library to be used in smart contract and blockchain environments, as i believe is the intention, crypto (sign, hash, verify) operations should be instead delegated to trait implementations. Reason is crypto operations are very expensive and slow in wasm. And for this reason the substrate runtime exposes host functions for hashing:

    https://github.com/paritytech/substrate/blob/9461b2de04210c6c193726a745c3ec6552b4ce9f/primitives/io/src/lib.rs#L993-L1033

    as well as signature verification and digital signature schemes:

    https://github.com/paritytech/substrate/blob/9461b2de04210c6c193726a745c3ec6552b4ce9f/primitives/io/src/lib.rs#L616-L989

    Using a trait will allow delegating these operations to pre-compiles (aka host functions)

    cc @adizere

    opened by seunlanlege 6
  • Should Ics20Context implement Module?

    Should Ics20Context implement Module?

    Summary

    Should Ics20Context implement Module so ChannelKeeper and ChannelReader don't need to be implemented?

    Problem Definition

    The current ICS20 logic looks a bit like a standalone IBC module, which means it doesn't interop nicely with the Module system proposed by ICS26. It also leads to a lot of extra boilerplate code due to having to implement ChannelKeeper and ChannelReader that could be delegated to a routing module that implements ICS26.

    Proposal

    Have Ics20Context implement Module, and update the interface of Ics20Context so only the BankKeeper and Ics20Reader functions need to be implemented.

    Acceptance Criteria

    The changes proposed are made to Ics20Context and the other related traits.


    For Admin Use

    • [ ] Not duplicate issue
    • [ ] Appropriate labels applied
    • [ ] Appropriate milestone (priority) applied
    • [ ] Appropriate contributors tagged
    • [ ] Contributor assigned/self-assigned
    opened by kevinji 5
  • Refactor unreachable test of `conn_open_ack` handler

    Refactor unreachable test of `conn_open_ack` handler

    Closes: #33


    PR author checklist:

    • [X] Added changelog entry, using unclog.
    • [ ] Added tests.
    • [X] Linked to GitHub issue.
    • [ ] Updated code comments and documentation (e.g., docs/).
    • [ ] Tagged one reviewer who will be the one responsible for shepherding this PR.

    Reviewer checklist:

    • [ ] Reviewed Files changed in the GitHub PR explorer.
    • [ ] Manually tested (in case integration/unit/mock tests are absent).
    opened by Farhad-Shabani 2
  • Add serde feature

    Add serde feature

    Closes: https://github.com/cosmos/ibc-rs/issues/293

    Description

    This PR builds on top of @DaviRain-Su's PR #301 - I was unable to push on their fork so opened this PR.


    PR author checklist:

    • [ ] Added changelog entry, using unclog.
    • [ ] Added tests.
    • [ ] Linked to GitHub issue.
    • [ ] Updated code comments and documentation (e.g., docs/).
    • [ ] Tagged one reviewer who will be the one responsible for shepherding this PR.

    Reviewer checklist:

    • [ ] Reviewed Files changed in the GitHub PR explorer.
    • [ ] Manually tested (in case integration/unit/mock tests are absent).
    opened by hu55a1n1 2
  • Remove `mocks-no-std` feature

    Remove `mocks-no-std` feature

    Supersedes: #318 Blocked on: https://github.com/informalsystems/tendermint-rs/issues/1258

    We should have the mocks feature not require std since there's no fundamental reason why it should. This involves:

    1. Don't use Timestamp::now() which reads time from the OS; implement logic to advance time everytime a "mock now()" is called instead.
    2. Use the no_std version of tendermint-testgen when available
    A: good first issue A: blocked E: no-std 
    opened by plafer 0
  • Make Msg* structs pub(crate)

    Make Msg* structs pub(crate)

    Closes: #324

    Description


    PR author checklist:

    • [ ] Added changelog entry, using unclog.
    • [ ] Added tests.
    • [ ] Linked to GitHub issue.
    • [ ] Updated code comments and documentation (e.g., docs/).
    • [ ] Tagged one reviewer who will be the one responsible for shepherding this PR.

    Reviewer checklist:

    • [ ] Reviewed Files changed in the GitHub PR explorer.
    • [ ] Manually tested (in case integration/unit/mock tests are absent).
    opened by DaviRain-Su 2
  • Exclude `ChannelEnd` from `MsgChannelOpenInit` and `MsgChannelOpenTry`

    Exclude `ChannelEnd` from `MsgChannelOpenInit` and `MsgChannelOpenTry`

    Closes: #20

    Side effect

    Bringing ChannelEnd fields along with including proofs inside the struct of messages, adds #allow(clippy::too_many_arguments)] for MsgChannelOpenTry


    PR author checklist:

    • [X] Added changelog entry, using unclog.
    • [ ] Added tests.
    • [X] Linked to GitHub issue.
    • [ ] Updated code comments and documentation (e.g., docs/).
    • [X] Tagged one reviewer who will be the one responsible for shepherding this PR.

    Reviewer checklist:

    • [ ] Reviewed Files changed in the GitHub PR explorer.
    • [ ] Manually tested (in case integration/unit/mock tests are absent).
    A: breaking 
    opened by Farhad-Shabani 1
  • Refactor `ValidationContext` and `ExecutionContext`

    Refactor `ValidationContext` and `ExecutionContext`

    Comes out of a comment by @Farhad-Shabani and ensuing sync discussion. We still need to figure out the details, but a main point of confusion was that validate() was in the Context trait; it's not clear from a first look that all the methods in the Context are used in the validate() function. We can also think of different ways to separate the methods into a few different traits if that helps with readability, and doesn't duplicate methods.

    Blocked on #221.

    Below is the original comment:

    Originally posted by @Farhad-Shabani in https://github.com/cosmos/ibc-rs/issues/221#issuecomment-1371403478

    Is it right that we have a tailored validation and execution function for each of the messages like MsgCreateClient, MsgUpdateClient, etc.? Couldn’t we use the following pattern (as a general concept) and implement them on each message type?

    impl validator<Ctx: RouterContext> {
    	pub fn validate(&self, ctx: &mut Ctx) -> Result<(), Error>;
    }
    
    impl executor<Ctx: RouterContext> {
    	pub fn execute(&self, ctx: &mut Ctx) -> Result<(), Error>;
    }
    
    // consider it for MsgCreateClient 
    impl validator<MockContext> for MsgCreateClient {...}
    impl executor<MockContext> for MsgCreateClient {...}
    

    It looks more modular, maintainable, and extensible if it works! (please direct me to the places if I am missing something. tnx)

    A: blocked O: ADR05 
    opened by plafer 0
Releases(v0.25.0)
  • v0.25.0(Dec 14, 2022)

    This release updates the tendermint-rs dependency to v0.28.0 which includes important security improvements. Many other improvements have been made as well, including misbehaviour handling.

    A lot of work has also been put towards implementing ADR 5, which is currently unfinished and has been put behind the feature flag val_exec_ctx.

    The only consensus-breaking changes are the ones related to the fact that we now properly handle misbehaviour messages.

    📖CHANGELOG

    Source code(tar.gz)
    Source code(zip)
  • v0.24.0(Dec 8, 2022)

  • v0.23.0(Nov 22, 2022)

  • v0.22.0(Nov 9, 2022)

    This release includes major improvements in making the library compatible with ibc-go v5.0.1. This includes making ibc events compatible and removing the crossing-hellos logic from the connection and channel handshakes.

    There are consensus-breaking changes in the connection and channel handshakes. However, there are no consensus-breaking changes for already established channels.

    📖 CHANGELOG

    Source code(tar.gz)
    Source code(zip)
  • v0.21.1(Oct 27, 2022)

  • v0.21.0(Oct 25, 2022)

  • v0.20.0(Oct 19, 2022)

Owner
COSMOS
The Internet of Blockchains
COSMOS
IBC modules and relayer - Formal specifications and Rust implementation

ibc-rs Rust implementation of the Inter-Blockchain Communication (IBC) protocol. This project comprises primarily four crates: The ibc crate defines t

Informal Systems 296 Dec 31, 2022
CosmWasm/Sylvia counting contract w/ IBC enabled (Cosmos, Rust, CosmWasm, Sylvia)

CosmWasm/Sylvia counting contract w/ IBC enabled (Cosmos, Rust, CosmWasm, Sylvia) This repository contains counting contract created during the study

Alex Cryp 3 Nov 13, 2023
An example CosmWasm contract for connecting contracts over IBC.

CosmWasm IBC Example This is a simple IBC enabled CosmWasm smart contract. It expects to be deployed on two chains and, when prompted, will send messa

ekez 64 Jun 21, 2023
Kryptokrona SDK in Rust for building decentralized private communication and payment systems.

Kryptokrona Rust SDK Kryptokrona is a decentralized blockchain from the Nordic based on CryptoNote, which forms the basis for Monero, among others. Cr

null 5 May 25, 2023
NAT Traversal techniques for p2p communication

P2P NAT-Traversal Crate Documentation Linux/OSX/Windows The goal of this crate is to provide a robust and crypto-secure NAT traversal for peer to peer

Spandan Sharma 123 Dec 24, 2022
The Zenotta Network Protocol (ZNP), the network that supports the Zenotta blockchain

Zenotta Network Protocol A repo for the development of the Zenotta Network Protocol (ZNP). We will regularly be updating links and easter eggs inside

Zenotta AG 10 Apr 2, 2023
This monorepository contains the source code for the smart contracts implementing bAsset Protocol on the Terra blockchain.

Crll bAsset Contracts This monorepository contains the source code for the smart contracts implementing bAsset Protocol on the Terra blockchain. You c

null 3 Mar 29, 2024
Rust implementation of Namada, a sovereign proof-of-stake blockchain that enables asset-agnostic private transfers

Namada Overview Namada is a sovereign proof-of-stake blockchain, using Tendermint BFT consensus, that enables multi-asset private transfers for any na

anoma 144 Jan 2, 2023
Node implementation for aleph blockchain built with Substrate framework

This repository contains the Rust implementation of Aleph Zero blockchain node based on the Substrate framework. Aleph Zero is an open-source layer 1

Aleph Zero Foundation 55 Dec 15, 2022
Official Rust implementation of the Nimiq protocol

Nimiq Core implementation in Rust (core-rs) Rust implementation of the Nimiq Blockchain Core Nimiq is a frictionless payment protocol for the web. Thi

Nimiq 72 Sep 23, 2022
Rust implementation of Zcash protocol

The Parity Zcash client. Gitter Blog: Parity teams up with Zcash Foundation for Parity Zcash client Installing from source Installing the snap Running

Parity Technologies 183 Sep 8, 2022
A prototype implementation of the Host Identity Protocol v2 for bare-metal systems, written in pure-rust.

Host Identity Protocol for bare-metal systems, using Rust I've been evaluating TLS replacements in constrained environments for a while now. Embedded

null 31 Dec 12, 2022
A Rust implementation of the Message Layer Security group messaging protocol

Molasses An extremely early implementation of the Message Layer Security group messaging protocol. This repo is based on draft 4 of the MLS protocol s

Trail of Bits 109 Dec 13, 2022
Ecoball Node is the Official Rust implementation of the Ecoball protocol.

Ecoball Node is the Official Rust implementation of the Ecoball protocol. It is a fork of OpenEthereum - https://github.com/openethereum/

Ecoball Chain 2 Jun 9, 2022
A rust implementation of the ABCI protocol for tendermint core

?? DEPRECATED ?? This repo has been deprecated. Development work continues as the "abci" crate of informalsystems/tendermint-rs. Please reference that

Tendermint 117 Dec 12, 2022
Open source Rust implementation of the Witnet decentralized oracle protocol, including full node and wallet backend 👁️🦀

witnet-rust is an open source implementation of the Witnet Decentralized Oracle Network protocol written in Rust. Components witnet-rust implements ma

The Witnet Project 155 Nov 21, 2022
The Rust implementation of Conflux protocol.

Conflux-Rust Conflux-rust is a Rust-based implementation of the Conflux protocol. It is fast and reliable. Please follow the Conflux Documentation to

Conflux 562 Jan 7, 2023
In addition to encryption library, pure RUST implementation of SSH-2.0 client protocol

In addition to encryption library, pure RUST implementation of SSH-2.0 client protocol

陈年旧事。 73 Jan 1, 2023
Next-generation implementation of Ethereum protocol ("client") written in Rust, based on Erigon architecture.

?? Martinez ?? Next-generation implementation of Ethereum protocol ("client") written in Rust, based on Erigon architecture. Why run Martinez? Look at

Arthur·Thomas 23 Jul 3, 2022