{"id":20433064,"url":"https://github.com/anataliocs/lz-ref-app-basic","last_synced_at":"2025-12-03T13:04:39.478Z","repository":{"id":212135940,"uuid":"692245391","full_name":"anataliocs/lz-ref-app-basic","owner":"anataliocs","description":"Simple example of using LayerZero for cross-chain messaging.","archived":false,"fork":false,"pushed_at":"2024-04-04T16:09:11.000Z","size":879,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-05T06:20:22.903Z","etag":null,"topics":["hardhat","smart-contracts","solidity","typescript"],"latest_commit_sha":null,"homepage":"https://layerzero.network/","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anataliocs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-15T22:50:30.000Z","updated_at":"2023-12-08T10:25:39.000Z","dependencies_parsed_at":"2023-12-31T11:31:40.330Z","dependency_job_id":"6e183a40-270f-460e-ba44-f65dd22709f0","html_url":"https://github.com/anataliocs/lz-ref-app-basic","commit_stats":null,"previous_names":["anataliocs/lz-ref-app-basic"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/anataliocs/lz-ref-app-basic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anataliocs%2Flz-ref-app-basic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anataliocs%2Flz-ref-app-basic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anataliocs%2Flz-ref-app-basic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anataliocs%2Flz-ref-app-basic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anataliocs","download_url":"https://codeload.github.com/anataliocs/lz-ref-app-basic/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anataliocs%2Flz-ref-app-basic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27475697,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-03T02:00:06.367Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hardhat","smart-contracts","solidity","typescript"],"created_at":"2024-11-15T08:17:33.865Z","updated_at":"2025-12-03T13:04:39.449Z","avatar_url":"https://github.com/anataliocs.png","language":"Solidity","readme":"# Basic LZ Integration Blocking Reference App\n\nThis project demonstrates basic message sending using [LayerZero](https://layerzero.network/) to send a cross chain message \nfrom the source chain to the destination chain to increment a counter on the destination chain.\n\nThis is a default blocking implementation where failed messages will block the channel.\n\nThe contracts leverage the examples from the [Solidity Examples Github Repo](https://github.com/LayerZero-Labs/solidity-examples)\nwith additional documentation that may be redundant or excessive for a production mainnet app but is added to\nprovide a developer with additional context while learning how to integrate with [LayerZero](https://layerzero.network/).\n\nSome of these examples are simplified for the purpose of learning the basics of LZ Integration.  Please review\nthe best practices section of the [docs for more context for a mainnet implementation](https://layerzero.gitbook.io/docs/evm-guides/best-practice).\n\nBase Interfaces and Util libraries are explictly included for easy reference in `/interfaces` and `\\util`.\n\nThe contracts in this repo are not currently audited and are intended for learning purposes.  Do not directly use these code samples\ndirectly in a Mainnet application.\n\n### Basic Blocking Implementation\n\nReview `LzBaseApp` for more context on the implementation\n\nThe contract `LzBaseApp` is an example LzReceiver blocking implementation that provides send and \nreceive functionality and an example User Application Config.\n\n### Setup your .env file\n\nCreate your `.env` file:\n```shell\ntouch .env\n```\n\nUpdate your `.env` file:\n```\nINFURA_GOERLI_URL=\nINFURA_MUMBAI_URL=\n\nPRIVATE_KEY=\n```\n\n### Configuring your endpoint\n\nYou can review the [interface for configuring an endpoint on Github](https://github.com/LayerZero-Labs/solidity-examples/blob/main/contracts/interfaces/ILayerZeroEndpoint.sol)\nReview the docs for context on [setting the endpoint for various chains](https://layerzero.gitbook.io/docs/technical-reference/mainnet/supported-chain-ids)\n\nEndpoints are defined locally in `/constants/layerzeroEndpoints.json`\n\n### User Application Config\n\nReview the docs for additional context on [customizing your User Application Config](https://layerzero.gitbook.io/docs/evm-guides/ua-custom-configuration).\n\n### Test Deployment Dry Run Locally\n\nDeploy to local forks as a dry run before deploying to testnet.  \n\nInstall Ganache:\n```shell\nnpm install ganache --global\n```\n\nGanache allows you to fork an existing chain such as Goerli or Mumbai.\n\nStart up a local goerli node:\n```shell\nganache --fork.url https://goerli.infura.io/v3/[YOUR API KEY]\n```\n\nStart up a local Polygon Mumbai node:\n```shell\nganache --fork.url https://polygon-mumbai.infura.io/v3/[YOUR API KEY] --port 8446\n```\n\nDeploy to local Goerli:\n```shell\nnpx hardhat run --network localgoerli scripts/deployToOrigin.ts\n```\n\nDeploy to local Mumbai:\n```shell\nnpx hardhat run --network localmumbai scripts/deployToDestination.ts\n```\n\n### Deploy to Testnet\n\nYou will need testnet ETH to deploy.\n\nDeploy to Goerli:\n```shell\nnpx hardhat run --network goerli scripts/deployToOrigin.ts\n```\n\nDeploy to Mumbai:\n```shell\nnpx hardhat run --network mumbai scripts/deployToDestination.ts \n```\n\n### Example Deployed Contract\n\nMumbai:  0x07426f3F1524cE7569f3856C703621A54c5e5eFc\nhttps://mumbai.polygonscan.com/address/0x07426f3F1524cE7569f3856C703621A54c5e5eFc\n\nGoerli: 0x78Ac0e9ABCC9296bB7c8FAa53336243157961C59\nhttps://goerli.etherscan.io/address/0x78Ac0e9ABCC9296bB7c8FAa53336243157961C59\n\n\n### Publish and Verify Source Code\n\nRegister for a free [Etherscan account and create an API key](https://etherscan.io/register).\n\nAdd Etherscan API key to `.env`\n```\nETHERSCAN_API_KEY=\n```\n\nSubmit source code to Etherscan for origin contract on Goerli:\n```\nnpx hardhat verify --network goerli 0x78Ac0e9ABCC9296bB7c8FAa53336243157961C59 '0xbfD2135BFfbb0B5378b56643c2Df8a87552Bfa23' \n```\n\nRegister for a free [Polygonscan account and create an API key](https://polygonscan.com/register).\n\nAdd Polygonscan API key to `.env`\n```\nPOLYGONSCAN_API_KEY=\n```\n\nSubmit source code to Polygonscan for destination contract on Mumbai:\n```\nnpx hardhat verify --network mumbai 0x07426f3F1524cE7569f3856C703621A54c5e5eFc '0xf69186dfBa60DdB133E91E9A4B5673624293d8F8' \n```\n\nVerified Origin Contract Source Code on Goerli:  https://goerli.etherscan.io/address/0x78Ac0e9ABCC9296bB7c8FAa53336243157961C59#code\n\nVerified Destination Contract Source Code on Mumbai:  https://mumbai.polygonscan.com/address/0x07426f3F1524cE7569f3856C703621A54c5e5eFc#code\n\n### Set Trusted Remote\n\nExample [script from solidity examples Github Repo](https://github.com/LayerZero-Labs/solidity-examples/blob/main/tasks/setTrustedRemote.js)\n\nReview the docs on [setting a trusted remote](https://layerzero.gitbook.io/docs/evm-guides/master/set-trusted-remotes) for more context.\n\n\nSetting a trusted remote in 40 byte format:\n```typescript\nlet trustedRemote = hre.ethers.utils.solidityPack(\n    ['address','address'],\n    [remoteContract.address, localContract.address]\n)\n```\n\nSet trusted remotes on origin contract on Goerli:\n```shell\nnpx hardhat run --network goerli scripts/setTrustedRemoteOrigin.ts \n```\n\nSet Trusted Remote Transaction on origin contract on Goerli:  https://goerli.etherscan.io/tx/0x1f73668401fb710d7fd9a061962a673e878bc0e2d95bfe4bcdab3d05992bd355\n\nSet trusted remotes on destination contract on Mumbai:\n```shell\nnpx hardhat run --network mumbai scripts/setTrustedRemoteDestination.ts \n```\n\nSet Trusted Remote Transaction on destination contract on Mumbai:  https://mumbai.polygonscan.com/tx/0x67380bd4cc11b66c6375e47a6be365647a763cd68950336df307e2cce9363314\n\n\n### Send Message from Origin to Destination\n\n**Fee Estimation:**  When calling the `send()` method you must call `estimateFee()` on the endpoint deployed on your source chain\nand include the `fees[0]` value in the `msg.value` field in your `send()` transaction.\n\nNOTE:  Your `send()` and `estimateFee()` parameters such as source chain ID, payload and adapter parameters must be equivalent.\n\nCall increment counter on origin contract:\n```shell\nnpx hardhat run --network goerli scripts/incrementCrossChainCounter.ts\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanataliocs%2Flz-ref-app-basic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanataliocs%2Flz-ref-app-basic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanataliocs%2Flz-ref-app-basic/lists"}