Code Monkey home page Code Monkey logo

exploring-chainlink-ccip's Introduction

Chainlink Logo Exploring Chainlink CCIP

Introduction:

The Chainlink Cross-Chain Integration Protocol (CCIP) offers a unified and straightforward platform, allowing dApps and web3 entrepreneurs to confidently fulfill their cross-chain needs.

In my opinion, the idea of implementing a smart contract as router of the protocol is the most interesting part. As you can see, a router connects the end-user with the protocol and allows end-users to use CCIP by just learning how to intereact with the router contract.

CCIP Basic Architecture

Router in depth:

As said, the router is the contract responsible for initiating cross-chain interactions. There is one router per chain.

When transfering tokens, the router contract routes the instruction to the destination-specific OnRamp. The OnRamp is a unique contract responsible for validating the incoming data and located within a 'lane' (the onRamp contract is more complex than that, I only intend to give a superficial description so that you can continue reading. A better explanation can be found here).

A 'lane' is an unidirectional path between a source and a destination blockchain.

When receiving tokens, the router is the smart contract that sends the tokens or the message to the receiver. The router receives the data from a OffRamp contract. The OffRamp is a unique contract responsible for verifying the proof provided by the Executing DON against a committed and blessed Merkle root.

Faucets:

If you want to experiment with CCIP, Chainlink provides a couple of allowed tokens that can be used for testing.

But first get some Link tokens so you can pay the fees:

  1. Go to https://faucets.chain.link/.
  2. In Metamask, select the network where you want to receive testnet LINK.
  3. Click Connect wallet so the faucet app can detect the network and wallet address.
  4. If you want to receive testnet funds at a different address, paste it in the Wallet address section. This field defaults to your connected wallet address.
  5. In the Request type section, select the testnet funds that you want to receive.
  6. Complete the Captcha and click Send request. The funds are transferred from the faucet to the wallet address that you specified.

Two ERC20 test tokens are currently available on each testnet: CCIP-BnM (burn & mint) and CCIP-LnM (lock & mint).

Add CCIP-BnM to you previously connected to Avalanche Fuji wallet and then mint some tokens here

Getting started:

To use this code, you need to have installed foundry & npm

To check if you have them installed:

# In case you have them installed you will see the versions
$ forge --version
$ npm --version

Install the necessary dependencies:

$ make install

CCIP Send Tokens

Usage:

From Avalanche Fuji to Sepolia:

  1. Deploy CCIPTokenSender.sol:
$ make deploy
  1. Fund CCIPTokenSender.sol:
  • Open Metamask or your wallet of preference

  • Send 1 Link (for fees) and the amount of CCIP-BnM you want to send

  1. Transfer tokens:

To continue with this step, first go to the Makefile file and read carefully its comments. Make sure you modify the file before executing any make command.

  • First you need to white list the destination chain:
$ make whitelist 
  • Then just transfer the tokens
$ make transfer
  1. Check your Wallet on Sepolia network.
  • The tokens will arrive soon. As we are working with CCIP in testnets, transactions are slow.

exploring-chainlink-ccip's People

Contributors

santiellena avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.