PROOF OF TOSS is a decentralized betting ecosystem that is aimed to modernize and change the betting industry. Our platform allows anyone to create wagers, bet and judge – all for the purpose of winning TOSS tokens. What sets PROOF OF TOSS apart from the rest, is that we also cater to existing Bookmakers and other “players” of the betting industry.
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
build_archive/contracts EventBaseV1.json for new blockchain Oct 17, 2018
config Merge branch 'master' into feature/36643_play_page_layout Jun 27, 2018
contracts 36550 1. Multiple EventBase updates indexing. 2. app.js refactoring t… Jun 21, 2018
docker/app feature/36392_docker May 29, 2018
hooks 36731 add shared git hooks. eslink hooks Jul 3, 2018
migrations 36550 1. Multiple EventBase updates indexing. 2. app.js refactoring t… Jun 21, 2018
public feature/36579_faq Jun 28, 2018
scripts [ci skip] hotfix/faucet_encrease_gasprice Jul 6, 2018
src [ci skip] Merge branch 'master' into dev Aug 14, 2018
test 36550 fixed unit test Jun 21, 2018
.babelrc 34966 fixed MR comments, implement balance refreshing, fixed send dialog Jan 24, 2018
.dockerignore feature/36392_docker May 29, 2018
.gitignore Merge branch 'master' into feature/36643_play_page_layout Jun 27, 2018
.gitlab-ci.yml 36678 add dev branch Jun 28, 2018
.gitmodules feature/36364_correction_readme May 25, 2018
HDWalletProvider.js fake_events_and_bets_ropsten Jun 22, 2018 36678_update_Readme Jun 29, 2018
build_dir.json Hotfix #36564: removed duplicate param base_build_dir from config.jso… Jun 14, 2018
docker-compose.yml feature/36392_docker May 29, 2018
elasticsearch.yml added site skeleton with some exmaples based on truffle-react-box Jan 2, 2018
kibana.yml added site skeleton with some exmaples based on truffle-react-box Jan 2, 2018
package-lock.json Merge branch 'master' into dev Oct 17, 2018
package.json Merge branch 'master' into dev Oct 17, 2018 updated Jun 27, 2018
truffle.js.example updated truffle.js.example Jun 27, 2018 36678 add dev branch Jun 28, 2018


  • Solidity smart-contracts
    • developed using truffle truffle 4.x, solc >= 0.4.22
    • store data in compressed cost-effective format
    • public MVP will be deployed to RSK testnet blockchain. Product is planned to work on RSK mainnet blockchain. RSK ( is a smart contract platform with a 2-way peg to Bitcoin. RSK´s blockchain is secured by merge-mining, which means that it can achieve the same security as Bitcoin in terms of double-spend prevention and settlement finality.
  • Elasticsearch index
    • stores data from blockchain in a suitable format for effective filtration and sorting
  • Web-app
    • developed with react and redux reactjs redux
    • using web3 for interaction with smart-contracts
    • loads data from elasticsearch elasticsearch-js
  • Data indexer
    • developed on node.js
    • listens for blockchain events, fetching data from blockchain and sends it to elasticsearch

Git repository branches

  • master – contains official MVP releases
  • dev – contains all MVP features
  • v1/dev – contains all version 1 features

Project structure

build – truffle artifacts directory
build_webpack – built web-app
config – build configuration
contracts – smart contracts dir
    Main.sol, EventBase.sol, Event.sol, Whitelist.sol - project contracts
    installed_contracts – third party contracts
    test – contracts used in unit tests
    token-sale-contracts – TOSS Token smart contracts (git submodule
    rsk – docker config for RSK node
    app – docker config for app node (app watching blockchain events and indexing them to elasticsearch)
migrations – truffle migrations
public – web-app entry point
    app.js – app watching blockchain events and indexing them to elasticsearch
    build.js – build web-app with webpack
    create_es_index.js – creates elasticsearch indeces for events and bets
    start.js – starts dev server
    sync_whitelist.js – uploads list of privileged users to blockchain
    App.js – web-app common layout (header, footer)
    index.js – entry point, redux initialization
    reducer.js – redux root reducer
    store.js – redux store
    actions – redux actions dir
    reducers – redux sub-reducers
    data – app configuration
    util – reusable logic
    components, pages – react components
test – unit tests

Smart contracts


ERC20 token inheriting FreezingToken, MintableToken, MigratableToken, BurnableToken contracts from open-zeppelin lib. Token has app-specific logic:

  • token blocking. Methods blockTokens, unblockTokens, allowBlocking, grantToAllowBlocking are needed for operator's pledge logic
  • ERC223-like token transfer with additional data (transferToContract). When send tokens with transferToContract receiving contract must implement tokenFallback method. We do not implement ERC223 fully because the token needs to be compatible with existing smart-contracts using ERC20 standard and not implementing tokenFallback method.


Whitelist contract stores list of privileged wallets from which is allowed to create and resolve events. Used in Main and EventBase contracts respectively.


Creates new events.


All event logic (bets, results resolving, prize withdrawal) is implemented here


Event smart contract creates for each event and serves as a blockchain data store for those events. To minimize gas usage Event smart contract contains no logic. All method calls are proxied to EventBase instance with delegatecall opcode.

How to install

Clone this repository:

$ git clone proof-of-toss

TOSS Token smart contracts are hosting in a separate repository ( and linked to contracts/token-sale-contracts via git submodule system. To initialize submodules run in the project folder:

$ git submodule init
$ git submodule update 

This project use solc (Solidity compiler) and truffle framework.

To install them execute:

$ npm install -g solc truffle@4 babel-cli

Project also required connection to rsk blockchain. For development it is possible to use testrpc:

$ npm install -g ganache-cli
  1. After that go to the project root directory and install dependencies:

    $ npm install
  2. Copy truffle.js.example to truffle.js

  3. Copy src/data/config.json.dist to src/data/config.json

  4. Launch ganache-cli:

    $ ganache-cli

    You should see something like this:

    Ganache CLI v6.0.3 (ganache-core: 2.0.2)
    Available Accounts
    (0) 0xcf917a1f7b9b71aa3e3046ec6969e4b210179521
    (1) 0x369d6ef29adc68d4999e98edc07ecd65563d0945
    (2) 0xec0705eb54789adf51627b8f0331bc657882eae8
    (3) 0xaf1b1e1524d573eba5dae315c4e4972596b3de23
    Private Keys
    (0) da8790fd91894aac54f122810c7e940689eba4248eb82f672d69527451b13ef6
    (1) 0272b60d17adb4d0df63b011b9d4fa6fbb6728f14e300807935002dff9b3fd35
    (2) 08f2311c2b5dfd63e1486c400b8f43c1f50cd6d64d3d7d0a4dbf87b92c5cbc4e
    (3) 0e785b00dde0d36b79c6e0003d3b44dbb88a29fe835b10217ab690a066988197

    By default ganache-cli creates 10 accounts. It is possible to use --account option to use specific addresses. If you will do this create at least 4 accounts. It is necessary for contracts tests.

  5. Install metamask extension in a browser and import first private key from the previous step

  6. Compile and deploy contracts:

    $ truffle compile
    $ truffle --network test migrate
  7. Launch server:

    $ npm run start
  8. For accessing admin pages account must be whitelisted. Whitelist is located at src/data/config.json Add address from 4 step to the whitelist key. To synchronize white list with blockchain run:

    $ npm run sync_whitelist

    It should be executed after each deploy.

  9. TOSS Token is paused by default. To get site working the Main smart contract should be unpaused and granted to unpause other contracts. There is a sample script [ scripts/prepare_demo_token.js ] to do this task.

    $ babel-node scripts/prepare_demo_token.js

    Run it after each deploy.

After that open localhost:3000 in a browser


It is necessary to use metamask browser extension to work with a wallet. It is possible to use original metamask, but there are few problems with it:

  • Invalid currency name. Should be SBTC
  • Invalid exchange rate

This problems solved in our fork of the original metamask.

Elastic search

We are using elastic search to store some information in it. It is necessary to install babel cli before. Then execute this command to launch this script:

$ ./node_modules/babel-cli/bin/babel-node.js scripts/app.js

This script will handle blockchain events and save them in elastic search

How to execute tests in testrpc blockchain

Solidity contracts tests

$ truffle --network test test

How to build frontend

To create html and js files execute:

$ npm run build

After that files will be in the ./build_webpack folder.