Skip to main content

Consensus mechanism for Truthcoin

Project description

pyconsensus is a Python implementation of the Truthcoin consensus mechanism, originally invented by Paul Sztorc:


The easiest way to install pyconsensus is using pip:

$ pip install pyconsensus

To upgrade your pyconsensus installation, use:

$ pip install --upgrade --no-deps pyconsensus


To use pyconsensus, import the Oracle class:

from pyconsensus import Oracle

# Example vote matrix:
#   - each row represents a voter
#   - each column represents a decision in a prediction market
my_votes = [[1, 1, 0, 0],
            [1, 0, 0, 0],
            [1, 1, 0, 0],
            [1, 1, 1, 0],
            [0, 0, 1, 1],
            [0, 0, 1, 1]]
my_decision_bounds = [
    {"scaled": True, "min": 0.1, "max": 0.5},
    {"scaled": True, "min": 0.2, "max": 0.7},
    {"scaled": False, "min": 0, "max": 1},
    {"scaled": False, "min": 0, "max": 1},

oracle = Oracle(votes=my_votes, decision_bounds=my_decision_bounds)


Unit tests are in the test/ directory.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyconsensus, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size pyconsensus-0.2.1.tar.gz (20.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page