Protokoły komunikatów
LayerZero, CCIP
Protokoły komunikatów to bezpłatna lekcja Web3 & DApp Development Fundamentals na CoddyKit. To lekcja 4 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej Web3 & DApp Development Fundamentals, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs Web3 & DApp Development Fundamentals zawiera 4 lekcji w sumie.
Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.
Beyond Token Bridges
Moving tokens is just the start. Cross-chain messaging protocols let contracts on one chain send arbitrary data and trigger functions on another.
This generalizes bridging into full cross-chain application logic.
What Is a Messaging Protocol?
A messaging protocol is infrastructure that delivers a payload from a source-chain contract to a destination-chain contract, with some security guarantee about authenticity.
Developers build on top of it instead of operating their own validators.
Generic Message Passing
With generic message passing (GMP), you can send any encoded data — not just token amounts.
A single message can instruct a destination contract to mint, vote, update state, or call any function.
sendMessage(
destChainId,
destContract,
abi.encode("setReward", 500)
);LayerZero
LayerZero is a messaging protocol that uses two independent parties: an Oracle (delivers block headers) and a Relayer (delivers proofs).
A message is valid only if both agree, so security relies on these two being independent and not colluding.
LayerZero Endpoints
Apps integrate via on-chain endpoints. A contract calls send on its source endpoint and implements lzReceive to handle incoming messages.
function lzReceive(
uint16 srcChain,
bytes srcAddress,
uint64 nonce,
bytes payload
) external {
// handle the cross-chain message
}Chainlink CCIP
CCIP (Cross-Chain Interoperability Protocol) from Chainlink uses its decentralized oracle network to relay messages and tokens.
It adds a separate Risk Management Network that independently monitors for anomalies and can pause transfers.
CCIP Messages
CCIP messages can carry data, tokens, or both. Developers send an EVM2AnyMessage and pay fees in LINK or the native gas token.
Client.EVM2AnyMessage message =
Client.EVM2AnyMessage({
receiver: abi.encode(dest),
data: payload,
tokenAmounts: tokens,
feeToken: linkAddress
});Security Through Independence
Both LayerZero and CCIP aim to remove single points of failure by separating roles (oracle vs relayer, or DON vs risk network).
The security argument is that compromising the system requires colluding across independent components.
Idempotency and Replay Protection
Receiving contracts must guard against duplicate delivery. Messages carry a nonce so handlers can ensure each is processed exactly once.
This is the same replay-protection principle bridges need.
require(!seen[srcChain][nonce], "dup");
seen[srcChain][nonce] = true;Use Cases
Generic messaging enables powerful patterns:
- Cross-chain governance — vote on one chain, execute on another
- Omnichain tokens — one token usable everywhere
- Cross-chain DeFi — borrow on A, use on B
Putting It Together
Messaging protocols like LayerZero and CCIP deliver arbitrary cross-chain messages, enabling omnichain applications. They reduce trust by separating independent roles and require replay protection in receiving contracts.
This completes your cross-chain journey.
Quick Check
Test your messaging protocol knowledge.
Recap: Messaging Protocols
You learned that:
- Messaging protocols deliver arbitrary cross-chain data, not just tokens
- LayerZero uses independent oracle + relayer; apps implement
lzReceive - Chainlink CCIP uses a DON plus a risk-management network
- Receivers need nonce-based replay protection
- They enable omnichain governance, tokens, and DeFi
Course complete!
Często zadawane pytania
Czy lekcja „Protokoły komunikatów” jest bezpłatna?
Tak — pełny tekst „Protokoły komunikatów” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu Web3 & DApp Development Fundamentals, przejdź na CoddyKit PRO. Kurs Web3 & DApp Development Fundamentals zawiera 4 lekcji w sumie.
Co nauczysz się w „Protokoły komunikatów”?
LayerZero, CCIP Ćwiczysz Web3 & DApp Development Fundamentals z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.
Czy potrzebuję doświadczenia, aby zacząć Web3 & DApp Development Fundamentals?
Nie wymagamy żadnego doświadczenia. Web3 & DApp Development Fundamentals w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 4 z 4.
Ile czasu zajmuje lekcja „Protokoły komunikatów”?
Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.
Czy mogę pisać i uruchamiać kod w tej lekcji Web3 & DApp Development Fundamentals?
Tak. Każda lekcja Web3 & DApp Development Fundamentals zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.
Wszystkie lekcje w tym kursie
- Koncepcje cross-chain
- Architektury bridge'y
- Ryzyko związane z bezpieczeństwem bridge'y
- Protokoły komunikatów