{"id":13485468,"url":"https://github.com/icon-project/btp2-bsc","last_synced_at":"2026-04-04T03:08:58.426Z","repository":{"id":165798144,"uuid":"609029454","full_name":"icon-project/btp2-bsc","owner":"icon-project","description":"BTP 2.0 Relay System for BNB Smart Chain","archived":false,"fork":false,"pushed_at":"2024-09-27T03:31:31.000Z","size":7086,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"plato","last_synced_at":"2025-03-27T19:40:11.130Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","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/icon-project.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-03-03T08:21:52.000Z","updated_at":"2024-09-27T03:30:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"c9e67052-54f6-41bc-8e95-8ab4fedaeedc","html_url":"https://github.com/icon-project/btp2-bsc","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/icon-project/btp2-bsc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icon-project%2Fbtp2-bsc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icon-project%2Fbtp2-bsc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icon-project%2Fbtp2-bsc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icon-project%2Fbtp2-bsc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icon-project","download_url":"https://codeload.github.com/icon-project/btp2-bsc/tar.gz/refs/heads/plato","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icon-project%2Fbtp2-bsc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31385980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T01:22:39.193Z","status":"online","status_checked_at":"2026-04-04T02:00:07.569Z","response_time":60,"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":[],"created_at":"2024-07-31T18:00:23.496Z","updated_at":"2026-04-04T03:08:58.410Z","avatar_url":"https://github.com/icon-project.png","language":"Go","funding_links":[],"categories":["Interoperability"],"sub_categories":[],"readme":"# Relay System for BTP 2.0\n\n## Introduction\n\nThis is a reference `relay` implementation for BTP 2.0 protocol.\n\n### Target chains\n* ICON (BTP Block)\n* BSC\n\n### Terminologies\n\n| Word            | Description                                                                                                                             |\n|:----------------|:----------------------------------------------------------------------------------------------------------------------------------------|\n| BTP             | Blockchain Transmission Protocol, see [ICON BTP Standard](https://github.com/icon-project/IIPs/blob/master/IIPS/iip-25.md).             |\n| BTP Message     | A verified message which is delivered by the relay                                                                                      |\n| Service Message | A payload in a BTP Message                                                                                                              |\n| Relay Message   | A message including BTP Messages with proofs for that, and other block update messages.                                                 |\n| Network Address | A string to identify blockchain network \u003cbr/\u003e *ex) 0x1.icon*                                                                            |\n| BTP Address     | A string of URL for locating an account of the blockchain network \u003cbr/\u003e *ex) btp://0x1.icon/cx87ed9048b594b95199f326fc76e76a9d33dd665b* |\n\nSee [ICON BTP Standard](https://github.com/icon-project/IIPs/blob/master/IIPS/iip-25.md) and [Relay System for BTP 2.0](https://github.com/icon-project/btp2) for more details.\n\n\n### Components\n\n* [BTP Message Center (BMC)](https://github.com/icon-project/IIPs/blob/master/IIPS/iip-25.md#btp-message-center) - smart contract\n  - Receive BTP messages through transactions.\n  - Send BTP messages through events.\n\n* [BTP Message Verifier (BMV)](https://github.com/icon-project/IIPs/blob/master/IIPS/iip-25.md#btp-message-verifier) - smart contract\n  - Update blockchain verification information\n  - Verify delivered BTP message and decode it\n\n* [BTP Service Handler (BSH)](https://github.com/icon-project/IIPs/blob/master/IIPS/iip-25.md#btp-service-handler) - smart contract\n  - Handle service messages related to the service.\n  - Send service messages through the BMC\n\n* [BTP Message Relay (BMR)](doc/bmr.md) - external software (implemented by this repository)\n  - Monitor BTP events\n  - Gather proofs for the events\n  - Send BTP Relay Message\n\n## Getting Started\n### Build Relay\n```shell\n`git clone https://github.com/icon-project/btp2-bsc.git --recurse-submodules`\n`cd btp2-bsc`\n\n# compile binary\n`make relay`\n\n# build docker image\nmake relay-image\n```\n\n### Configuration\nFor retrieving `chains_config.src.options.start_number` please read the [Retrieve start-block number](#Retrieve-start-block-number)\n```json\n{\n  \"relay_config\": {\n    \"base_dir\": \".\",\n    \"direction\": \"both\",\n    \"log_level\": \"debug\",\n    \"console_level\": \"trace\",\n    \"log_forwarder\": {\n      \"vendor\": \"\",\n      \"address\": \"\",\n      \"level\": \"info\",\n      \"name\": \"\"\n    },\n    \"log_writer\": {\n      \"filename\": \"data/relay.log\",\n      \"maxsize\": 100,\n      \"maxage\": 0,\n      \"maxbackups\": 0,\n      \"localtime\": false,\n      \"compress\": false\n    }\n  },\n  \"chains_config\": {\n    \"src\": {\n      \"address\": \"btp://0x63.bsc/0x9Fd9e050682A8795dEa6eE70870A82a513d390Ac\",\n      \"endpoint\": \"https://bsc-node\",\n      \"key_store\": \"${BSC_KEYSTORE_FILE}\",\n      \"key_password\": \"-\",\n      \"options\": {\n        \"db_type\": \"leveldb\",\n        \"db_path\": \"data\",\n        \"start_number\": \"32489600\"\n      },\n      \"type\" : \"bsc-hertz\"\n    },\n    \"dst\": {\n      \"address\": \"btp://0x3.icon/cxf1b0808f09138fffdb890772315aeabb37072a8a\",\n      \"endpoint\": \"https://icon-node/api/v3/icon_dex\",\n      \"key_store\": \"${ICON_KEYSTORE_FILE}\",\n      \"key_password\": \"-\",\n      \"type\" : \"icon-btpblock\"\n    }\n  }\n}\n```\n\n### Execution\n```shell\n./bin/relay start -c config.json\n```\nor, execution with docker\n\n```shell\ndocker run -d --network=host -v ${BSC_KEYSTORE_FILE}:${BSC_KEYSTORE_FILE_ON_DOCKER} \\\n  -v ${ICON_KEYSTORE_FILE}:${ICON_KEYSTORE_FILE_ON_DOCKER} \\\n  -v ${CONFIG_FILE}:/etc/config/config.json -e RELAY_CONFIG=/etc/config/config.json \\\n  -d btp2-bsc/relay\n```\n\n### Retrieve start block number\n\n```shell\nnode e2edemo/scripts/setup/retrieve-start-block-number.js ${ICON-NODE-RPC-URL} ${BTP-ADDRESS-BMC-ON-BSC} ${BMC-ADDRESS-ON-ICON}\n\nexample:) node ./e2edemo/scripts/setup/retrieve-start-block-number.js http://localhost:9080/api/v3/icon_dex btp://0x63.bsc/0x61143C6026C0459847389fB5Cb8f5A6482A6b5D4 cxc762bf1b69625dc98e8a872b8b8dc3468eea28f0\n```\n\nor\n\n```shell\n1. Retrive BTP Status for BSC\ncurl --location 'https://icon-rpc-url' \\\n    --header 'Content-Type: application/json' \\\n    --data '{\n      \"jsonrpc\": \"2.0\",\n      \"method\": \"icx_call\",\n      \"id\": 1,\n      \"params\": {\n          \"to\": \"cxc762bf1b69625dc98e8a872b8b8dc3468eea28f0\" // contract address of bmc on icon\n          \"dataType\": \"call\",\n          \"data\": {\n              \"method\": \"getStatus\",\n              \"params\": {\n                  \"_link\": \"btp://0x63.bsc/0x61143C6026C0459847389fB5Cb8f5A6482A6b5D4\" // btp address of bmc on bsc\n              }\n          }\n      }\n    }'\n\n// Response\n{\n    \"jsonrpc\":\"2.0\",\n    \"result\":{\n        \"cur_height\": \"0xed02bb\",\n        \"rx_seq\": \"0x288\",\n        \"tx_seq\": \"0x362\",\n        \"verifier\": {\n            \"extra\": \"0xf86d8401efc080f86601a05af60449fa89cd17ddbd129939db8a46e51d6489a09e370e0849a71f6febabaf01a0fb97f327a8a677837d0eebe25e23d3eb9e9b6b8fbdd39abf42ad5308fd3a18c280a0a38c2f7e262db3b848d742c71647425ec3997dbcf4c319dec783d553ecc82040\",\n            \"height\": \"0x211159b\"\n        }\n    },\n    \"id\":1\n}\n\n2. RLP(n)-Decode `extra` field of BTP Status\n$decode(f86d8401efc080f86601a05af60449fa89cd17ddbd129939db8a46e51d6489a09e370e0849a71f6febabaf01a0fb97f327a8a677837d0eebe25e23d3eb9e9b6b8fbdd39abf42ad5308fd3a18c280a0a38c2f7e262db3b848d742c71647425ec3997dbcf4c319dec783d553ecc82040)\n\n[\n  # 1st element means start block number\n  \u003cBuffer 01 ef c0 80\u003e, // decimals format: 32489600\n  [\n    \u003cBuffer 01\u003e,\n    \u003cBuffer 5a f6 04 49 fa 89 cd 17 dd bd 12 99 39 db 8a 46 e5 1d 64 89 a0 9e 37 0e 08 49 a7 1f 6f eb ab af\u003e,\n    \u003cBuffer 01\u003e,\n    \u003cBuffer fb 97 f3 27 a8 a6 77 83 7d 0e eb e2 5e 23 d3 eb 9e 9b 6b 8f bd d3 9a bf 42 ad 53 08 fd 3a 18 c2\u003e,\n    Uint8Array(0) [],\n    \u003cBuffer a3 8c 2f 7e 26 2d b3 b8 48 d7 42 c7 16 47 42 5e c3 99 7d bc f4 c3 19 de c7 83 d5 53 ec c8 20 40\u003e\n  ]\n]\n\n```\n\n## E2E Testing Demo\n* Follow the instruction in [End-to-End Testing Demo](e2edemo) folder.\n\n## References\n* [ICON BTP Standard](https://github.com/icon-project/IIPs/blob/master/IIPS/iip-25.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficon-project%2Fbtp2-bsc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficon-project%2Fbtp2-bsc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficon-project%2Fbtp2-bsc/lists"}