opentimestamps-client OpenTimestamps client

我要开发同款
匿名用户2021年12月24日
23阅读
开发技术Python
所属分类Web3、开源货币/比特币
授权协议View license

作品详情

OpenTimestampsClient

Command-linetooltocreateandvalidatetimestampproofswiththeOpenTimestampsprotocol,usingtheBitcoinblockchainasatimestampnotary.AdditionallythispackageprovidestimestampingofPGPsignedGitcommits,andverificationoftimestampsforbothGitcommitsasawhole,andindividualfileswithinaGitrepository.

RequirementsPython3

WhileOpenTimestampscancreatetimestampswithoutalocalBitcoinnode,toverifytimestampsyouneedalocalBitcoinCorenode(aprunednodeisfine).

Installation

EitherviaPyPi:

$pip3installopentimestamps-client

orfromsource:

$python3setup.pyinstall

OnDebian(Stretch)youcaninstallthenecessarysystemdependencieswith:

sudoapt-getinstallpython3python3-devpython3-pippython3-setuptoolspython3-wheelUsage

Creatingatimestamp:

$otsstampREADME.mdSubmittingtoremotecalendarhttps://a.pool.opentimestamps.orgSubmittingtoremotecalendarhttps://b.pool.opentimestamps.orgSubmittingtoremotecalendarhttps://a.pool.eternitywall.com

You'llseethatREADME.md.otshasbeencreatedwiththeaidofthreeremotecalendars.Wecan'tverifyitimmediatelyhowever:

$otsverifyREADME.md.otsAssumingtargetfilenameis'README.md'Calendarhttps://alice.btc.calendar.opentimestamps.org:PendingconfirmationinBitcoinblockchainCalendarhttps://bob.btc.calendar.opentimestamps.org:PendingconfirmationinBitcoinblockchainCalendarhttps://finney.calendar.eternitywall.com:PendingconfirmationinBitcoinblockchain

IttakesafewhoursforthetimestamptogetconfirmedbytheBitcoinblockchain;we'renotdoingonetransactionpertimestamp.

However,theclientdoescomewithanumberofexampletimestampswhichyoucantryverifyingimmediately.Here'sacompletetimestampthatcanbeverifiedlocally:

$otsverifyexamples/hello-world.txt.otsAssumingtargetfilenameis'examples/hello-world.txt'Success!Bitcoinblock358391attestsexistenceasof2015-05-28CEST

YoucanspecifyJSON-RPCcredentials(USERandPASS)foralocalbitcoinnodelikeso:

$ots--bitcoin-nodehttps://USER:PASS@127.0.0.1:8332/verifyexamples/hello-world.txt.otsAssumingtargetfilenameis'examples/hello-world.txt'Success!Bitcoinblock358391attestsexistenceasof2015-05-28CEST

Incompletetimestampsareonesthatrequiretheassistanceofaremotecalendartoverify;thecalendarprovidesthepathtotheBitcoinblockheader:

$otsverifyexamples/incomplete.txt.otsAssumingtargetfilenameis'examples/incomplete.txt'Got1newattestation(s)fromhttps://alice.btc.calendar.opentimestamps.orgSuccess!Bitcoinblock428648attestsexistenceasof2016-09-07CEST

Theclientmaintainsacacheoftimestampsitobtainsfromremotecalendars,soifyouverifythesamefileagainit'llusethecache:

$otsverifyexamples/incomplete.txt.otsAssumingtargetfilenameis'examples/incomplete.txt'Got1attestation(s)fromcacheSuccess!Bitcoinblock428648attestsexistenceasof2016-09-07CEST

Youcanalsoupgradeanincompletetimestamp,whichaddsthepathtotheBitcoinblockchaintothetimestampitself:

$otsupgradeexamples/incomplete.txt.otsGot1attestation(s)fromcacheSuccess!Timestampiscomplete

Finally,youcangetinformationonatimestamp,includingtheactualcommitmentoperationsandattestationsinit:

$otsinfoexamples/two-calendars.txt.otsFilesha256hash:efaa174f68e59705757460f4f7d204bd2b535cfd194d9d945418732129404ddbTimestamp:append839037eef449dec6dac322ca97347c45sha256->append6b4023b6edd3a0eeeb09e5d718723b9esha256prepend57d46515appendeadd66b1688d5574verifyPendingAttestation('https://alice.btc.calendar.opentimestamps.org')->appenda3ad701ef9f10535a84968b5a99d8580sha256prepend57d46516append647b90ea1b270a97verifyPendingAttestation('https://bob.btc.calendar.opentimestamps.org')TimestampingandVerifyingPGPSignedGitCommits

Seedoc/git-integration.md

PrivacySecurity

Timestampinginherentlyrecordspotentiallyrevealingmetadata:thecurrenttime.Ifyoucreatemultipletimestampsinclosesuccessionit'squitelikelythatanadversarywillbeabletolinkthosetimestampsasrelatedsimplyonthebasisofwhentheywerecreated;ifyoumakeuseofthetimestampmultiplefilesinonecommandfunctionality(./otsstamp<file1><file2>...<fileN>)mostofthecommitmentoperationsinthetimestampsthemselveswillbeidentical,providinganadversaryverystrongevidencethatthefilesweretimestampedbythesameperson.Finally,theRESTAPIusedtocommunicatewithremotecalendarsdoesn'tcurrentlyattempttoprovideanyprivacy,althoughitcouldbemodifiedtodosointhefuture(e.g.withprefixfilters).

Filecontentsareprotectedwithnonces:aremotecalendarlearnsnothingaboutthecontentsofanythingyoutimestampasitonlyeverreceivesanopaqueandmeaninglessdigest.Equally,ifmultiplefilesaretimestampedatonce,eachfileisprotectedbyanindividualnonce;thetimestampforonefilerevealsnothingaboutthecontentsofanotherfiletimestampedatthesametime.

CompatibilityExpectations

OpenTimestampsisalphasoftware,soit'spossiblethattimestampformatsmayhavetochangeinthefutureinnon-backward-compatibleways.Howeveritwillalmostcertainlybepossibletowriteconversiontoolsforanynon-backwards-compatiblechanges.

It'sverylikelythattheRESTprotocolusedtocommunicatewithremotecalendarswillchange,includinginbackwardsincompatibleways.Ifthishappensyou'lljustneedtoupgradeyourclient;existingtimestampswillbeunaffected.

CalendarMirroring

Asashort-termmeasure,therawcalendardataforthethreecalendarserversinoperationatthistimecanbedownloadeddirectly.Seethecontrib/calendar-mirror.shscriptfordetails.

Development

Usethesetuptoolsdevelopmentmode:

python3setup.pydevelop--userKnownIssues

Needunittestsfortheclient.

Gittreere-hashingsupportfailsoncertainfilenameswithinvalidunicodeencodings;thisappearstobeduetobugsintheunderlyingGitPythonlibrary.Asawork-around,youmayfindtheconvmvtoolusefultofindandrenamethesefiles.

GitannexsupportonlyworkswiththeSHA256andSHA256Ebackends.

ErrorsintheBitcoinRPCcommunicationaren'thandledinauser-friendlyway.

NotallPythonplatformscheckSSLcertificatescorrectly.Thismeansthatonsomeplatforms,itwouldbepossibleforaMITMattackertointerceptHTTPSconnectionstoremotecalendars.Thatsaid,itshouldn'tbepossibleforsuchanattackertodoanythingworsethangiveusatimestampthatfailsvalidation,aneasilyfixedproblem.

ots-git-gpg-wrapperdoesn'tyetcheckforyouifthetimestamponthegitcommitmakessense.

bitcoinpackagecancauseissues,withotsconfusingitwiththerequiredpython-bitcoinlibpackage.AsymptomofthisissueisthemessageAttributeError:module'bitcoin'hasnoattribute'SelectParams'orJSONDecodeError("Expectingvalue",s,err.value)fromNone.Toremedythisissue,onemustdothefollowing:

#uninstallthepackagesthroughpippip3uninstallbitcoinpython-bitcoinlib#removethebitcoindirectorymanuallyfromyourdist-packagesfolderrm-rf/usr/local/lib/python3.5/dist-packages/bitcoin#reinstalltherequiredpackagepip3installpython-bitcoinlib
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论