Yeah, I've read the dev documentation. But I need more than that. Well, for instance, you said nodes have a banscore. Where is that banscore stored?
In memory.
If you enter
getpeerinfo in the console or if you use
bitcoind getpeerinfo from a linux terminal on a machine that allready has bitcoind running you get something like this:
[
{
"addr" : "-IP-:8333",
"addrlocal" : "-IP-:8333",
"services" : "00000001",
"lastsend" : 1417103014,
"lastrecv" : 1417103015,
"bytessent" : 426967,
"bytesrecv" : 28102212,
"conntime" : 1417095403,
"pingtime" : 0.00000000,
"version" : 70002,
"subver" : "/Satoshi:0.9.2.1/",
"inbound" : false,
"startingheight" : 331833,
"banscore" : 0,
"syncnode" : true
},-more nodes here-
]
I currently have none with a banscore >0.
But this information is gone as soon as you terminate the client/daemon.
In the block chain? I don't think so. And, is that banscore written to the IP address of the node?
Yes, its per IP and each node has its own list for the banscore. You can modify your tolerance for it in the bitcoind.conf file if you want and a custom written client might also write it to disk when shutting down.
And if such a thing exists, can there also be a banscore for the spammers? Then, an IP based spam prevention would be possible, instead of the fee structure.
Well, AFAIK the reason behind the banscore is to prevent a DoS attack not transactionspam. A DoS or even DDoS attack would simply fail because of the banscore system. An attack with cheap data of invalid transactions would only result in an increasing banscore and finally in a disconnect. The invalid transactions would not be relayed to the network, thus unable to bother all nodes at the same time. Over time any attacker(s) would run out of IP addresses and can only ever bother a few nodes at a time.
The fees exists to make mining profitable in the long run. In the distant future when the blockreward is so small it is no longer of relevance or even shrunk to zero, the fees will be the payment for the miners to keep going, to keep mining profitable.
The relay rules are what currently prevents transactionspam, or rather what makes it harder to spam with 1 satoshi TX. If you look at the rules in the "isDust" function I linked earlier you will notice that a dust transaction is actually valid and might be even valueable in the future. Currently dust transactions are not relayed by bitcoin core, but kept in memory as valid transactions. This makes it harder for spammers as they cant just broadcast their transactions to any random node and hope that the network will know about the transaction within seconds. They still happen though, since not all the nodes run the same version and possibly some spammers have access to reasonable hashingpower. Usually its done as a sort of advertising and would include a tag on blockchain.info