MyNixOS website logo
Description

Tools for working with Crypto/Web3

Please see the README on GitHub at https://github.com/gtollini/web3-tools#readme

web3-tools

CI

A Haskell library providing simple, reusable cryptographic utilities for Web3 development.

This is a small, focused library that I maintain and expand as needed. Contributions, feature requests, and suggestions are always welcome!

Features

  • Ethereum signature verification - Verify ECDSA signatures against addresses
  • Address recovery - Recover Ethereum addresses from message signatures
  • Secp256k1 operations - Low-level elliptic curve cryptography via FFI
  • Keccak256 hashing - Ethereum-compatible hash function

Module Structure

The library is organized to separate chain-agnostic crypto primitives from blockchain-specific implementations:

Crypto.*              -- Shared cryptographic primitives
  Crypto.Hash.Keccak  -- Keccak256 hashing
  Crypto.Secp256k1.*  -- Elliptic curve operations

Eth.*                 -- Ethereum-specific functionality
  Eth.Address         -- Signature verification and address recovery

This makes it easy to add support for other blockchains while reusing common cryptographic building blocks.

Installation

Requirements:

  • libsecp256k1-devel (or libsecp256k1-dev on Debian/Ubuntu)

Using Stack:

stack build

Usage Example

{-# LANGUAGE OverloadedStrings #-}
import Eth.Address (verifySignature)

-- Verify an Ethereum signature
main :: IO ()
main = do
  let message = "Hello, Web3!"
      signature = ... -- 65-byte signature (r || s || v)
      address = ...   -- 20-byte Ethereum address

  isValid <- verifySignature message signature address
  print isValid

Contributing

This library grows based on practical needs. If you:

  • Need a specific feature for your project
  • Found a bug or issue
  • Have suggestions for improvements
  • Want to add support for another blockchain

Feel free to open an issue or submit a PR!

License

MIT - See LICENSE file for details.

Metadata

Version

0.1.0.0

License

Platforms (76)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows