.Solutions.Developers.Network.Ecosystem.Security.Next.Blog
.Home.Solutions.Network.Developers.Ecosystem.Security.Next.Blog
.Stats.Explorer.Bug Bounty.xGrants.Community.Careers.Brand & Press

.Talk to an Expert


2022 Ⓒ Wormhole. All Rights Reserved.

xDev easier.

Wormhole provides you with the tools and primitives for xChain use cases ranging from simple messaging to xApps .

.Get started.Speak to an Expert

Common use cases.

xAssets

xChain Tokens and NFTs are path-independent and fungible.

xApps

Developers from multiple ecosystems can build apps that access more users and liquidity from other chains.

xData

Break data silos to offer high performance, low-cost access to data from other chains and applications.

.Explore

One integration for a heterogeneous set of chains.

Leading protocols are building on Wormhole.

Wormhole Core

Explore integration scenarios.

Token Bridge

Leverage xChain fungible assets, powered by Wormhole.

xChain messages as easily as calling a contract.

Explore our messaging docs:

1//SPDX-License-Identifier: MIT
2pragma solidity ^0.8.0;
3
4import "./Wormhole/IWormhole.sol";
5
6contract Messenger {
7    address private wormhole_core_bridge_address = address(0xC89Ce4735882C9F0f0FE26686c53074E09B0D550);
8    IWormhole core_bridge = IWormhole(wormhole_core_bridge_address);
9
10    function sendMsg(bytes memory str) public returns (uint64 sequence) {
11    //Publish Msg takes uint32 nonce, bytes payload, uint8 consistency level
12    sequence = core_bridge.publishMessage(nonce, str, 1);
13    nonce = nonce+1;
14  }
15}

1struct WormholeMsg {
2  uint8 version;
3  uint32 timestamp;
4  uint32 nonce;
5  uint16 emitterChainId;
6  bytes32 emitterAddress;
7  uint64 sequence;
8  uint8 consistencyLevel;
9  bytes payload;
10
11  uint32 guardianSetIndex;
12  Signature[] signatures;
13
14  bytes32 hash;
15}

1function receiveWormholeMsg(bytes memory encodedMsg) public {
2  (IWormhole.VM memory vm, bool valid, string memory reason) = core_bridge.parseAndVerifyVM(encodedMsg);
3  
4  //1. Check Wormhole Guardian Signatures
5  require(valid, reason);
6
7  //2. Check if the Emitter Chain contract is registered
8  require(_applicationContracts[vm.emitterChainId] == vm.emitterAddress, "Invalid Emitter Address!");
9
10  //3. Check that the message hasn't already been processed
11  require(!_completedMessages[vm.hash], "Message already processed");
12  _completedMessages[vm.hash] = true;
13
14  //Do the thing
15  mymsg = string(vm.payload);
16}

Start your xBuild. Talk to our devs.

Wormhole provides you with the tools and primitives to start building.

.Join Discord
Terms of Use Privacy Policy

2022 Ⓒ Wormhole. All Rights Reserved.