Giter Club home page Giter Club logo

machinomy's Introduction

Machinomy Monorepo Build Status Coverage Status Greenkeeper badge Chat

Machinomy Lerna Monorepo repository.

Available sub-projects:

  • Machinomy 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 Truffle used by Machinomy.
  • Examples is Machinomy examples.
  • Playground contains code of playground.machinomy.com
  • cli is Machinomy Command Line Interface.
  • logger is Machinomy Logger. Works in browser and Node.
  • wraptso is Machinomy Wrapper for Truffle Contract.

Web site: machinomy.com. Twitter: @machinomy. Support/Discussion: Gitter. FAQ: GitHub Wiki Page.

Installation

Using yarn and Node.js v9 is mandatory (don't use npm!)

$ yarn add machinomy

The library supports mainnet, Ropsten, and Rinkeby networks.

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/machinomy/machinomy
$ cd machinomy && yarn install && yarn bootstrap && yarn build
$ node packages/examples/src/server.js

And then run client script:

$ node packages/examples/src/client.js

Usage

Buy

Using TypeScript

import Machinomy from 'machinomy'
const uri = 'http://localhost:3000/content'

const machinomy = new Machinomy(SENDER_ACCOUNT, web3)
const contents = await machinomy.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/machinomy/machinomy
$ cd machinomy && yarn install && yarn bootstrap && yarn build && cd packages/examples
$ yarn run sender && yarn run receiver

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

Documentation

For more advanced documentation go to doc/ folder.

Contributing

Developers: Machinomy 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 install && yarn bootstrap

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

Apply migrations (eg. for PostgreSQL, refer packages/machinomy/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. Do not hesitate to share any idea with us on Gitter.

License

Licensed under Apache License, Version 2.0.

machinomy's People

Contributors

aryaskov avatar burtovoy avatar emschwartz avatar greenkeeper[bot] avatar kination avatar kincaidoneil avatar maniak89 avatar michielbdejong avatar mslipper avatar ukstv avatar xjenekx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

machinomy's Issues

Recalculate hash in Broker contract

canClaim must recalculate hash, that is signed by a sender. Now one could reuse a hash that is not related to channel or paid value to claim funds.

Pay incrementally

  • Send total: current value + increment
  • Track paid amount on the server
  • Track paid amount on the client
  • Close the channel if paid more or less than expected

Ancillary CLI subcommands

  • pry for getting info on a resource cost
  • see open channels
  • close channel
  • see status of the channels

Machinomy initialises storage every method call

File that gives an error: https://gist.github.com/ukstv/bb2915784dfe7102eca1c599018f0aaa

It results in

Error: ENOENT: no such file or directory, rename 'machinomy~' -> 'machinomy'

Reason: Machinomy tries to open few instances of storage with every method call, like https://github.com/machinomy/machinomy/blob/master/index.ts#L134, https://github.com/machinomy/machinomy/blob/master/index.ts#L157 and so on.

Related NeDB bug report: louischatriot/nedb#320

Proposed fix: initialise storage once per instance.

CC @djKooks

Clarify documentation

Hi! Great project. Some of the docs do not make sense, though.

For example these parts in the getting started guide:

It would allow her to cheat by settling on a value less than sent one. The sender initiates channel settling by the same machinomy close command. The get the funds a receiver is expected to finish settle on her side.

There are probably some more, but not ones I have noticed as of yet. Generally, it is a bit confusing that you switch between using seller/receiver and sender/buyer in the same passage of text throughout the documentation. Settling on just one would make things a bit clearer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.