Practical overview
When it fits
Use it when an Ethereum application needs hash-locked transfers with an expiry-based refund path, especially as the Ethereum-side contract component of an atomic-swap design.
Who it is for
- Ethereum developers building atomic-swap applications.
- Developers seeking reusable HTLC contracts for ETH, ERC-20 or ERC-721 transfer flows.
Documented uses
- Create a time-limited, hash-locked asset transfer.
- Let a recipient claim funds or tokens by revealing a matching secret preimage.
- Allow the contract creator to request a refund after the timelock expires.
- Explore paired contract flows for cross-chain swaps and token-for-token exchanges.
Requirements & limits
The repository is public and specifies a GPL-3.0 license.
- The contracts provide transfer primitives rather than a complete end-user swap application.
- The claim path requires the matching secret preimage; the refund path is available to the creator after the timelock expires if no withdrawal occurred.
- ERC-20 setup requires token approval, as reflected in the documented tests.
- The README describes separate contracts and interfaces for ETH, ERC-20 and ERC-721 assets.
- The documented local test workflow uses Ganache with network ID 4447 and Truffle.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Run the repository’s Truffle tests
Set up the documented local test environment and run the project’s Truffle tests.
Before you start
- Node.js/npm dependencies for the repository
- Ganache configured with network ID 4447
- Truffle test setup in the repository
Steps
Install dependencies with npm install.
Start Ganache using the repository’s npm run ganache-start script.
Run the test suite with npm run test.
Expected outcome
The documented workflow runs tests for HTLC creation, claims, refunds and token-swap scenarios.
Guide limitations
- This is a local testing workflow, not deployment guidance.
- The README’s test output is repository documentation, not a current execution result.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 16 October 2026
- Original website title
- chatch/hashed-timelock-contract-ethereum · Official homepage title · retained in its source language

