🎁 Get the FREE AI Skills Starter Guide β€” Subscribe β†’
BytesAgainBytesAgain
πŸ¦€ ClawHub

Hash Time Locked Contract

by @web4agent

Enables trustless atomic swaps and escrow for inscriptions and NFTs on EVM chains using Hash Time Locked Contracts.

Versionv1.0.0
Downloads923
TERMINAL
clawhub install htlc

πŸ“– About This Skill


name: htlc-trade description: HTLC (Hash Time Locked Contract) trading for inscriptions and NFTs on EVM chains. Use when: (1) Buying or selling inscriptions via atomic swap, (2) Trading NFTs peer-to-peer without intermediaries, (3) Setting up trustless escrow for any digital asset, (4) Implementing commit-reveal trading patterns. Supports Base, Ethereum, Arbitrum and other EVM chains.

HTLC Trade

Atomic swap trading using Hash Time Locked Contracts.

Quick Start

# Install dependencies
npm install ethers viem

Set environment

export PRIVATE_KEY=0x... export BASE_ETH_RPC=https://mainnet.base.org

Commands

Generate Preimage

node scripts/htlc.js preimage

Lock Funds (Buyer)

node scripts/htlc.js lock    

Reveal (Seller)

node scripts/htlc.js reveal  

Full Trade

node scripts/htlc.js trade   

Contract

BaseTimelock: 0xa7f9f88e753147d69baf8f2fef89a551680dbac1

Flow

1. Seller generates preimage, shares hash + inscription 2. Buyer verifies inscription, calls lock() with ETH 3. Seller calls reveal() with preimage β†’ ETH released 4. Buyer confirms receipt β†’ trade complete

πŸ’‘ Examples

# Install dependencies
npm install ethers viem

Set environment

export PRIVATE_KEY=0x... export BASE_ETH_RPC=https://mainnet.base.org