A template for creating Decentralized Verifier Network (DVN) Blueprints for LayerZero V2 on Tangle
This project provides a template for creating Layerzero Decentralized Verifier Network (DVN) Blueprints on the Tangle Network. DVNs are an essential component of the LayerZero protocol, responsible for verifying cross-chain messages and ensuring the security and reliability of inter-blockchain communications.
Blueprints in Tangle are specifications for Actively Validated Services (AVS) that run arbitrary computations for a user-specified period of time. This template allows developers to create reusable DVN infrastructures, enabling them to participate in the LayerZero ecosystem and potentially monetize their work.
Before you can run this project, you will need to have the following software installed on your machine:
You will also need to install cargo-tangle
, our CLI tool for creating and deploying Tangle Blueprints:
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/tangle-network/gadget/releases/download/cargo-tangle-v0.1.2/cargo-tangle-installer.sh | sh
Or, if you prefer to install the CLI from crates.io:
cargo install cargo-tangle --force # to get the latest version
- Create a new project using the DVN blueprint template:
cargo tangle blueprint create --name my-dvn-blueprint --repo https://github.com/tangle-network/layerzero-dvn-blueprint-template
- Navigate to your project directory:
cd my-dvn-blueprint
-
Implement your offchain DVN logic in
src/lib.rs
and onchain DVN incontracts/src/
, building upon the provided template functions. -
Build your project:
cargo build
- Deploy your DVN blueprint to the Tangle network:
cargo tangle blueprint deploy
The DVN has one off-chain workflow:
- The DVN first listens for the
PacketSent
event: - After the
PacketSent
event, theDVNFeePaid
is how you know your DVN has been assigned to verify the packet'spayloadHash
. - After receiving the fee, your DVN should query the address of the
MessageLib
on the destination chain: - After your DVN has retrieved the receive
MessageLib
, you should read theMessageLib
configuration from it. In the configuration is the required block confirmations to wait before calling verify on the destination chain. - Your DVN should next do an idempotency check:
- If the state is
true
, then your idempotency check indicates that you already verified this packet. You can terminate your DVN workflow. - If the state is
false
, then you must callULN.verify
:
- If the state is
If you have any feedback or issues, please feel free to open an issue on our GitHub repository.
This project is licensed under the MIT License. See the LICENSE file for more details.