Skip to main content

pyroughtime

License: GPL v3

An experimental Roughtime client and server implementation in Python 3 using the IETF draft at https://tools.ietf.org/html/draft-ietf-ntp-roughtime-07.

Dependencies

Installing on Linux

If you run into an error like "This environment is externally managed", you can create a venv and install the dependencies with:

$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt-get update
$ sudo apt-get install -y python3.11 python3.11-dev python3.11-venv
$ python3.11 -m venv "venv"
$ source venv/bin/activate
$ pip install -r requirements.txt

Currently we have to use Python 3.11 or earlier due to ed25519 not being compatible with Python 3.12.

Example

From Python

from pyroughtime import RoughtimeClient, RoughtimeServer

serv, publ = RoughtimeServer.test_server()
cl = RoughtimeClient()
local_reply = cl.query("127.0.0.1", 2002, publ, newver=True)
google_reply = cl.query("roughtime.sandbox.google.com", 2002, "etPaaIxcBMY1oUeGpwvPMCJMwlRVNxv51KK/tktoJTQ=", newver=False)
serv.stop()
print(local_reply["prettytime"])
print(google_reply["prettytime"])

From CLI

$ ./pyroughtime.py -l ecosystem.json
Caesium:                  2020-12-23 16:26:16.765275 UTC (+/- 1.000  s) (RTT:  100.5 ms)
Chainpoint-Roughtime:     2020-12-23 16:26:16.973777 UTC (+/- 1.000  s) (RTT:  288.9 ms)
Cloudflare-Roughtime:     2020-12-23 16:26:17.267000 UTC (+/- 1.000  s) (RTT:    3.7 ms)
Google-Sandbox-Roughtime: 2020-12-23 16:26:17.307968 UTC (+/- 1.000  s) (RTT:   16.1 ms)
int08h-Roughtime:         2020-12-23 16:26:17.401888 UTC (+/- 1.000  s) (RTT:  177.0 ms)
roughtime.se:             2020-12-23 16:26:17.574568 UTC (+/- 0.000 ms) (RTT:   26.1 ms)
sjwheel:                  2020-12-23 16:26:17.747868 UTC (+/- 1.000  s) (RTT:  485.6 ms)
No inconsistent replies detected.
$ ./pyroughtime.py -s roughtime.se 2002 S3AzfZJ5CjSdkJ21ZJGbxqdYP/SoE8fXKY0+aicsehI=
2020-12-23 16:26:44.499730 UTC (+/- 0.000 ms) (RTT: 25.7 ms)
TAI - UTC = 37s
Leap events:
  2017-01-01
  2015-07-01
  2012-07-01
Delegate key validity start: 2020-12-22 00:00:00.000000
Delegate key validity end:   2022-01-01 00:00:00.000000
Merkle tree path length: 0

Releasing

REF: https://packaging.python.org/en/latest/tutorials/packaging-projects/

$ python3.11 -m pip install --upgrade build cffi twine
$ python3.11 -m build
# Test
$ python3.11 -m twine upload --repository testpypi dist/*
# Release
$ python3.11 -m twine upload dist/*

License

This project is licensed under the GNU General Public License - see the LICENSE file for details.

Release files for pyroughtime 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyroughtime 1.0.1
File Size Uploaded
pyroughtime-1.0.1.tar.gz 49.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyroughtime 1.0.1
File Interpreter ABI Platform
pyroughtime-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 87.3 kB

Release files / pyroughtime-1.0.1.tar.gz

Download URL pyroughtime-1.0.1.tar.gz
Size 49.9 kB
Tags Source
SHA-256 checksum
How to use checksums
915e9100a362d1b1876f71796dcd4cb4e4bbf1f5cab913292831c615bbe595b7
BLAKE2b-256 checksum
How to use checksums
eb12ab253b55fe66e81ead0bd185a9d4b179f6b292b9101fb07fa5162e0f940a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release files / pyroughtime-1.0.1-py3-none-any.whl

Download URL pyroughtime-1.0.1-py3-none-any.whl
Size 37.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c3026dcea6d98b94f654313194b8e636e3b1384f6670bc8252e85534df856fae
BLAKE2b-256 checksum
How to use checksums
f8468343d04eb169d84775a9678025b7eadee8ea2c13bd8241e46e44006fc3c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page