{"id":29483149,"url":"https://github.com/ymuichiro/atomic-port","last_synced_at":"2026-03-07T07:31:04.064Z","repository":{"id":65007130,"uuid":"578692482","full_name":"ymuichiro/atomic-port","owner":"ymuichiro","description":"Cross-chain swap between EVM-based chains and Symbol chains","archived":false,"fork":false,"pushed_at":"2023-02-14T15:19:51.000Z","size":1197,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-23T00:06:48.503Z","etag":null,"topics":["blockchain","cross-chain-swap","ethereum","jpyc","polygon","symbol"],"latest_commit_sha":null,"homepage":"https://symbol-community.com/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ymuichiro.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}},"created_at":"2022-12-15T16:51:46.000Z","updated_at":"2025-10-12T03:16:09.000Z","dependencies_parsed_at":"2022-12-21T08:34:10.340Z","dependency_job_id":null,"html_url":"https://github.com/ymuichiro/atomic-port","commit_stats":null,"previous_names":["ymuichiro/evm-symbol-swap"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ymuichiro/atomic-port","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymuichiro%2Fatomic-port","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymuichiro%2Fatomic-port/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymuichiro%2Fatomic-port/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymuichiro%2Fatomic-port/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ymuichiro","download_url":"https://codeload.github.com/ymuichiro/atomic-port/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ymuichiro%2Fatomic-port/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30209719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T05:23:27.321Z","status":"ssl_error","status_checked_at":"2026-03-07T05:00:17.256Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["blockchain","cross-chain-swap","ethereum","jpyc","polygon","symbol"],"created_at":"2025-07-15T03:01:16.332Z","updated_at":"2026-03-07T07:31:04.044Z","avatar_url":"https://github.com/ymuichiro.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://user-images.githubusercontent.com/47295014/218366041-d07fdf06-1b72-4c6d-8fa2-89dc8266553d.png\"\u003e\n  \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://user-images.githubusercontent.com/47295014/218366194-eee5969d-3c4c-4445-9303-5368c66aac9a.png\"\u003e\n  \u003cimg alt=\"logo\" src=\"https://user-images.githubusercontent.com/47295014/218366194-eee5969d-3c4c-4445-9303-5368c66aac9a.png\"\u003e\n\u003c/picture\u003e\n\u003c/div\u003e\n\n# Atomic port\n\nThis package is for HTLC transactions between the any blockchains. HTLC stands for Hashed time lock contract. HTLC allows direct transactions between different chains. Usage and examples are shown below.\n\n\u003cbr\u003e\n\n## Attention\n\nThis script was created and released for research and experimentation and is not intended to encourage actual use.\nTrading of crypto assets may require licenses, applications, or approvals in some countries.\nPlease consider using them at your own risk.\n\n\u003cbr\u003e\n\n## Test is now open to the public.\n\nTransactions on each chain in this library are currently available only on the testnet.\nIf you wish to use it in a production environment, please change the network and other parameters.\n\n\u003cbr\u003e\n\n## Chains or Tokens\n\nThe following chains \u0026 tokens are supported\n\n- Bitcoin\n  - [about bitcoin](https://bitcoin.org/)\n  - [htlc package](./packages/bitcoin/README.md)\n- Ethereum\n  - [about ethereum](https://ethereum.org/)\n  - [htlc package](./packages/evm/README.md)\n- Polygon\n  - [about polygon](https://polygon.technology/)\n  - [htlc package](./packages/evm/README.md)\n- JPYC\n  - [about jpyc](https://jpyc.jp/)\n  - [htlc package](./packages/evm/README.md)\n- MONA\n  - [about mona](https://monacoin.org/)\n  - [htlc package](./packages/mona/README.md)\n- Symbol\n  - [about symbol](https://symbol-community.com/)\n  - [htlc package](./packages/symbol/README.md)\n\n## Example\n\nA lock transaction is created to execute HTLC and initiate the transaction.\nThe executor keeps the generated Proof and shares the Secret with the counterparty.\n\n```ts\nasync function lock() {\n  // setup\n  const client = new SymbolHtlc(\n    SYMBOL.NETWORK.ENDPOINT,\n    NetworkType.TEST_NET,\n    SYMBOL.NETWORK.GENERATION_HASH_SEED,\n    SYMBOL.NETWORK.EPOCH_ADJUSTMENT\n  );\n  const recipientAccount = Account.createFromPrivateKey(SYMBOL.PRIVATEKEY.TO, NetworkType.TEST_NET);\n  const senderAccount = Account.createFromPrivateKey(SYMBOL.PRIVATEKEY.FROM, NetworkType.TEST_NET);\n  const hashPair = client.createHashPair();\n  // lock\n  const transaction = client.lock(recipientAccount.address.plain(), SYMBOL.CURRENCY.MOSAIC_ID, hashPair.secret, 1);\n  const signedTx = await client.sign(SYMBOL.PRIVATEKEY.FROM, transaction);\n  console.log('----- wait until transaction is approved -----', {\n    fromAddress: senderAccount.address.pretty(),\n    toAddress: recipientAccount.address.pretty(),\n    transactionHash: signedTx.hash,\n    proof: hashPair.proof,\n    secret: hashPair.secret,\n  });\n  // Wait for secret transaction to be approved\n  await waitConfirmedTransaction(SYMBOL.NETWORK.ENDPOINT, senderAccount.address, signedTx.hash);\n}\n\nasync function start() {\n  await lock();\n}\n```\n\nWhen a transaction is completed, you will receive tokens from the block.\nThe Proof generated at this time is used.\n\n```ts\nasync function withDraw(proof: string, secret: string) {\n  const client = new SymbolHtlc(\n    SYMBOL.NETWORK.ENDPOINT,\n    NetworkType.TEST_NET,\n    SYMBOL.NETWORK.GENERATION_HASH_SEED,\n    SYMBOL.NETWORK.EPOCH_ADJUSTMENT\n  );\n  const recipientAccount = Account.createFromPrivateKey(SYMBOL.PRIVATEKEY.TO, NetworkType.TEST_NET);\n  const drawTx = client.withDraw(recipientAccount.address.plain(), proof, secret);\n  const signedTx = await client.sign(recipientAccount.privateKey, drawTx);\n  console.log('waiting...', signedTx.hash);\n  await waitConfirmedTransaction(SYMBOL.NETWORK.ENDPOINT, recipientAccount.address, signedTx.hash);\n  console.log(signedTx);\n}\n\nasync function start() {\n  const proof = '************************';\n  const secret = '************************';\n  await withDraw(proof, secret);\n}\n```\n\nAn example of a flow is shown below.\n※ If you cannot see the following as a figure, please check with your browser.\n\n```mermaid\nsequenceDiagram\n    actor Alice\n    participant Chain A\n    participant Chain B\n    actor Bob\n    Note over Alice,Bob: Start trading\n    Note over Alice: Create Secret\u0026Proof\n    Alice -\u003e\u003e  Chain A: Create Lock Tx(A) from Secret\n    Note over Chain A: Tx Alice to Bob(is Lock)\n    Alice --\u003e\u003e Bob:  Secret used is shared separately\n    Bob --\u003e\u003e Chain A: Check if lock Tx(A) has block\n    Bob -\u003e\u003e Chain B: Create Lock Tx(B) from Secret\n    Note over Chain B: Tx Bob to Alice(is Lock)\n    Alice --\u003e\u003e Chain B: Check if lock Tx(B) has block\n    Alice -\u003e\u003e Chain B: Unlock Tx(B) using owned Proof\n    Note over Chain B: Tx Bob to Alice(is unlock)\n    Bob --\u003e\u003e Chain B: Get proof by Tx(B)\n    Bob -\u003e\u003e Chain A: Unlock Tx(A) using acquired Proof\n    Note over Chain A: Tx Alice to Bob(is unlock)\n    Note over Alice,Bob: Transaction Completed\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fymuichiro%2Fatomic-port","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fymuichiro%2Fatomic-port","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fymuichiro%2Fatomic-port/lists"}