An Introduction to General Message Passing
![An Introduction to General Message Passing](/content/images/size/w1200/2023/09/Template--20-.png)
The blockchain sector, once home to only a handful of relevant protocols, is flourishing into a universe-sized ecosystem. This continued growth has made the need for interoperability solutions more urgent than ever. And when we say “interoperability solutions,” we’re not talking about the rudimentary bridges of the past.
We’re talking about an emerging class of interop solutions (sometimes called “arbitrary message bridges AMBs”) that leverage general message passing to offer something fundamentally new. Let’s unpack what this means.
General message passing, explained
General message passing (GMP) lets developers connect smart contracts from multiple chains in order to easily transfer tokens and arbitrary data. This feature is crucial for the entire web3 infrastructure, empowering devs to move both value and information beyond the borders of their native network. GMP stands to:
- Eliminate the need to deploy dApps separately
- Allow token and data transfers across multiple chains
- Expand cross-chain governance use cases
Overall, GMP allows for better data availability and composability, fundamentally changing the definition of “cross-chain communication.”
The use of generic data involves governance proposals, voting actions, and contract calls — all of which can be moved around by transferring calldata. Developers could even use GMP to build dApps that would let end users borrow on one chain with collateral from another or aggregate yield to farm on any chain without moving their funds.
How Sygma uses general message passing
Sygma, the any-to-any interoperability layer for building cross-chain apps, leverages GMP to give developers more options and simplify processes. Under the hood, Sygma’s use of GMP can be broken down into three key stages.
Stage one
The Sygma SDK prepares the deposit data to be used and transferred to the deposit method on the bridge. This data encompasses all of the encoding parameters required for employing the generic handler, including:
- the called deposit method’s function signature
- the function’s parameters
- the maximum fee allotted for the call
- the destination contract address to be called on the destination chain
- the depositor’s address
All these parameters are encoded in a PermissionlessGenericDepositData format, returning an encoded hex string that can then be passed to the generic handler. Best of all, this is a permissionless process. So you can use the Generic Handler without having to wait for us to integrate anything. This speeds up time to market for projects.
Stage two
Internally, the bridge contracts use the resource id to pass all relevant parameters to the active handler.
The deposit method receives a resource id from the bridge. This corresponds to the resource id mapped to the generic handler during deployment.
The bridge will collect the fee, then call the correct handler (in this case, the generic handler).
Stage three
Upon a successful bridge deposit, relayers will receive the deposit event and forward the data to the developer’s chosen destination chain. The same principle applies when relaying ERC-20 or ERC-721 tokens to the destination chain. A proposal is executed, and the contract is called with the forwarded data.
General message passing, looking forward
As cross-chain solutions that employ GMP continue to gain traction, we will witness the true vision of blockchain interoperability begin to materialize. Rather than patchwork deployments, and limited functionality, developers will be able to tap existing infrastructure and move toward a simplified, expansive, network-agnostic user experiences.
Stay tuned: we’re working on a repository of examples and tutorials that will illustrate GMP use cases in action that can then be easily adopted by developers per their needs.
Introducing the Sygma Builders Program🛠
We’ve recently initiated a builders program for any developers interested in native EVM-Substrate cross-chain connectivity. The program features engineering support and cash incentives — learn more here!
Community👥
Sygma connects you with the chains you want, making it possible to compose applications that work across EVM, Substrate, and Cosmos.
The strength of our project lies in our builder community. We're always looking for contributors, and Sygma’s modular architecture is designed to foster contributions and extensions.
Check out our documentation or GitHub to get started.
Have a question? Hop into our Discord 👋