Skip to content

Node.js library for micropayments in Ether and ERC20 tokens over HTTP

License

Notifications You must be signed in to change notification settings

ARyaskov/IohTee

 
 

Repository files navigation

IohTee Monorepo

Module type: CJS+ESM Coverage Status Greenkeeper badge Dependabot

! Upgrading to v2 is in progress! Expect bugs !

IohTee repository. The second life of Machinomy library. We're upgrading it to contemporary standards (TypeScript 5+, Node.js 18+, ES2023+) and adding new features. Please note, this is NOT monorepo anymore due to some Yarn v4 monorepos limitations: you have to install deps and build each package separately.

Available sub-projects:

  • IohTee is a Node.js library for micropayments in Ether over HTTP. It allows you to send and receive a minuscule amount of money instantly.
  • Contracts is a TypeScript interface for Ethereum contracts managed by HardHat used by IohTee.
  • Examples is IohTee examples.
  • Playground contains code of play.iohtee.toivo.tech

Tasks in progress

  • support for dual build ESM+CJS
  • split pseudo-monorepo into separate repos
  • add IohTee Contracts to GH Actions Workflow

Web site: iohtee.toivo.tech

Twitter:

FAQ:

Installation

Tinkering

It takes two to tango: a seller and a buyer. Seller is packages/examples/src/server.ts script. Build it or run through node-ts.

$ git clone https://github.com/ARyaskov/IohTee
$ cd IohTee && yarn && yarn build
$ node packages/examples/src/hub.js

And then run client script:

$ node packages/examples/src/client.js

Usage

Buy

Using TypeScript

import { IohTee } from '@riaskov/iohtee'
const uri = 'http://localhost:3000/content'

const iohtee = new IohTee(SENDER_ACCOUNT, web3)
const contents = await iohtee.buy({ receiver: RECEIVER_ACCOUNT, price: 100, gateway: 'http://localhost:3001/accept' })
console.log(contents)

Sell

The process is more convoluted than buying. Better consult packages/examples/src/server.ts file.

Sending payments through channels

$ git clone https://github.com/ARyaskov/IohTee
$ cd IohTee && yarn && yarn build && cd packages/examples
$ yarn run sender && yarn run receiver

Look at sender.ts and receiver.ts for more information.

Aux

If you want to see all logs in verbose format use DEBUG=*

Documentation

For more advanced documentation go to doc/ folder.

Contributing

Developers: IohTee is for you. Feel free to use it, break it, fork it, and make the world better. The code is standard TypeScript, no special skills required:

$ yarn

Using yarn v4 is mandatory (don't use npm!)

Apply migrations (eg. for PostgreSQL, refer packages/iohtee/database.json):

$ PGUSER=user PGPASSWORD=pass PGHOSTADDR=localhost PGDATABASE=dbname yarn migrate

Non-Developers: You are lovely. As a starter, help us spread the word! Tell a friend right now. If not enough, developers need flesh-world guidance. It starts with proper documentation and a pinch of fantasy. Really anything, whether it is a short post on a use case of IoT micropayments, addition to the documentation (code comments, yay!), or an elaborate analysis of machine economy implications.

License

Licensed under Apache License, Version 2.0.

About

Node.js library for micropayments in Ether and ERC20 tokens over HTTP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 90.8%
  • Solidity 6.3%
  • Mustache 1.2%
  • Other 1.7%