Skip to content

Repository files navigation

IOTA Tangle Payment Module

This repository contains all functions to make payments with IOTA. This module is a microervice, which handles payments automaticly and provides different channels for communication. Wir features like MAM logging and watching live transaction, this is the perfect start to work with the tangle.

THere is an live demonstration of this module.

Setup and run

Start all 4 machines (robot 1 and 2 + solar and wind energy)

You have to install Docker.

git clone https://github.com/machineeconomy/machine
cd machine
npm install
npm start

Architecture

This module provides an IOTA wallet, Logging services and order management.

Everything can be configured via environment variables.

Environment Variables

VariableExampleDescription
PORT3000application port.
NAMErobot 1the name of the service.
SEEDAVL...RFS81 trytes long iota seed for the wallet.
IS_PROVIDERtrue/falseDefines to module as provider.
PROVIDER_URLhttp://localhost:3002Provider URl.
VALUE1337Defines the cost of an order.
CUSTOM_SCRIPTtrue/falseRuns custom script after payment.
DEVELOPMENTtrue/falseDefines the module mode.

Default .env File

PORT=3001
NAME=dev robot 1 SEED=AAAAAAVTYWSUOLUWJTRYYPOIGF9KHFRVAZKAUHXKVHPOZJJZ9ELIPIEPPIIMTXIMMKQSHAAAAAAAAAAAA
IS_PROVIDER=false
PROVIDER_URL=http://localhost:3002
VALUE=0
CUSTOM_SCRIPT=true
DEVELOPMENT=true

Webserver

The service provide some endpoints to get information about the state of the service.

PATHMethodExampleDescription
/GEThttp://localhost:3000/show module dashboard
/ordersGEThttp://localhost:3000/ordersget a list of all orders
/ordersPOSThttp://localhost:3000/orderscreate a new order, returns an addresss
/orders/:uuidGEThttp://localhost:3000/orders/abc-123-efgget order details about the order with given id
/get_account_dataGEThttp://localhost:3000/get_account_dataget IOTA account data from the module

Websockets

The sevice also provides a websocket connection. It runs also on the same PORT like the webserver under path /sockets.

When a new user connect to the ws server, the service emits a message with the name and status of the machine in the welcome channel.

The service listens to the order channel, for incoming orders through the user application.

module status

StatusDescription
bootingmachine starts up.
waiting_for_ordermachine wait for an incoming order.
waiting_for_txmachine waits for incoming transaction to IRI via ZMQ messages.
waiting_for_tx_confirmmachine waits for incoming transaction to be confirmed.
payout_providermachine pays the provider
workingmachine is working

About

AKITA IOTA Module - Enables machines to be part of the Industry 4.0 and the machine economy.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages