Giter Site home page Giter Site logo

obyte-merchant's Introduction

Chatbot merchant for Obyte network

This is a demo of a merchant that sells stuff in chat interface. If you want to sell something for bytes, blackbytes, or another asset, use this demo as a template.

A typical dialog with the chatbot looks like this:

Chat with merchant bot Chat with merchant bot

The merchant runs as a daemon and it doesn't hold any private keys. Instead, it knows only the extended public key and uses it to generate a new receiving address for each order. The addresses are automatically synced with the home wallet that actually holds the private key and can spend the money collected from sales.

Install

Install node.js, clone the repository, then say

npm install

Edit settings

Before you run the chatbot for the first time, edit these settings in conf.js or in conf.json in the app data folder:

  • hub: hub address without wss://, the default is obyte.org/bb.
  • deviceName: the name of your bot as seen in the chat interface.
  • permanent_paring_secret: the pairing secret used to authenticate pairing requests from customers. Since you want to chat with any potential buyer, it is not really a secret, so use something simple like 0000. The pairing secret is the part of the pairing code after #.
  • xPubKey: extended public key of the home wallet that is to collect funds. To find it out, open the GUI wallet, click gear icon -> Advanced -> Wallet Information, look for "Extended public keys", double-click to select it (it starts with "xpub"), copy and paste into the conf.
  • account: account number of the home wallet. Find it out like xPubKey above but look for "Account (BIP44)". The BIP44 derivation path of addresses is m/44'/0'/account'/is_change/address_index.
  • homeDeviceAddress: device address of the home wallet. Find it out by opening the Wallet, clicking menu button -> Global preferences, look for "Device address".

Run

node merchant.js > log &

The first time you run the bot, it will take a while to sync with the network.

While it syncs, add the merchant-specific table and indexes merchant.sql to its sqlite database by opening byteball.sqlite (located in app data folder) with any sqlite client (e.g. Command Line Shell For SQLite or SQLite browser) and executing the SQL in merchant.sql.

When the daemon starts, it prints out its pairing code (see it in the first lines of the log file). You should copy the code and put it on your site or send to any potential customers. This code allows anyone to connect with the chatbot and start a chat.

Before you can sell stuff, pair the chatbot with its home wallet (the wallet that collects revenue from sales). When you do this, a copy of your home wallet (without private keys) is created in the chatbot and synced with the home wallet. After this point, the chatbot is ready to accept payments, and you will immediately see the payments in your home wallet.

TOR

You can configure the merchant to connect to peers through TOR (see conf.socksHost, conf.socksPort, and conf.socksLocalDNS) in order to hide its IP address. Your customers don't need to run TOR.

Customize

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

obyte-merchant's People

Contributors

laurentiu-andronache avatar tonyofbyteball avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

obyte-merchant's Issues

Merchant with MySQL5.6? Cannot import merchant.sql

Are there instructions on setting this up in MySQL? With the sqlite db file keeps getting corrupt while trying to run the merchant.sql code on it. Please advise

More information when importing merchant.sql I get: "#1215 - Cannot add foreign key constraint "

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.