▫️Introduction
Last updated
Last updated
The easiest experience for creating WebGchain apps (WebGApps) is provided by WebGlide.
Building a WebGApp requires only two straightforward steps:
Implement Receive
in the destination chain contract. This is the function that receives the payload you pass across chains.
Call call
on the origin chain, passing in your payload and relayer fees.
Review the Transaction Lifecycle for a moment. The terms "fast path" and "slow path" (authenticated) transfers are introduced here. Any cross-chain project has to grasp the distinction. Then test it out using our instructions to authentication.
This quickstart will show you how to move money and data between chains using the cross-chain communication primitive known as WebGcall
.
We will construct a cross-chain Greeter in this tutorial. The updateGreeting
function of the DestinationGreeter
contract on the destination chain modifies a greeting variable that is saved. For updateGreeting
, the SourceGreeter
contract on the origin chain utilises WebGcall to provide calldata
that has been encoded.
The update shows how to combine an asset transfer with any call in a single WebGcall
.Payment is necessary for the greeting feature to update the greeting. In this case, any sum larger than zero is acceptable according to the contract.
There are no security checks to ascertain who is calling the function because updateGreeting
is implemented as an unauthenticated call. As a result, this kind of WebGcall
will follow the "Fast Path".
Our app-starter
package is compatible with Hardhat and Foundry and comes with a complete example of this quickstart (plus more) if you'd rather fork a repo than follow this step-by-step tutorial.