DLTcollab / dcurl

Hardware-accelerated Multi-threaded IOTA PoW, drop-in replacement for ccurl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remote interface: Accelerate attachToTangle in IRI

ajblane opened this issue · comments

Prior knowledge

IRI's AttachToTangle

  • It's synchronize API and means this API handles a bundle at one time
  • A bundle includes many transactions
  • There are dependencies between transactions, see the tutorial, IOTA tutorial 10: Transaction and Bundle
  • Only do one PoW for one transaction at one time

Design considerations

In current DLTcollab's IRI with dcurl, we integrate remote PoW with dcurl, as is not effective. This is because AttachToTangle API only does one remote PoW for one transaction at one time. This results in a situation of only one task message in message queue. However, only in multi-IRI situation, it is effective. Moreover, there are dependencies between transactions, so we can't parallel transactions to do PoWs in AttachToTangle API. It's so sad.

As a last resort, we need to change synchronous AttachToTangle API into asynchronous AttachToTangle API. For client of PoWbox, curl-remote, Its AttachToTangle API is also asynchronous.

Here is a situation of using asynchronous AttachToTangle API:

thread0 -> attachtotangle0 -> transaction0 -> dcurl remote PoW -> transaction1 -> dcurl remote PoW -> ... -> finish attachtotangle0  
thread1 -> attachtotangle1 -> transaction0 -> dcurl remote PoW -> transaction1 -> dcurl remote PoW-> ...
thread2 -> attachtotangle2 -> ...
...
  • In asynchronous AttachToTangle API, doing remote PoW for transactions is in order
  • Allow many AttachToTangle APIs to run at same time
  • Generate results of asynchronous AttachToTangle API is out-of-order