Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

ICO Bot with Web server

ICO Bot with Web server

This bot allows to run an ICO on Byteball network. It accepts Bytes, BTC, and Ether from users and sends back the new tokens in exchange. You set the prices relative to USD or other fiat or crypto currencies.


Install node.js, clone the repository, then say

npm install


Before the ICO

First, you need to sync your node

node sync.js 2>errlog

It will take about 3 days on SSD.

The bot is based on headless wallet, see its documentation too to understand what options you have. Also see the documentation of the core library. Note that the default config enables TOR for security reasons, you need to have a TOR service running on your machine or disable TOR in conf.

Edit conf.js or conf.json to describe the properties of your token and token sale. See the comments in conf.js which describe the options. Some of the most important options:

  • bRequireRealName: to require KYC.
  • bRequireNonUs: to allow only non-US investors.
  • bRequireAccredited: to allow only accredited investors.
  • rulesOfDistributionOfTokens: real-time for sending tokens immediately after the payment is confirmed, one-time for collecting investments during the ICO, and then sending tokens to all investors in one go when the ICO is over.
  • totalTokens: total number of smallest indivisible units (pennies) of the newly issued token.
  • tokenDisplayDecimals: number of decimals in user-displayed amounts of the token. Total supply in user-displayed units is totalTokens / 10^tokenDisplayDecimals.
  • assocPrices: prices of your token depending on the payment currency. The prices can be pegged to another currency, such as USD, in this case the prices in payment currency are periodically updated using exchange feeds. Note that the prices are per smallest indivisible unit of your token, they are different from prices per user-displayed token by tokenDisplayDecimals decimal places.
  • startDate and endDate: start and end dates of the crowdsale.
  • accumulationAddresses: all collected funds are periodically swept to these addresses (one address per currency), it is recommended that these addresses are better secured by being multisig or offline.
  • arrAdminAddresses: array of device addresses of admins. Only admins can change the price of your token by giving commands to the bot in chat interface (see below). If you don't want to change the price via chat, leave this field empty.
  • socksHost and socksPort: for better security, it is recommended to configure your bot to use TOR, so the rest of the network won't know your real IP. If you enable the web server, it is recommended to run it through a reverse proxy such as Cloudflare in order not to expose your IP address.

Chat with the bot, learn its address and pay a small amount (at least 10000 bytes) to fund asset issuance. You’ll see the balance only when it is fully synced.

When it is synced, cd to scripts and run

node issue_tokens.js

Don't kill the script too early and follow its output. It first creates a definition of the new token, waits for confirmation, then actually issues it.

Start the ICO

When issuance is done, run

node ico.js 2>errlog

Thereafter, you start the daemon only with ico.js. Now, the bot is ready to accept payments.

If you want to change the price of your token, you have two options:

  • ssh to your server and edit conf.json. Note that the price stored in conf.json is the price per smallest indivisible unit of your token, which is tokenDisplayDecimals decimal places different from the price displayed to the users. After editing the conf, restart your bot for the changes to take effect.
  • if you enabled arrAdminAddresses in your conf (see above), any of the admins can chat with the bot and change the price by sending set price <new price> command to the bot (type admin to be reminded about the format of the command). The price is per user-displayed token. Any changes are effective immediately without restart. This command edits your conf.json, so the new price is remembered even if the bot is restarted.

After the ICO

Cd to scripts. Burn the remaining tokens:

node burn_remaining_tokens.js

If you failed to reach your target, refund:

node refund.js

If you chose one-time distribution (rather than sending tokens back to users immediately after receiving the payment), run the distribution script:

node run_one_time_distribution.js



Install Bitcoin Core

To save space, it is recommended to run it in pruning mode. Edit your ~/.bitcoin/bitcoin.conf and add the line prune=550. The Bitcoin node will take only 5Gb disk space.

Set rpcuser and rpcpassword in your bitcoin.conf the same as in the conf (conf.js or conf.json) of this bot.


bitcoind -daemon



Install geth


Start dev node

$ geth --dev --mine --minerthreads 1 --ws --wsorigins "*" --wsapi "db,eth,net,web3,personal,miner"

Start Ropsten test network node

$ geth --testnet --ws --wsorigins "*" --wsapi "admin,db,eth,net,web3,personal" --cache=1024 --syncmode light

Start Main network node

$ geth --ws --wsorigins "*" --wsapi "admin,db,eth,net,web3,personal" --cache=1024 --syncmode light

Web server

A web server that shows stats of the ongoing ICO is started automatically when you start ico.js. The server listens on port 8080 by default. You usually want to proxy the web traffic to the server via nginx.

You can also start the server separately of ico.js:

node server/bin/www.js


Back End

Front End

Client Build

Please run one of these commands before starting the web server and after each update.

  • build (production)
npm run build
  • build and start listening changes (production)
npm run builder
  • build (development)
npm run build-dev
  • build and start listening changes (development)
npm run builder-dev

Server Start

NODE_ENV - production or development (development)

Server API

Use these endpoints if you want to display ICO data on another website or want to fetch the data from another server.

List of transactions

URL : /api/transactions

Method : GET

Query parameters :

  • page=[integer]
  • limit=[integer]
    min=1, max=100
  • sort=[string]
    one of ['currency_amount', 'creation_date']
  • filter_stable=[string]
    one of ['all', 'true', 'false']
  • filter_currency=[string]
    one of ['all', 'GBYTE', 'BTC', 'ETH', 'USDT']
  • filter_bb_address=[string]
  • filter_receiving_address=[string]
  • filter_txid=[string]

Response :

  "rows": [{
    "txid": [string],
    "receiving_address": [string],
    "byteball_address": [string],
    "currency": [string],
    "currency_amount": [decimal],
    "usd_amount": [decimal],
    "tokens": [integer],
    "stable": [integer],
    "creation_date": [string]
  }, ...],
  "total": [integer]


URL : /api/statistic

Method : GET

Query parameters :

  • filter_currency=[string]
    one of ['all', 'GBYTE', 'BTC', 'ETH', 'USDT']
  • filter_date_from=[string]
  • filter_date_to=[string]

Response :

  "rows": [{
    "date": [string], 
    "count": [integer],
    "sum": [decimal],
    "usd_sum": [decimal]
  }, ...]

Common data

URL : /api/common

Method : GET

Query parameters : -

Response :

  "count_transactions": [integer],
  "users_all": [integer],
  "users_paid": [integer],
  "total_sum": [decimal]

Init data

URL : /api/init

Method : GET

Query parameters : -

Response :

  "tokenName": [string]


A bot for running an ICO







No releases published


No packages published

Contributors 4