创建和验证opentimestamps证明的命令行工具
opentimestamps-client的Python项目详细描述
打开时间戳客户端
用于创建和验证时间戳证明的命令行工具 OpenTimestamps协议,使用比特币区块链作为时间戳公证人。 此外,这个包还提供了pgp签名git提交的时间戳,以及 验证整个git提交和单个git提交的时间戳 Git存储库中的文件。
要求
- 蟒蛇3
虽然opentimestamps可以在不使用本地比特币节点的情况下创建时间戳,但是 确认您需要一个本地比特币核心节点的时间戳(修剪后的节点可以)。
安装
通过PYPI:
$ pip3 install opentimestamps-client
或来源:
$ python3 setup.py install
在Debian(Stretch)上,您可以使用以下命令安装必要的系统依赖项:
sudo apt-get install python3 python3-dev python3-pip python3-setuptools python3-wheel
用法
创建时间戳:
$ ots stamp README.md
Submitting to remote calendar https://a.pool.opentimestamps.org
Submitting to remote calendar https://b.pool.opentimestamps.org
Submitting to remote calendar https://a.pool.eternitywall.com
您将看到,readme.md.ots
是在三个遥控器的帮助下创建的
日历。我们无法立即验证:
$ ots verify README.md.ots
Assuming target filename is 'README.md'
Calendar https://alice.btc.calendar.opentimestamps.org: Pending confirmation in Bitcoin blockchain
Calendar https://bob.btc.calendar.opentimestamps.org: Pending confirmation in Bitcoin blockchain
Calendar https://finney.calendar.eternitywall.com: Pending confirmation in Bitcoin blockchain
时间戳需要几个小时才能被比特币确认 区块链;我们不是每个时间戳执行一个事务。
但是,客户机确实附带了许多示例时间戳,您可以 请立即尝试验证。这里有一个完整的时间戳可以验证 在本地:< >
$ ots verify examples/hello-world.txt.ots
Assuming target filename is 'examples/hello-world.txt'
Success! Bitcoin block 358391 attests existence as of 2015-05-28 CEST
您可以为本地比特币节点指定json-rpc凭据(user
和pass
),如下所示:
$ ots --bitcoin-node http://USER:PASS@127.0.0.1:8332/ verify examples/hello-world.txt.ots
Assuming target filename is 'examples/hello-world.txt'
Success! Bitcoin block 358391 attests existence as of 2015-05-28 CEST
不完整的时间戳需要远程日历的帮助 要验证;日历提供到比特币块头的路径:
$ ots verify examples/incomplete.txt.ots
Assuming target filename is 'examples/incomplete.txt'
Got 1 new attestation(s) from https://alice.btc.calendar.opentimestamps.org
Success! Bitcoin block 428648 attests existence as of 2016-09-07 CEST
客户端维护从远程日历获取的时间戳的缓存,因此 如果再次验证同一文件,它将使用缓存:
$ ots verify examples/incomplete.txt.ots
Assuming target filename is 'examples/incomplete.txt'
Got 1 attestation(s) from cache
Success! Bitcoin block 428648 attests existence as of 2016-09-07 CEST
您还可以升级不完整的时间戳,它将路径添加到 比特币区块链到时间戳本身:
$ pip3 install opentimestamps-client
0
最后,您可以获得有关时间戳的信息,包括 IT中的承诺操作和证明:
$ pip3 install opentimestamps-client
1
对pgp签名的git提交进行时间戳和验证
参见doc/git integration.md
隐私安全
内在记录的时间戳可能揭示元数据:当前
时间。如果连续创建多个时间戳,则很可能
对手将能够将这些时间戳链接到
创建时间的基础;如果使用时间戳倍数
一个命令功能中的文件(/ots stamp<;file1>;<;file2>;…<;文件n>;
)
时间戳中的大多数承诺操作本身将是
相同,提供了一个有力的证据证明这些档案
同一个人的时间戳。最后,使用rest api与
远程日历当前不试图提供任何隐私,尽管
可以在将来进行修改(例如,使用前缀过滤器)。
文件内容用nonce保护:远程日历什么也学不到 关于任何时间戳的内容,因为它只接收到不透明的 无意义的消化。同样,如果同时为多个文件加上时间戳, 每个文件都受单个nonce的保护;一个文件的时间戳 不显示另一个文件的内容(时间戳相同) 时间,
兼容性要求
opentimestamps是alpha软件,因此时间戳格式可能 必须在未来以不向后兼容的方式进行更改。无论如何 几乎可以肯定的是,可以为任何 不向后兼容的更改。
很可能rest协议用于与远程 日历将更改,包括以向后不兼容的方式更改。如果这样 碰巧你只需要升级你的客户端;现有的时间戳将是 不受影响。
日历镜像
作为短期措施,三个日历服务器的原始日历数据
在OP中此时操作可以直接下载。见
有关详细信息,请使用contrib/calendar mirror.sh
脚本。
开发
使用setuptools开发模式:
$ pip3 install opentimestamps-client
2
已知问题
需要对客户端进行单元测试。
对具有无效Unicode的某些文件名的Git树重新散列支持失败 编码;这似乎是由于底层gitpython中的错误造成的。 图书馆。作为解决方法,您可能会发现
convmv
工具对于查找和 重命名这些文件。Git附件支持仅适用于SHA256和SHA256E后端。
比特币rpc通信中的错误没有在用户友好的环境中处理 方式:
并非所有python平台都正确检查ssl证书。这意味着 在某些平台上,mitm攻击者可能会拦截https 连接到远程日历。也就是说,这样的事情是不可能的 一个攻击者做任何比给我们一个失败的时间戳更糟糕的事情 验证,一个容易解决的问题。
ots git gpg包装器还没有检查git提交的时间戳 有道理。
比特币
包可能导致问题,OTS将其与 必需python bitconilib
package。此问题的症状是 消息attribute err or:module'bitcoin'没有来自none的属性'selectparams'
或jsondecodeerror("期望值",s,err.value)。要解决此问题,必须执行以下操作:
$ pip3 install opentimestamps-client
3