0Pricing
Web3 & DApp Development Fundamentals · บทเรียน

โพรโทคอลการส่งข้อความ

LayerZero, CCIP

โพรโทคอลการส่งข้อความ เป็นบทเรียน Web3 & DApp Development Fundamentals ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Web3 & DApp Development Fundamentals และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Web3 & DApp Development Fundamentals มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

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!

คำถามที่พบบ่อย

บทเรียน “โพรโทคอลการส่งข้อความ” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “โพรโทคอลการส่งข้อความ” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Web3 & DApp Development Fundamentals ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Web3 & DApp Development Fundamentals มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “โพรโทคอลการส่งข้อความ”

LayerZero, CCIP คุณปฏิบัติ Web3 & DApp Development Fundamentals ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Web3 & DApp Development Fundamentals หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Web3 & DApp Development Fundamentals บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน

บทเรียน “โพรโทคอลการส่งข้อความ” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน Web3 & DApp Development Fundamentals นี้ได้ไหม

ได้ บทเรียน Web3 & DApp Development Fundamentals ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. แนวคิดข้ามเชน
  2. สถาปัตยกรรมบริดจ์
  3. ความเสี่ยงด้านความปลอดภัยของบริดจ์
  4. โพรโทคอลการส่งข้อความ
← กลับไปที่ Web3 & DApp Development Fundamentals