Sign inSign up

michielbdejong/ilp-kit

By michielbdejong

Updated about 9 years ago

Used for trying out ilp-kit versions before they are released

Image
0

650

michielbdejong/ilp-kit repository overview


ILP Kit

ILP wallet with hosted ledger and connector instances

circle Deploy to Heroku FOSSA Status

Setup

Development

See https://github.com/interledgerjs/ilp-kit/blob/master/docs/DEV.md

Table of contents

Environment variables

Note: Most of the variables can either be set as environment variable or in a config file. The default config file is env.list. Environment variables take precedence over variables set in the config file.

Required
NameExampleDescription
API_HOSTNAMEwallet.comAPI public hostname.
API_PORT3000API private port (used as both public and private port if API_PUBLIC_PORT is not specified).
DB_URIpostgres://localhost/walletURI for connecting to a database.
API_LEDGER_ADMIN_USERadminLedger admin username.
API_LEDGER_ADMIN_PASSpassLedger admin pass.
CLIENT_HOSTwallet.comPublicly visible hostname.
CLIENT_PORT4000Client port.
LEDGER_ILP_PREFIXwallet.This is required if the API_LEDGER_URI is not specified
Optional
NameExampleDescription
API_CONFIG_FILEcustom-env.listSpecifies the path from which to load the config file. Needs to be defined as environment variable.
API_PRIVATE_HOSTNAMElocalhostPrivate API hostname.
API_PUBLIC_PORTApi public port.
API_SECRETqO2UX+fdl+tg0a1bYtApi secret. Used to generate the session, oauth and condition secrets.
API_RELOADtrueTurn on/off the reload endpoint.
API_LEDGER_URIhttp://wallet.com:2000Ledger URI: requests go to this uri (a ledger instance will be started by the wallet if this is not specified).
API_LEDGER_PUBLIC_URIhttp://wallet.com/ledgerLedger public URI (used in account URIs). Specified if different from the API_LEDGER_URI.
API_TRACK_GAUA-XXXXX-XGoogle Analytics Tracking ID.
API_TRACK_MIXPANELMixpanel Tracking ID.
API_GITHUB_CLIENT_IDGithub application client id (used for github oauth).
API_GITHUB_CLIENT_SECRETGithub application client secret (used for github oauth).
API_MAILGUN_API_KEYMailgun api key (for sending emails).
API_MAILGUN_DOMAINwallet.comOne of the domains attached to the Mailgun account.
API_ANTIFRAUD_SERVICE_URLantifraud.wallet.comAnti fraud service url. This will enable an additional step in registration that asks for personal details
API_ANTIFRAUD_MAX_RISK20Maximum tolerable risk level for the registration
API_EMAIL_SENDER_NAMEinfoEmail sender name
API_EMAIL_SENDER_ADDRESS[email protected]Email sender address
API_REGISTRATIONtrueEnable/Disable registration
WALLET_FORCE_HTTPStrueForce all connections to use HTTPS.
WALLET_TRUST_XFP_HEADERtrueTrust the X-Forwarded-Proto header.
CONNECTOR_ENABLEfalseRun a connector instance
CLIENT_PUBLIC_PORT80Client public port (if different from CLIENT_PORT)
CLIENT_TITLEILP KitBrowser title and logo
Default five-bells-ledger environment variables

(used if the API_LEDGER_URI is not specified). You can read more about these variables in the five-bells-ledger readme.

NameDefault
LEDGER_DB_URIDB_URI
LEDGER_ADMIN_USERAPI_LEDGER_ADMIN_USER
LEDGER_ADMIN_PASSAPI_LEDGER_ADMIN_PASS
LEDGER_HOSTNAMEAPI_HOSTNAME
LEDGER_PORTAPI_PORT + 1
LEDGER_PUBLIC_PORTCLIENT_PORT
LEDGER_PUBLIC_PATHledger
LEDGER_CURRENCY_CODEUSD
LEDGER_CURRENCY_SYMBOL$

Advanced Mode

ILP kit UI comes with an "advanced mode" for developers and advanced users. You can activate it with a hot-key: option+d on Mac or alt+d on Windows.

Architecture

ILP kit consists of:

  • a Five Bells ledger (the 'ledger' process)
  • a Node.js (developed on v7.7.1) 'api' process, containing a connector and SPSP receivers
  • html+js+css statics, built using React
  • a 'server' process which serves the statics on example.com, the ledger on example.com/ledger, the api on example.com/api
  • an nginx instance in front the server process, which handles https termination
Backend (REST API)

The backend is responsible for communicating with the ILP ledger, creating accounts, sending payments and keeping the payment history.

API docs
How it works

The wallet implements SPSP for initiating and receiving payments.

This means it announces an SPSP address of the form user@host, and links this to two things:

  • an ILP address (roughly of the form g.us.usd.host.user, but this is not enforced, and your ILP address is not a unique string)
  • a cryptographic key pair, used indirectly to generate and fulfill crypto conditions.

The connector component can peer with other connectors on the Interledger, and basically acts as a router.

The ledger can handle payments that are conditional on a cryptographic condition, and that's where the power of ILP lies. When you send money to an account on another ledger, your connector conditionally pays the next connector, all the way to the receiving connector. The receiving connector adds a conditional payment to the receiving ledger, and the receiver (which lives in the API component) fulfills the crypto condition, using (a key which from) the receiver's public key.

Only the receiver of an Interledger payment can fulfill the crypto condition, and that's why you can be sure that the intermediate hops will all roll back if the money cannot be safely delivered.

Webfinger

Webfinger is used to lookup account/user identifiers.

Example request

curl -X GET
https://wallet.example/.well-known/webfinger?resource=acct:[email protected]

Example response

HTTP/1.1 200 OK
{
  "subject": "acct:[email protected]",
  "links": [
    {
      "rel": "https://interledger.org/rel/ledgerUri",
      "href": "https://red.ilpdemo.org/ledger"
    },
    {
      "rel": "https://interledger.org/rel/socketIOUri",
      "href": "https://red.ilpdemo.org/api/socket.io"
    },
    {
      "rel": "https://interledger.org/rel/ledgerAccount",
      "href": "https://red.ilpdemo.org/ledger/accounts/alice"
    },
    {
      "rel": "https://interledger.org/rel/sender/payment",
      "href": "https://red.ilpdemo.org/api/payments"
    },
    {
      "rel": "https://interledger.org/rel/sender/pathfind",
      "href": "https://red.ilpdemo.org/api/payments/findPath"
    },
    {
      "rel": "https://interledger.org/rel/spsp/v2",
      "href": "https://red.ilpdemo.org/api/spsp/alice"
    }
  ]
}
Client

The client is a web app built on React that implements user signup/signin, sending payments and payment history.

Client state management is handled by Redux.

Theme Customization

npm install generates a src/theme/variables.scss which contains the theme colors. You can manually edit it.

Database has two tables: Users and Payments.

Tag summary

Content type

Image

Digest

Size

467.6 MB

Last updated

about 9 years ago

docker pull michielbdejong/ilp-kit