What prevents me from creating a script that send millions of transactions back and forth between two wallets? How does that affect the network?
First of all, feeless is not the same as costless. For each transaction on the nano network there is a required proof of work (PoW) to be computed before any block can be sent (or received). This costs a small amount of electricity and is the first step to reduce the amount of spam, just like it works with other cryptos with fees. It’s not a spam preventer but a spam reducer.
Next step in the process is dynamic proof of work and PoW prioritization (implemented in node v18-v19). It enables nodes to set the amount of PoW to be done and higher PoW will automatically get higher priority in the voting process. More PoW => faster transactions (if network is saturated). The increased PoW will have little negative effect for the normal user as it can be pre-computed over a longer period but still instant when needed.
As long as the network transaction throughput is not saturated, nodes will make normal default PoW at a very low cost. If the network load go up too high, or network is spam attacked, nodes will start to slightly increase their PoW in order to push a transaction through before other transactions. The network will naturally self-balance in a cost Vs. needed speed scenario. Spammers will simply not afford to spam at a rate that’s disruptive for the rest. Nano has a huge advantage here compared to other cryptos by being extremely lightweight and with a low transaction cost overall. The Nano (block lattice) has an asynchronous flow of transactions and with no hard limit in the number of concurrent transactions that can be made. However, the broadcast and voting process will naturally be limited by hardware, especially Internet bandwidth. With TCP that has now replaced UDP in the protocol there is also a possibility for nodes to cap the outgoing bandwidth used in order to balance their own cost.
Again, this is not a spam prevention and there is no such thing in a perfect decentralized and fully open system where anyone is allowed to make transactions. It will also not be completely free and effortless to make an unlimited amount of transactions whatever method someone comes up with because you can’t remove malicious actors from the equation. Someone needs to pay for the data bytes, either it’s fees deducted from the transferred amount, computer work or driven by advertisement. What Nano does, and which is its main strength, is to be a lightweight protocol with minimal extra features in order to compete among other cryptocurrencies.
There are also new developments being made all the time to combat these type of questions. Later node versions will most likely be even more advanced and possibly with sophisticated DDOS protection as well.