Nano P2PoW

Delegated Proof of Work, now P2PoW. Updates and news!

Kaique Anarkrypto
8 min readDec 24, 2020
  • Rebranding
  • Victory at NanoJam
  • Importance of P2PoW
  • API update
  • P2PoW Client JS
  • P2PoW Online Web Demo
  • Third-party integration, IOT, new wallet
  • Prunning considerations
  • Donations & Discord channel

In this year of 2020 a lot of work was done on top of P2PoW... the news has accumulated and before the year is over I want to have the honor of sharing with the Nano community!

NanoJam victory and Rebranding

In 2019 it was a pleasure, after the recount of the votes, to discover Delegated Proof of Work was the winner of NanoJam, the first international hackaton of the Nano community, taking the first place!
Due to the fact that many people confuse the old name of the project “Delegated Proof of Work” with the project “DPoW” (distributed PoW, which maintains a different system, with a centralized api), a rebranding was necessary. @mitche50 from the Nano Center suggested the current name: P2PoW. I intend to remain with that name that certainly fell very well in our P2P project!

The importance of P2PoW for Nano

  1. Currently, Nano’s only anti-spam barrier is the Proof of Work mechanism, present in all Nano transactions. Without it, the network could easily become congested.
  2. Keeping the network healthy depends on the difficulty of Proof of Work remaining significant enough.
  3. However, continuous advances in GPU make the Proof of Work resolution faster and faster for these new graphics cards. In order to prevent the network from becoming vulnerable, the difficulty of proof of work must always increase and that is precisely what we are seeing.
  4. On the other hand, devices without sophisticated GPU, such as medium computers, mobile devices, embedded devices, Arduinos, micro-controllers and etc are getting slower in this process and a Nano transaction that should be instant can easily take more than 10 minutes to have its validated proof of work.
  5. Although pre-computation of proof of work is possible, it is not always feasible… on some devices it would require most of the processing available for quite a while, lagging the system until PoW is resolved. And after making the Nano transaction, you would have to wait a few more minutes again for the resolution of the next Proof of Work to be completed before making the next transaction.
  6. What has been done so far in the main Nano wallets is a process of delegating proof of work to purchased / rented worker-servers (which is usually very expensive and does not use 100% of resources) or services such as DPoW (Distributed PoW), which offer an API for developers to obtain quick transactions, using the processing of such a service instead of computational of user.
  7. Although this solution (DPoW) has many benefits, DPoW is distributed, but not decentralized.. it is based on a centralized mechanism and is only offered for non-commercial projects. To use DPoW you need to signup your project, and trust the good functioning of the server (coordinator) and its administrators. Workers also depend on trust in some authority. There are no mathematical guarantees, only human ones.
  8. That’s why I created P2PoW. With P2PoW it is possible to delegate proof of work directly to “worker peers”, who currently work as miners, independently and autonomously. It is possible to use one worker at a time or several simultaneously; takes the reward who finishes the proof of work first, like a competition.
  9. P2PoW security is decentralized and there is no way for a user or worker to take undue advantage. The only way for the user to validate their transaction is to sign an extra reward transaction for workers. The only way for workers to earn the reward is to validate the user’s transaction. There are no single points of failure. This security mechanism is intrinsic to the Nano block lattice protocol.
  10. The P2PoW protocol, therefore, allows any Nano project in any device to have instant Nano transactions at any time, without the need for any extra registration, without the need to trust any server and without any central authority. P2PoW does not require any permission or bureaucracy to be integrated into software by developers and anyone can become a worker just as easily. P2PoW is the purely mathematical and P2P solution for Nano Proof of Work delegation.

To better understand the technical functioning of P2PoW, read this article: https://medium.com/@anarkrypto/delegated-proof-of-work-d566870924d9

Worker API Update -> V2.0.0

Many things have changed since the first version of Delegated Proof of Work (now P2PoW) to keep the API more robust, efficient, secure and updated with the changes to the Nano protocol. Let’s see:

- Adapting to the new difficulty

Now P2PoW API by default handles different send and receive transactions according to Nano protocol updates.
Minimum difficulty to send: 8X the old difficulty
Minimum difficulty to receive: 1/8 the old difficulty
In addition, workers can enable dynamic fee, this requires customers to pay more for larger PoW when the network is more saturated.

-Efficiency

While solving a job, the API automatically checks if the transaction has already been confirmed (possibly by a competing worker). If so, the api gives up the work and can focus all its resources on the next work.

-Logging

Now the P2PoW API comes with a more organized logging system, with different flags:
INFO: Common notices, such as startup and new work
Warning: User made an invalid request or with some invalid data
Error: Error in configuration, API or communication with node nano / worker
For those using Linux, logs can be tracked via journalctl
The user can also redirect the entire log to a file using arg: -o file.log

-Support for IPV6

In addition to IPV4, the decentralized registration system protocol is already able to convert IPV6 to the Nano account format and make it available to P2PoW clients automatically.

-Improvement of code in modules

To facilitate the work of developers who want to forge the code, the API now has its functions divided into “modules”, as well as a division of the configuration files.

Code comments have also been added and improved.

P2PoW Client JS

To facilitate and improve the integration of P2PoW in applications, I announce the P2PoW client JS. A library with all the functions needed to use P2PoW. Check usage examples:

P2PoW.sync(delay, callback) //synchronize with workers

P2PoW.getWorkersOnline( ) //get workers list

P2PoW.requestInfo(workerAddress) //get a worker info

P2PoW.requestWork(user_block, workerIP) //solve a transaction

P2PoW Web Demo

How about a simple and friendly online demo for any user to test P2PoW working in practice?

Try it Now :https://demo.p2pow.online

The P2PoW Demo is the first integration with the client JS and allows anyone to test the protocol without the need to install any software or understand programming!

Atualização do site

The site was also not left out! This is the new official P2PoW website: https://p2pow.online

https://p2pow.online

The code is available at: https://github.com/anarkrypto/p2pow/tree/master/docs

Implementations: C, PHP, IoT and Wallet with P2PoW!

The programmer and enthusiast Fabio Silva took advantage of P2PoW protocol to integrate into his projects focused on IoT and low processing devices:

myNanoEmbedded: lightweight C library

myNanoEmbedded is a lightweight C library that integrates Nano Cryptocurrency to low complexity computational devices (like IoT), with fast transactions and small fees by delegating the Proof of Work with P2PoW.

Support: BIP39, P2PoW, TRNG or PRNG entropy
ARM-A, ARM-M, Thumb, Xtensa-LX6 and IA64 compatible
Linux desktop, Raspberry PI, ESP32 and Olimex A20 tested platforms

myNanoPHP: library to integrate Nano to PHP

myNanoPHP is a PHP Nano Library optimized in size and speed, binding the C library MyNanoEmbedded for PHP.

Nano-electron

Nano-electron is a cross-platform wallet for Nano cryptocurrency.

Focused on lightness, agility and portability, this wallet uses the myNanoEmbedded C Library through a binding to provide greater performance.

myNanoJS

myNanoJS is a C library that integrates Nano Cryptocurrency tools to NodeJS

myNanoJava

Java C bindings for Nano Cryptocurrency with Bitcoin support

Nano Pruning — What will change in P2PoW

This subject will be explained in more detail soon, but so far everything indicates that the pruning will have no negative impact on the P2PoW protocol. On the contrary, it will help!
Since pruning does not apply to burn accounts, it will not affect the decentralized registration system of workers at all.
However, pruning will make P2PoW more efficient, because although P2PoW requires 2 transactions for each work (1 user transaction and 1 reward transaction), pruning will leave only the last transaction saved in the ledger (state block), therefore, in pruned nodes, P2PoW will not require extra storage compared to other methods of transact Nano!

The future of P2PoW

Many updates and features can make P2PoW even more complete and robust. Some possible implementations stand out:

  • Integration with Tor: Will allow Nano users to delegate proof of work through an anonymous proxy thus preserving your ip identity and localization. Currently, the main wallets do not provide this type of privacy. Which means that users are exposed.
  • P2PoW Websockets: The use of websockets will allow faster synchronization with workers and faster work validations, in addition to:
  • P2PoW Pool Gateways: Using websockets it will be possible to create “mining pools”. This can be both useful for workers who want to connect several machines of their own to their API, or to distribute proof of work among different peers who do not want to run worker API as a server.
  • Web Interface for worker API
  • Python Client
  • node JS API
  • Pre-computing: Workers peers will be able to pre-compute proof of work from “loyal” accounts.
  • Integration into desktop and mobile wallets.

Donations

This project is developed in a totally independent way.

All the progress mentioned here was the result of months of work!

You can encourage further development of this and other Nano projects with a Nano donation:

nano_18eoa1k16d4n1b5hb8hwxm5mmgp6zny7owhn8omc5bgxjahxsyznob9u536t

Discord Channel

If you have questions about the project, suggestions or other contributions you can join our channel #p2pow-discussion on The Nano Center’s Discord server: https://discord.gg/GhzdTkD

--

--