Skip to content

Hashchain Protocol is a scalable, hash-based framework that enables fast, low-cost blockchain transactions. We utilize an escrow smart contract and off-chain processing, reducing fees while ensuring secure and trustless payments.

Notifications You must be signed in to change notification settings

hashchain-protocol/solidity

Repository files navigation

Hashchain Protocol

In today's world, one can find oneself stuck in service contracts which are defined by the corporate greed rather than your requirements. We intend to solve this by giving back control to you, the user. Our micro-transactions solution lets you granularise and adapt these service contracts to your needs, whether your need is for a few seconds or a couple of hours. Take your WiFi service contract for example, you are forced to pay on a monthly/yearly basis even though you might use it for a few minutes/hours. Our solution allows you to track this usage at a very granular level and pay only for what you have used. This provides you with the freedom you deserve, while ensuring more trust between you and the service provider.

Contract

The key insight behind the scheme is to replace resource-hungry PKI operations with hash functions to reduce on-chain cost. Our contract facilitates decentralized payments using hashchains for token validation between payers and merchants.

Core Features:
  • Channel creation: Users create channels with a trust anchor, locked Ether, and token parameters.
  • Channel Redemption: Merchants redeem tokens, validated by the Utility contract. Contract sends proportional payment and refunds any remaining balance.
  • Token Validation: Uses hashchains for secure, trustless token verification.

The process flow of interactions between the client, server, and smart contract is described in the following diagrams:

Hash Chain-Based Scheme

This contract ensures secure, efficient, and trustless micro transactions for decentralized applications.

Local Development & Deployment

Prerequisites

  • Foundry (forge, cast)
  • A valid Ethereum/FEVM keystore file and password
  • RPC endpoint (e.g. Filecoin Calibration, Mainnet, etc.)

Build and test

make build

Deployment

Deploy MuPay contract

make deploy-mupay

Deploy Multisig contract

make deploy-multisig

Deploy both

make deploy-all

By default, deployment targets the Filecoin Calibration (calibnet) network (chain_id: 314159).
You can adjust the chain_id or RPC endpoint in the Makefile or deployment script for other networks.

Environment Setup

Copy .env.example to .env and fill in your values before deploying:

cp .env.example .env

Then edit .env as needed.

You can generate a keystore file from a private key using:

cast wallet import --private-key $PRIVATE_KEY keystoreName
# File will be saved to ~/.foundry/keystores/

About

Hashchain Protocol is a scalable, hash-based framework that enables fast, low-cost blockchain transactions. We utilize an escrow smart contract and off-chain processing, reducing fees while ensuring secure and trustless payments.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •