Designing P2P Networks Tolerant to Attacks and