Dcurl is a multi-threaded curl implementation which can accelerate PoW for IOTA and is already used in many projects among the community such as early stage of PiDiver. While FPGA accelerated PoW is already lightning fast and it’s enough for just using ccurl if only a few transactions, there’s still some use cases or scenario you want to do PoW yourself and don’t want to waste too much time.

In this article, I’m going to introduce how to create a transaction using IOTA python library with the help of dcurl to find nonce. Further and detailed explanation and examples can be found in its repo bellow:

Build and Test

There are several build options. But we just need AVX for now:

$ make BUILD_AVX=1 BUILD_STAT=1 check

And the result should look like this:

*** Validating build/test-trinary ***

[ Verified ]

CC build/test-curl.o

LD build/test-curl

*** Validating build/test-curl ***

[ Verified ]

CC build/test-dcurl.o

LD build/test-dcurl

*** Validating build/test-dcurl ***

[dcurl] Implementation CPU (Intel AVX) is initialized successfully

[ Verified ]

LD build/libdcurl.so

*** Validating build/test-multi-pow ***

[dcurl] Implementation CPU (Intel AVX) is initialized successfully

[ Verified ]

CC build/test-pow.o

LD build/test-pow

*** Validating build/test-pow ***

CPU - AVX

[dcurl] Implementation CPU (Intel AVX) is initialized successfully

PoW execution times: 1 times.

Success.

[ Verified ]

Send Transfer Example

After building successfully, the library should be located at ./build/libdcurl.so You can copy/move the file, or just set the path in your code. Right now, let’s make a simple interface for PoW library. We will import this whenever we need to find the nonce.

And then we can make custom send transfer method as we like. In this case, I’m just going to make a 0 value transaction to show as an example. Since we do PoW ourselves, that means we also have to “attach to tangle” on our own. This includes get tips to be trunk/branch transactions and assign attachment timestamps. After all these steps and also PoW, it’s time to broadcast the transaction. We can review the result in any explorer in no time: https://iotastrong.io/transaction/WNDRPZGNYIADFUCH9GUZLXPRVPHUWCUVEQICBZFHRLK9DEWQTIHNZAYQFZVQZWHWQY9ANE9CYTCV99999

More Configurations

Dcurl has custom build options to support different use cases as mentioned above. This means we can use FPGA or even gpu to accelerate PoW. IRI can also be modified to use dcurl as external library.

Anyways, this is another option about doing PoW in IOTA. There are official PoW box for devnet and original ccurl library already exist. And there’s also powsrv.io for remote PoW delegation. If none of these fit for you, maybe dcurl can be considered as better option.