Bridge Server

The Origin Bridge Server handles the server side of identity attestations.

Most traditional web APIs, such as those from Facebook and Twitter, can only interact with a centralized server located at a specific domain. A decentralized application, like our Origin Demo DApp, doesn’t need to “live” on a particular server. (In fact, you can load it from any IPFS gateway!) Thus, in order for the DApp to use an “old world” API, it needs a Bridge Server.

Origin hosts a Bridge Server, but in the true spirit of decentralization, anyone is free to clone our open source code and host their own.

You can connect to and use our hosted Bridge Server at The staging branch of this repo is available at and the master branch of this repo is available at

DApps can connect to the Bridge Server of their choosing to handle tasks like issuing identity attestations and decryptying data that is returned from third-party services like Civic. We also need proxies for fetching public data from services like Facebook and Twitter which require authentication keys.

API documentation

See the Attestation API

One-time Setup


Mac OS specifics

Install build tools packages:

brew install automake autoconf libtool

Set Up A Virtual Environment

git clone && cd origin/origin-bridge

python3 -m venv ve

source ve/bin/activate

pip install -r requirements.txt

Clone the Starter Configuration Variables

cp dev.env .env

Adjust the values in .env now and in the future to suit your local environment.

For EnvKey support, set ENVKEY to the key of the generated local development key.

Flask secret

Set FLASK_SECRET_KEY to your unique Flask secret key. Use a unique Flask secret key per environment. Flask suggests that python -c "import os; print(os.urandom(24))" is a perfectly reasonable way to generate a secret key.


Set up your DATABASE_URL to point to where you local database is or will be.

Identity attestation

Attestation account used by the bridge server to sign attestation:

Production configuration

When deploying to a production system, make sure to set appropriate environment variables, in your .env file, notably

PROJECTPATH=/app  # For Heroku

Set Up Your Database

createdb <db-name>  # Anything you want, perhaps bridge-server

Make sure the DB name you used is indicated in your DATABASE_URL in the .env file. Example: DATABASE_URL=postgresql://localhost:5432/bridge-server

# Applies all migrations to make the DB current. Works even on an empty database.
# Run this in the virtual environment you set up above. flask db upgrade

Every Time You Develop

Set Up Your Shell

cd /path/to/environment/project
source ../bin/activate

It’s handy to save bash alias for this. Consider adding in your ~/.bash_profile:

alias myenv='cd /path/to/environment/project && source ../bin/activate && export PYTHONPATH=.'

Run the Server

# Run this in the virtual environment you set up above.

This starts a development server on localhost:5000 by default.

Run the Tests

Throughout the development process and before committing or deploying, run:

pytest --flakes --codestyle

Run individual test files simply as:

pytest path/to/

Run a single test case, or an individual test, using:

pytest path/to/

Problems? Hit us up in the engineering channel on Discord if you need help.

Code Formatting

We are using pycodestyle to enforce code formatting. The tests will throw errors when code is not formatted properly, when using the --codestyle option.

To automatically format the code:

autopep8 --in-place --recursive --a --a .


Please send your pull requests to the develop branch. Everything on master should be live at

Database changes

We use Flask Migrate to handle database revisions. If you make changes to the database, use flask db migrate

to generate the required migration file. Rename it to add a description of the change after the underscore. Then run flask db upgrade

to apply your migration to your local database, then test your changes before committing.

Heroku Deploy

To deploy a development copy of the site on Heroku, just choose which branch you would like to use and follow the instructions:

Master branch
Develop branch
(active development)
Deploy Deploy

Heroku will prompt you to set config variables. At a minium, you must set these three:

Config Value
FLASK_SECRET_KEY (make something up)
HOST (domain name of your dev heroku app)

See the dev.env file for a full list of other optional config variables.

We use following buildpacks:

heroku buildpacks:set heroku/python