psaras2020a.pdf
Rewarding Relays for Decentralised NAT Traversal Using Smart Contracts
Navin V. Keizer
University College London
navin.keizer.15@ucl.ac.uk
Onur Ascigil
University College London
O.ascigil@ucl.ac.uk
Ioannis Psaras
University College London,
Protocol Labs
i.psaras@ucl.ac.uk
ABSTRACT
Traversing NAT’s remains a big issue in P2P networks, and many of the previously proposed solutions are incompatible with truly decentralised emerging applications. Such applications need a decentralised NAT traversal solution without trusted centralised servers. In this paper we present a decentralised, relay-based NAT traversal system, where any reachable node is able to assist an unreachable node in NAT traversal. Smart contracts on the Ethereum blockchain are used to ensure fair rewards. Besides financial incentives, a reputation system based on transactions on-chain is used to mitigate against malicious behaviour, and guide peer discovery. Evaluation of our system shows that a combination of historic performance metrics leads to an optimal scoring function, that the system takes little time to reach stability from inception, and that the system is resilient against various attacks.
CCS CONCEPTS
• Networks ! Peer-to-peer networks; • Security and privacy ! Distributed systems security.
KEYWORDS
Network Address Translator, Smart Contracts, Network Relays
1 INTRODUCTION
Peer-to-peer (P2P) networks have been popular in the design of various applications such as BitTorrent and Napster due to their decentralised nature and associated benefits. Recently there has been a new surge to decentralise the Internet through P2P-based systems such as distributed file systems (IPFS) and cryptocurrencies (Bitcoin, Ethereum). There are, however, a number of challenges and issues in P2P networking, mainly due to the incompatibility with the current Internet infrastructure which is tailored towards the client-server model.
One of the most prominent is the issue of unreachable peers, which can be caused by Network Address Translators (NAT), firewalls, reverse proxies and more. In a P2P network, a node must be able to act as a client and a server at the same time. However, NAT’s make it impossible to receive requests from the network if the node itself has not previously set up a connection with the other node. Estimations in the Bitcoin and IPFS networks suggest that respectively at least 86.8% and 52.2% of nodes are behind a NAT.
Early research in P2P networks produced a number of protocols such as STUN, TURN and hole punching, aimed to fix this problem. A large suite of protocols originated due to the lack of standardisation in NAT’s, making protocols only suitable for a subset of NAT’s. For example, early research showed hole punching to be successful 60% for TCP and 80% for UDP, leaving relay-based protocols as the only reliable option.
One of the main issues with the previously proposed solutions is the need for a set of centralised servers assisting the network by relaying messages or maintaining connections with various nodes. These servers are prone to numerous attacks, require complete trust in the central infrastructure, and can be situated far from the node using its services, thus incurring high latencies.
In this paper, we propose a decentralised, relay-based NAT traversal system for P2P networks with a built-in reward system for relays who assist nodes in their communication. In this system, any reachable node in the P2P network can become a relay. Our system is realised by a combination of dual-path routing, producing a Proof of Timely Relay, which ensures a client of honest behaviour of relay nodes, and smart contracts on the Ethereum blockchain, which ensure fair exchange for the work done by relays. Nodes are incentivised to behave properly in order to claim maximum rewards.
2 BACKGROUND
In this section we review the general concepts of NAT traversal, blockchains, and smart contracts.
2.1 NAT Traversal
NAT’s perform both port and address translation at the boundaries of public and private networks, enabling a much larger number of nodes in a private network to be connected to the public Internet. In general, there are two cases when NAT’s create issues in P2P network communication between two nodes:
- Both nodes are unreachable (behind a NAT).
- Only one of the two nodes is unreachable.
In the first case, connection in both ways will fail, whereas in the second case only the connection from the public node to the unreachable node will fail.
2.2 Blockchain and Smart Contracts
Many protocols have been proposed to aid in NAT traversal, mostly based on centralised servers. Out of these, TURN relays entire connections for case (i) with high reliability but low relative performance. For case (ii), connection reversal is used to relay the initial connection after which a direct connection is set up between nodes. These centralised approaches suffer however from a number of associated issues. Besides the well-studied security issues, they do not suit decentralised P2P networks, as they require central management and infrastructure. In a blockchain network, itself a P2P network, nodes have a full view of the shared history (i.e. the chain of blocks of transactions). This chain is append-only, which avoids double spending. The so-called “full nodes” can send and verify transactions in the network, and perform a computational puzzle in order to produce (mine) the next block, for which they are rewarded.
2.3 Related Work
Existing work has proposed incentives for relaying network traffic with rewards. Several systems are mentioned, including the use of smart contracts to secure incentivisation in P2P networks. Our work is distinct from these as we reward based on QoS measured, incorporate a reputation system to prevent contracting malicious peers, and use smart contract micro-payments.
4 SYSTEM DESIGN
PoTR, the mechanism through which a client can detect potential malicious behaviour by the relay, allows the client to verify that the data has been relayed without additional delay, data being altered, or a large packet drop rate, as promised in the contract. The goals mentioned are reached through a combination of Proof of Timely Relay (PoTR) and a smart contract which governs the rewards, and implements a reputation system through mutual scoring.
4.1 Proof of Timely Relay
When a client node contracts a number of relays to help become reachable in the network, an agreement is stored on the smart contract. The relay node either uses connection reversal or sets up a circuit relay if both parties are unreachable. Our mechanism ensures reliability by allowing a client to pick two relay nodes: one as a check node and one as the “true” relay node.
4.2 Smart Contract
A smart contract is used to document the agreement between clients and relays on the blockchain, governing payments by the client for the services provided by the relay without the need of a trusted third party. The smart contract allows for conditional payments based on the QoS provided by the relay and uses micro-payments, ensuring fair exchange.
4.3 Reputation System
The smart contract records the trust scores given to nodes involved in the contract for each agreement. This makes for an open, decentralised and node-centric reputation system. Nodes can locally decide their own policy for calculating reputation scores, which may incorporate metrics such as contract duration and performance in terms of QoS scores.
4.4 Peer Discovery
Contracting a relay with close proximity to the client will likely lead to a better expected performance. To discover potential relays, both the reputation of nodes and the expected performance are important. The client finds nodes providing relaying services nearby, calculates their reputation scores, and filters out potential malicious nodes.
5 EVALUATION
In this section, we evaluate different aspects of the system by running various simulations, showing how our system meets the design goals outlined.
5.1 Peer Discovery and Reputation System
We created a network of 100,000 nodes in simulations, evaluating the performance based on different scoring policies, including trust, QoS, or duration metrics. The findings show that a combination of metrics performs best in identifying malicious nodes.
5.2 Security Analysis
We discuss the mitigation against various attacks in our proposed system. The smart contract ensures that colluding nodes cannot easily boost scores through dishonest scoring, and Sybil attacks are rendered largely ineffective by the requirement of satisfactory service for identity retention.
6 CONCLUSION AND FUTURE WORK
In this paper, we have presented a reward system for decentralised NAT traversal, where nodes are incentivised to be honest to earn rewards. We conclude that the proposed smart contract implementation is reasonable in terms of costs and that the system shows the capability to reach stability quickly. Future work will explore the payment rate function and extend our system for dynamic relay selection.