nanocurrency / nano-node

Nano is digital currency. Its ticker is: XNO and its currency symbol is: Ӿ
https://nano.org
BSD 3-Clause "New" or "Revised" License
3.48k stars 783 forks source link

Getting rid of PoW (suggestion) #1064

Open alandefreitas opened 6 years ago

alandefreitas commented 6 years ago

Now that representatives will vote with musig (and only then the node will relay the final transaction with the vote aggregation to the network) couldn't we just get rid of PoW? Other DPoS currencies have done it.

Not trivially, of course:

A preliminary idea is that representatives would attribute a timestamp t for the hash and sign both. This would become the official and final timestamp for the transaction. After that, spam could be filtered in one of two ways:

The dynamic approach would not only allow transactions to go as fast as the representatives can process but it would also give a clear advantage to honest users, who would have their transactions processed almost instantly.

The obvious attacks are:

Regarding the capacity of representatives, they can also increase their capacity by validating transactions in parallel according to the transaction hash. Representative k can be online on IPk1, IPk2, ... IPkn. If a transaction is a preimage for the hash h, such that h%n==i, this transaction will be validated by IPk(i+1). The user can send the transaction directly to IPk(i+1). If the transaction goes to another IP such that h%n!=i, the representative will send it to the proper IPk(i+1) and it's not included in the heap. So any node can validate x times more transactions by setting up more nodes with the same private key.

This would move NANO closer to what the internet (and e-mail) looks like. Invalid transactions (like spam) would be invalidated or given preference according to their properties rather than imposing a cost on all honest users.

kayabaNerve commented 6 years ago

Your static implementation kills off mass-transfers, like what services/exchanges would use. Your dynamic idea seems good except it encourages, and is easily defeated by, mass accounts.

You then cover defeating mass accounts via limits by IP idea (which I like except you only know the IP of the relayer) and by account linkage (which could penalize innocent people that just happen to do frequent transfers with a malicious actor). That said, I think it's a great idea.

I do want to note, it is harder to a DoS attack when you must pre-generate all the spam, which can take hours and sets a fixed time of when the DoS attack will end.

I personally would not see this in Nano versus marked for implementation years down the line.

Finally, for your analogy, EMails have centralized spam filters and the internet uses paid gateways called ISPs. ;p

alandefreitas commented 6 years ago

@kayabaNerve, thank you so much for your feedback. I've been thinking about something like that since I've been studying about how other DPoS currencies work. The idea is still very rudimentary but I think it would be very useful to light clients if we came up with something smart. Some questions:

When you say it is harder to a DoS attack when you must pre-generate all the spam, I do agree with that. What concerns me, more than a heap being enough to eliminate PoW, is what we can do to defend ourselves when they do pre-generate the spam. I understand there are two kinds of DoS spam:

1) The first one is having many transactions that wouldn't be valid anyway.

From the perspective of the attacker, the first attack might just be cheaper than the second one because he could use many devices he hacked. Which attack is cheaper will depend on contingent factors, such as the number of devices available, time, etc. That kind of heap could be a defense again the second attack with pre-generated PoW and partial defense against the first kind of attack (too many invalid transactions). Maybe the required PoW could be reduced little by little if the heap itself allows the representatives to handle more transactions.

I know Nano wouldn't implement this anytime soon but having the discussion seems worth it to me. I think some kind of strategy like that could provide (i) extra security for pre-processed spam attacks even with PoW, and (ii) a better experience for light know (if it's ever useful to reduce PoW difficulty). Thanks again for the feedback.

PS: I understand the disanalogy. I guess I have to stop referring to analogies because for every analogy there's a disanalogy. It seems like it always makes it harder to transmit the original idea. :P

kayabaNerve commented 6 years ago

Both discourage mass transfers; the Bayesian idea, which I do like, is just more likely to not harm legit services like payment processors/exchanges. That said, since Nano doesn't have fees, it's important to remember I can bounce back 100 Nano infinitely (meaning the filter for spam would have to be very carefully crafted with balance across the various factors).

The first is just a DoS attack and not directly related to Nano. The second, however, is directly related to Nano, and is the trickier. Unfortunately, I don't have enough knowledge to continue this. :P

alandefreitas commented 6 years ago

I still don't understand. Which kind of mass transfers are important? Are there any kinds apart from exchanges? Why would these be discouraged?

How would you bounce back 100 Nano infinitely if nodes have a Bayesian estimate that penalizes according to output history? Unless there is something I'm missing, the velocity of the output/money would make these transactions very slow so one wouldn't be able to do that. Exchanges could still be operating because they are working on different outputs and not just sending the money back and forth.

I agree that the first DoS attack is not directly related to Nano. I just wanted to make the distinction clear because it seems like people are conflating DoS and spam all the time in this community.

It just seems to me like this is what other DPoS currencies are doing and I don't see many problems so far. Thanks for the feedback again.

kayabaNerve commented 6 years ago

Mass withdraws/payouts. They're discouraged because the first system (based on time since last TX) could have a legit service's TXs treated worse than spam TXs.

The Bayesian estimate stops that if you have the correct criteria. That was my statement. Just needs to be setup properly,

rkeene commented 6 years ago

See also Issue #506

alandefreitas commented 6 years ago

For the record, when I say "Other DPoS currencies have done it", I mean EOS, BitShares, and Steem. They're based on Graphene and allocate bandwidth according to the "bandwidth model".

The bandwidth model guarantees a certain bandwidth to users. This is proportional to their stake. New users can use spare bandwidth, which is usually available. There are also some other details, like the possibility of renting bandwidth but that's not very relevant in our context.

My suggestion is a little different because it wouldn't explicitly depend on stakes, although it could also include consider stakes in the equation. The bayesian estimate would primarily include things such as (i) the value of the output, and (ii) output history. Output history, in economic terms, is the equivalent to the velocity of money. Other criteria could be included to represent priorities of the community, such as (i) IP addresses, (ii) voting power, (iii) previous timestamp, (iv) you name it. We would have to be careful about these extra criteria because they involve trade-offs. For instance, IP addresses could be a problem for exchanges, voting power could be a good extra incentive for people to run nodes.

Finally, we have to note that it's only a solution to avoid a possible problem. These criteria would only be effectively applied when the network is on the limit, so it's not like when we choose transactions from users X over transactions from users Y, users X would be completely benefited all the time.