Git Product home page Git Product logo

opentimestamps-server's Introduction

OpenTimestamps Calendar Server

This package provides the otsd daemon, a calendar server which provides aggregation, Bitcoin timestamping, and remote calendar services for OpenTimestamps clients. You do not need to run a server to use the OpenTimestamps protocol - public servers exist that are free to use. That said, running a server locally can be useful for developers of OpenTimestamps protocol clients, particularly with a local Bitcoin node running in regtest mode.

Requirements

  • python-bitcoinlib v0.7.0
  • leveldb

Installation

You'll need a local Bitcoin node with a wallet with some funds in it; a pruned node is fine. While otsd is running the wallet should not be used for other purposes, as currently the Bitcoin timestamping functionality assumes that it has exclusive use of the wallet.

First make sure the following is in your ~/.bitcoin/bitcoin.conf file:

# Currently only password authentication is supported
rpcuser=CHANGETHIS
rpcpassword=CHANGETHIS

# Segwit is not yet supported
rpcserialversion=0

Install the requirements:

pip3 install -r requirements.txt

Create the calendar:

mkdir -p ~/.otsd/calendar/
echo "http://127.0.0.1:14788" > ~/.otsd/calendar/uri
dd if=/dev/random of=~/.otsd/calendar/hmac-key bs=32 count=1

The URI determines what is put into the URI field of pending attestations returned by this calendar server. For a server used for testing, the above is fine; for production usage the URI should be set to a stable URL that OpenTimestamps clients will be able to access indefinitely.

The HMAC key should be kept secret; it's meant to allow for last-ditch calendar recovery from untrusted sources, although only part of the functionality is implemented. See the source code for more details!

To actually run the server, run the otsd program. Proper daemonization isn't implemented yet, so otsd runs in the foreground. To run in testnet or regtest, use the --btc-testnet or --btc-regtest options. The OpenTimestamps protocol does not distinguish between mainnet, testnet, and regtest, so make sure you don't mix them up!

To use your calendar server, tell your OpenTimestamps client to connect to it:

ots stamp -c http://127.0.0.1:14788 -m 1 FILE

OpenTimestamps clients have a whitelist of calendars they'll connect to automatically; you'll need to manually add your new server to that whitelist to use it when upgrading or verifying:

ots -l http://127.0.0.1:14788 upgrade FILE.ots

If your server is running on testnet or regtest, make sure to tell your client what chain to use when verifying. For example, regtest:

ots --btc-regtest -l http://127.0.0.1:14788 upgrade FILE.ots

Tip: with regtest you can mine blocks on demand to make your timestamp confirm with the generate RPC command. For example, to mine ten blocks instantly:

bitcoin-cli generate 10

By default otsd binds to localhost, and isn't really designed to be exposed directly to the public. For production usage we recommend using a reverse proxy; an example configuration for nginx is provided under the contrib/nginx directory of this repo.

Unit tests

python3 -m unittest discover -v

opentimestamps-server's People

Contributors

petertodd avatar rcasatta avatar cloutier avatar ottoallmendinger avatar

Watchers

James Cloos avatar  avatar

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.