Solidity SDK
Hyperbridge is built on a cross-chain interoperability protocol referred to as the Interoperable State Machine Protocol. This protocol implementation lives in the Hyperbridge Monorepo. But it's interfaces are outlined in the ismp-solidity repository.
Developers will mostly interact with these interfaces so it's a good idea to become more familiar witrh them. These interfaces provide EVM smart contracts with the necessary APIs to send and receive messages securely through the Hyperbridge. Let's dive into it's different components:
IIsmpHost
The IIsmpHost
interface, which implements a subset of the IsmpHost
, is the central core of the ISMP protocol. It is a stateful contract responsible for all protocol storage needs. It functions as a store for
- Consensus states
- State Commitments
- Request Commitments and Receipts
- Response Commitments and Receipts
Additionally, it implements the IsmpDispatcher
interface, providing methods for contracts to dispatch requests and responses to the Hyperbridge.
IHandler
The IHandler
serves as the entry point for all ISMP datagrams. It is a stateless contract responsible for handling consensus and state proof verifications for all ISMP messages. Upon successful verification, it delegates storage and dispatching to relevant IIsmpModules
to the IIsmpHost
contract.
This decoupled design of the Handler from the Host allows independent upgrades to verification mechanisms without impacting the core protocol, enabling future adoption of more efficient consensus and state verification methods with no changes to the protocol or dependent contracts.
IConsensusClient
The IConsensusClient
is a library for verifying Hyperbridge's consensus on EVM chains. This is only used by the IHandler
contract and is likely of no use to 3rd party developers.
IDispatcher
The IDispatcher
is the interface that will concern EVM developers the most. It is the interface through which cross-chain messages and state reads are dispatched.
It provides methods for dispatching POST requests, POST responses, and GET requests.
IIsmpModule
The IIsmpModule
interface defines the required APIs that contracts should provide in order to receive incoming messages. An abstract class BaseIsmpModule
is provided for convenience allowing developers only override methods that they care about.
StateMachine
The StateMachine
is a convenience library for identifying state machines that messages are addressed to or from. Hyperbridge supports all kinds of state machines including but not limited to
- EVM state machines
- Polkadot-SDK state machines
- Cosmos SDK state machines
In the next section we'll look into hands-on examples of how to send and receive messages using ISMP.
Versioning
The minimum version of the ismp-solidity
library is v0.8.17
. But since this library is mostly just interfaces, it can be forked and modified to support an even lower version for your solidity project if needed.