/obyte-hub

Hub for Byteball network

Primary LanguageJavaScriptMIT LicenseMIT

Hub for Obyte network

This is a node for Obyte network that serves as relay, plus facilitates exchange of end-to-end encrypted messages among devices connected to Obyte network. The hub does not hold any private keys and cannot send payments itself.

The messages are used for the following purposes:

  • Convey private payment information from payer to payee.
  • Exchange partially signed transactions when sending from a multisig address. One of the devices initiates a transaction and signs it with its private key, then it sends the partially signed transaction to the other devices that participate on the multisig address, the user(s) confirm the transaction on the other devices, they sign and return the signatures to the initiator.
  • Multilateral signing, when several addresses sign the same unit, e.g. when exchanging one asset for another, or when signing a contract. The exchange of messages is similar to the multisig scenario above.
  • Plain text chat between users, in particular, users can send each other the newly generated addresses to receive payments to.
  • Plain text chat with bots that offer a service and can receive or send payments. Faucet is an example of such bot.

The hub helps deliver such messages when the recipient is temporarily offline or is behind NAT. If the recipient is connected, the message is delivered immediately, otherwise it is stored and delivered as soon as the recipient connects to the hub. As soon as delivered, the message is deleted from the hub.

Since all messages are encrypted with the recipient's key, the hub cannot read them.

Users set their hub address in their wallet settings. The default hub is wss://obyte.org/bb but users can change it to your hub address.

Install

Install node.js, clone the repository, then say

npm install

Set up a proxy, such as nginx, to forward all websocket connections on a specific path to your daemon running the hub code. See example configuration for nginx in ocore documentation.

Run

node start.js > log &

Customize

If you want to change any defaults, refer to the documentation of ocore, the core Obyte library require()'d from here.

Push notifications

Android

To enable push notifications for Android users of your hub you need to create a new project in Google Console https://console.developers.google.com and add Google Cloud Messaging API. In your hub's conf (conf.js or conf.json) add these two settings copied from the Google Console:

  • pushApiProjectNumber: get it from settings (under dots menu in the upper right)
  • pushApiKey: your API key

iOS

You need a private key generated by Obyte Team for you, key_id and team_id to communicate with APNS servers on behalf of Obyte app bundle, email us for ones: byteball at obyte.org, then configure your hub (conf.js or conf.json) to enable notifications.

  • APNsAuthKey : full path to .p8 private key file or set it directly to content of this private key file
  • keyId : key id, it is encoded in .p8 file name (AuthKey_6M3W3J9D8Y.p8 => key id will be 6M3W3J9D8Y)
  • teamId : team id, we will provide it in email along with private key file