Try   HackMD

Streaming Data Payment Protocol draft

Architecture

Protocol

Test

1. Buyer HELLO to seller:

python buyer.py 127.0.0.1 8000

Output:

  • default-currency: default currency
  • list-of-currencies: list of support currency
  • menu: key: topic, value:unit price
  • payment-address: payment address
  • payment-granularity: buyer must pay every K
    data items
  • public-key: buyer public key
  • signature-required: 1 (true)
{u'default-currency': u'iota', u'list-of-currencies': [u'iota', u'bitcoin', u'ethereum'], u'menu': {u'gas': u'2', u'humidity': u'2', u'pressure': u'2', u'temperature': u'3'}, u'payment-address': u'ZYDUGVKLPYKBGCBZFSVXOQGHBGAOCWLFQOIZWPYJWBNHWXXY9BZCJMI9HCKTFWPIMADEXJEMQAHVSEJAC', u'payment-granularity': u'5', u'public-key': u'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEnqObfNtquVGLXtv9g5ffLAxGfXgfJc47A1yb1/w/FPAGX0z+39KhB9V/dUWU93Oc+Nx7AYQmD9FtEf3bhfCu2+Hl9cG0KNMcsFM6P3OIEwyFVYG/n6ecnptsfwldUJJgeTMtUp+AFWiLqn14ZxPjmslmtajK8PZ5ecJnfry5NVQhLVPpiG4xM79PYvW8TlYWcDxzYPn1KwiGCzRdFZ60OVkohmJ6o16Ri/sFIOCCva8xUOkw/IXxVx/czSOu9qzUlDzH9thhY1mHWIvJ0ILYTuBv5WnBdxhN5UI/d/2c7NOmz+JgVl4t1eEee0Nf71VS3XBQE9qGW3bSlfqiEz1f', u'signature-required': u'1'} Please enter the type of data, quantity and currency you wish to pay Data type:

2. buyer fill the menu:

  • Data type: gas or humidity or pressure or temperature
  • Quantity: counts of data buyed
  • Currency: iota or other currency
  • Order recorded in the distributed ledger: Order recorded
Please enter the type of data, quantity and currency you wish to pay Data type: humidity Quantity: 10 Currency: iota Order recorded in the distributed ledger: https://thetangle.org/bundle/WZQFNICNBLGJEDJEZPSCDAHQWAXM9YQXZJAAJJQJITRGBUPGWHJEXEPXEDLHTHGBDGPTYCTJKTCTOKCBZ -------Receiving Data Starts------- Data 1 received {u'data': u'/IrDL1nXZuuetvl1Tau+gnV1XKvQSZJL9L4mDnXfwaKeQpRvx+QMZ7K511lyN29g', u'message_type': u'DATA', u'signature': [11929560534543247824705246898853527222050295852590187998910019720874716336151215881763752892747682183396633603979655904068245756368341319201525473108132032346318477584263843719900302818235810061098344706729461732695315506311622760666025488342769298524991351348391924034766341148934675055701395020148121098756819857155654901380584577769369268517342906687351546809745563791345640308505910199239524776430185889099982394929385838906790980923972661797995040574546114554446036857036562457068885955997486880775732350630624760081429823113016076512365157829655132431089888235103416041705680372748047318658734565082349916970331L], u'verification': u''} None Data 2 received {u'data': u'nn2azqpfeA6K8K0VKoGcRMAQOGCJvoL2G1Hejm9aZqmJ+TczT4zh0BEdH8VDfc+J', u'message_type': u'DATA', u'signature': [9827546153945574243005483555850100348015373864930391581502652392651747843026781775374644153627768278636869617464140059693990061706470128232233534340214940952049345749349131200245698889691346286643790065837674499809101935571040303004918393783426740096942284988225942401990328354310391865588495671053817763937723195578403566937403730460177126572634763064418749753909021121246276265642126139573092569957259115064253438833741677230696866352706593324091571527124081040567475966835595597189808834496075092018252161406216150621480710355161187120780665424078702737659389837718074882438810670564541512202399080738604471076744L], u'verification': u''} None Data 3 received {u'data': u'xZaJLt8jdgI4gS8a6kPeQdeau+md+09gG7PINVJwXipbW4kBCXE5ZzaInJo8QnDF', u'message_type': u'DATA', u'signature': [14035799914243606778321700348278118483044064622625730543301861565881409172616292653029710242875659211709816383201724503127964122808670522831389211308986255685936935410295321620759728222811851278196080983216864203298271397422557804409269527979766541469215534051022914222429599465775307778872982996793959099039178402958531326829815408506512191099412555974558807442222247755368375543543976451737002195540249964031099028767406858824987981616416513721347264579508780707317912150630733923501559523062285399266616235030495873478547594994286264740025974778010052282366346666013254161722204426173473700197925456975989114502421L], u'verification': u''} None Data 4 received {u'data': u'ek2B1mXYVgGixotjVsSqKoIPxcJcxlEIaYcpianx3yRbfyV07CezUGh+Y7TDmGYa', u'message_type': u'DATA', u'signature': [12980384480338452543166227650641596688827782515015526422552092224524842206495456412184678556703764179489883517985744013282313234821486179921946209134859701208142360701475195813811755708206117002612791569850408887714648551057478021610889099802847168687604198062135167516560786941215853399377681971392150464342980367856600364268000673448056558554954975271456600226771957956372004904145581450488198177606903503450914641694287244875933494664352292178102085662478132029582806436854953426759623777006130588639910429599349125550473303832698700443465622805568106295149430887626197630619772961778396731965648170043720548260039L], u'verification': u''} None Data 5 received {u'data': u'BEDts5SV1Ay6gp/otpc1H2tgn6gDf+O2+jPQpYkLSNUJYpU6GWoYAvt/WMFaBzWO', u'message_type': u'DATA_INVOICE', u'signature': [18826232205477278555221019370975989514391788079691908397987647006842394633643330284390847532659934736759444368003163827144189001261552074613337387220020543415827512102255786836742434430703677530740686202557254725943998432571767538489163417060092501095831636977172528386187790947439953126359817942316385666030908132422528153206700757096167340011684801789530341619460480359162345808673193192894953820995495288295330528095137604114202129160699530736997407377636887528579798882697680712659710851934907903223244053893355880094665692710151240296653649388430067135470557143313644739821129602220765869143234117917685907493798L], u'verification': u'9URSVGPHCEIQQLCROMXNQRSSHJTDOILQDDLXXGEKPHWSRWAAFPPXOUNTDIYQGWIJULDHCPLLTJBVA9999'} None Payment made: https://thetangle.org/bundle/YDIBXAXKWJYRHLCDEXS9EQ9ZJXREDE9OP9HQLQL9EXOYJLQBAAFFEWSVIEHHIBABJ9BAYGEV9BBDPNEJW Data 6 received {u'data': u'++6KWiPKlV81xEaKY6jIzK97htpcYSfTnEWOjdeLg3XQMCTgfU3PfYgBB4RwHQpM', u'message_type': u'DATA', u'signature': [17972939785647796523776745201538141508373781831436421842715463332586727132842247482860266143364013168340509159248709834858621486515055283036107926595987407880664330019809633135947702507615676728579055811731461491905211583288872321623286055738702130326055712928064535484251209575131846615029339555339396633177298671496938747702051789065063048169533065515719885499430031956174896478582036137671540151779988072227829019313797994706724997582960184971811897709985294398771357236596940637604486075186118691441916159865747169681118714106779848212494732528966587682148133462546076136878191655983031451566860721746134677618694L], u'verification': u''} None Data 7 received {u'data': u'sn7NdBVgKsSj1nBx0Q4JvaHzK1+/55plfL/Tc+X7EMbvPPWFLuSbXwkVrodxqzCO', u'message_type': u'DATA', u'signature': [11774189980297438730745815598088970429755736736412349187637106958357171443276572732907082353555237438384574357571043622655618215139209764398257035628693214652829593269365842908074285376523260546356461324937268641329228153495811741688205596210110880635391671465123384883341017524933664282073323972880622041579952408508821054487292732617803276178273969407915781964308627680850214068240798431636171579424701592548496412707417878374935389005083282654442716848737260794114703057759824534252506797235665714968077337111843647926709625637895861532319139957371277620034161511972591303564147948287895934218564173588422824055489L], u'verification': u''} None Data 8 received {u'data': u'rNmHQjnEDmmc6GGS0GgqTHO1zmjYf9VeKdszKMbj/q5qa1SpCaxv+bQ2i4xHk7Ws', u'message_type': u'DATA', u'signature': [17946260677795135470972807745790657157299946172431549803947522710426414015293223304851065608698434146172878689989665321071156770687708294034965104164575596136014148915703960518619600305506332135748698882257717911899535613089056224795137473588079292175876040127587461409375494920125257703182390348773598885733096389460143122682089357040103210162207303727146942884587121684683566745917001745565069266547913423349601456899625320723542354725536424131959369581729484254524035806854938068931411278829214468310531305581188665703153483264921857996600381434281188681752945966997349715851664692626282587331788218426876716439335L], u'verification': u''} None Data 9 received {u'data': u'P9dqjiyKz2104uHkVoRBP1QaPJ6JQNTMgjq2Fy8dPZZMLJwPGKxnk+KNXIXF87iw', u'message_type': u'DATA', u'signature': [11097140965770079073609058242283921050608441675428242491318170482445839962400480959415631126965557659304579360180748868959225108417363004910467163972311860185013348454198373256887941650216178653302509172929155337028103410675328665482524120998119641868102703318657416944152494387611154669112703902570829244106614371582650112836843924817701249935657855719071720164628461458344123505151401383643278269685555244246073121956886542460607737099473099699620495419613066608855948271195250006942404984076853114256296110270748994226266057664565987924906449744840253169012635529642985560722722162831661474854171352984144623631878L], u'verification': u''} None Data 10 received {u'data': u'YbCGl3wyx0FTsNhDJKHYRVt8btkxw5Exxj7FJE1s9mkLNnNx6+M0FvuG7KnpHTBU', u'message_type': u'DATA_INVOICE', u'signature': [10499953819768236380327681204175496693386417274487112423152055665071883167738680159646206063297052909763995159909107790954870103091355662579575096696285194862354146023686042192193637576960413177079600327881551069190588678229590206131722166932666350905745305949106038060692885336850978311537470096757929903971337945356283605693427510881369522697629458498344651759354543414426933027072322226344410853815883007774691483398405933187231726047002152406155940417806511310377689069800529633255459552628988725555072895394691244894123542599933681360531848768076799022746109833404234504654442869638605662767097081971355724978289L], u'verification': u'IWZFNI9CTHXJLTLSGKMSFC9HRMGWTNZYNYVDWHJBKSJICAHQZMWBVA9WGLXBB9NMUM9MOUOUBEPGZ9999'} None Payment made: https://thetangle.org/bundle/DMOZHHSIULRHQW9CFHDRKALSGHZQGJHCOXVHYRG9DFJGGSATJKYKTRXIQ9AALXZPOWZVDFU9FXPKFLVTD -------Receiving Data Ends-------- Done!

Swarm-Node TangleID extension work flow

  • buyer issue a buy claim to seller
  • seller should generate a "address with value 1i (or this address will be deleted after snapshot) of receiver only on identity claim"
  • seller issu a menu claim to buyer
  • buyer start to send the order claim to seller
  • seller start to send data with MAM Restricted mode (channel key and Side key (encrypt with buyer publuc ksy))