Sfondo astratto
CryptoHelvetia Logo
PDF 2018

Using Ethereum Transactions to Deanonymize Senders

This thesis explores Ethereum transaction propagation mechanisms to identify transaction origin nodes. It performs timing analysis on transactions propagated through Ethereum networks and develops TxSniper, a tool to deanonymize senders. The study includes a case study of Geth and Parity clients, revealing differences in propagation.

Anno
2018
Tipo
paper
Lingua
en
Pagine
36
Apri PDFScarica PDFTesto in Markdown

Testo completo

c© 2018 Siddharth Murali

BY

SIDDHARTH MURALI
THESIS

Submitted in partial fulfillment of the requirements for the degree of Master of Science in Electrical and Computer Engineering in the Graduate College of the University of Illinois at Urbana-Champaign, 2018 Urbana, Illinois

Adviser:

Associate Professor Michael Bailey

ABSTRACT

The historic rise of blockchain-based cryptocurrencies to over $327 billion in market capitalization has sparked significant research efforts studying their reliability, performance, and security. Bitcoin, the highest valued cryptocurrency, has received the most thorough scrutiny, with many studies analyzing its peer properties and network health. In contrast, the network layer for Ethereum, the second-largest cryptocurrency, has gone mostly ignored, even though it employs different algorithms for transaction propagation.

In this thesis, we perform timing analysis on transactions propagated through Ethereum networks to identify the origin nodes. We build a tool called TxSniper to verify our approach on Ethereum’s main network. We find that we can identify the origin with a 70% probability; this method is not always effective due to presence of nodes running clients that use different implementations of transaction propagation. ii To my parents, for their love and support. iii

ACKNOWLEDGMENTS

Thank you to Seoung Kim, Zane Ma, Joshua Mason, Andrew Miller, Surya Bakshi for all the help and assistance provided in developing this thesis. iv

TABLE OF CONTENTS

CHAPTER 1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . 1

CHAPTER 2 BACKGROUND . . . . . . . . . . . . . . . . . . . . . 3 2.1 RLPx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.2 DEVp2p . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.3 Ethereum Subprotocol . . . . . . . . . . . . . . . . . . . . . . 5

CHAPTER 3 METHODOLOGY AND RESULTS . . . . . . . . . . . 9

3.1 Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.2 Private Network Test . . . . . . . . . . . . . . . . . . . . . . . 14 3.3 Code Analysis and Testing on Ropsten Network . . . . . . . . 16 3.4 Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

CHAPTER 4 DISCUSSION . . . . . . . . . . . . . . . . . . . . . . . 25 4.1 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 4.2 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 4.3 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

CHAPTER 5 CONCLUSION . . . . . . . . . . . . . . . . . . . . . . 27

REFERENCES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 v

CHAPTER 1

INTRODUCTION

The historic rise of blockchain-based cryptocurrencies to over $327 billion in market capitalization [1] has sparked significant research efforts studying their reliability, performance, and security. Bitcoin, the highest valued cryptocurrency, has received the most thorough scrutiny, with many studies analyzing its peer-to-peer (P2P) network topology and peer properties [2, 3]. In contrast, the cryptocurrency called Ethereum has not been the subject of many studies, with its network topology and properties still vastly unknown.

Ethereum is currently the second-largest cryptocurrency; however, the Ethereum Foundation sees it as more than that. According to them, Ethereum is a decentralized platform for smart contracts, which are programs that enable interaction between Ethereum addresses on blockchain and run without having to deal with downtime, fraud, or third-party interference. The contracts can be programmed for anything from a simple timed transaction to creating a new cryptocurrency. An example of a smart contract that has gained a lot of popularity recently is CryptoKitties—a virtual game that allows players to collect and sell cats, all using the Ethereum blockchain [4]. The key difference between Ethereum and Bitcoin is that Ethereum is not just a token which lets users purchase goods, but “the built-in Turing-complete programming language that allows anyone to create contracts for any usage beyond currency transaction” [5].

The variety and complexity of applications that Ethereum’s smart contracts enable has led to many ventures and users using Ethereum as their platform, driving the value of the cryptocurrency upto $50 billion [1] as of July 2018. This commercial interest in Ethereum has resulted in an increased number of studies on Ethereum, including works on smart contract analysis [6, 7, 8] and attacks on smart contracts [9, 10]. However, work exploring the underlying topology of Ethereum is extremely sparse. Understanding the network topology of a cryptocurrency like Ethereum provides methods to view events such as attacks against the network and understand how they were carried out, as well as shed light on topology properties like node centralization and cluster identification. An application of this in Bitcoin is using the timing analysis of flood messages to infer the topology of the Bitcoin network [3]. Insight into Bitcoin’s underlying network topology and protocols have also exposed a network-level vulnerability that enabled application level attacks [11] that allowed attackers to create forks and launch double-spend attacks. Using network topology information in an adversarial manner is possible, with eclipse attacks against Bitcoin based on network positioning and topology commonplace [12].

One of the first steps in understanding topology is being able to identify the source of a transaction, by deanonymizing the sender. Deanonymization of senders enables all transactions to be traced back to their origin, and this is useful in tracking the flow of money from specific accounts.

In this thesis, we explore the underlying mechanisms by which Ethereum transactions propagate, and we use our knowledge of these mechanisms in presenting a method to identify the origin of an Ethereum transaction. In order to gain a full understanding of transaction propagation in Ethereum, we first performed a case study on the two most popular clients, Geth and Parity, to gain insight into the behavior of Ethereum nodes. Based on our observations, we designed a network of controlled Ethereum nodes that we used to analyze transaction propagation in detail. Using this experimental network and data collected with scanning and monitoring utilities for Ethereum’s underlying P2P network [13], we developed a method to infer the origin of a transaction based on timing analysis. To test our method on the network, we created a tool that allows us to generate transactions in a controlled manner, called TxSniper.

In summary, the contributions of this thesis are as follows:

• A case study of the two most popular Ethereum clients, Geth and Parity, to gain insight into the behavior of Ethereum nodes.

• A method to infer the origin of a transaction based on timing analysis of transaction arrival times.

• Development of a tool, TxSniper, to verify our approach to deanonymize the sender of a transaction.

CHAPTER 2

BACKGROUND

Ethereum is a blockchain platform for distributed computing and was the first major blockchain to support Turing-complete scripting via smart contracts, which are expressed as opcodes specific to the Ethereum Virtual Machine (EVM) [14]. Ethereum also operates as a cryptocurrency by supporting the transfer of tokens called Ether between Ethereum accounts. In addition to its use as a fiat currency, Ether is also used to incentivize Ethereum nodes to perform distributed computation. Ether can also be converted to gas, which is used as a fee for executing transactions and smart contracts, and effectively mitigates spam.

Similar to other cryptocurrencies, Ethereum’s blockchain is managed by a peer-to-peer (P2P) network. Ethereum’s network communication is comprised of three different protocols, which run on top of UDP and TCP: RLPx for node discovery and secure transport, DEVp2p for peer connection management, and the Ethereum application-level protocol (henceforth referred to as Ethereum subprotocol). We provide a high-level overview in Figure 2.1 and expand on the pertinent details for each protocol below, drawing upon official specifications [15, 16, 17].

2.1 RLPx

The RLPx protocol is based on Kademlia, a widely used distributed hash table (DHT) [18]. RLPx is used by an Ethereum node in order to help it to discover other potential Ethereum nodes to connect to. In order to do this, each node is assigned a 512-bit node ID, and maintains a routing table for monitoring peer connected nodes and their neighbors. In order for a new Ethereum node to find peers, it first adds some hardcoded bootstrap node IDs into its table. Then, to find a new node on the network, it sends out Bootstrap Node

New Node Peer

FIND_NODE PING/PONG

ECIES Key Exchange

HELLO
STATUS
GET_BLOCK_HEADERS
GET_BLOCK_BODIES
RLPX

DEVp2p Ethereum Subprot.

GET_RECEIPTS
GET_NODE_DATA

Figure 2.1: Ethereum Network Protocols—We provide an overview of RLPx, DEVp2p, and Ethereum subprotocol and display a typical workflow for a new node joining the Ethereum network. These protocols run on top of UDP (dotted-line) and TCP (solid line), through a series of request (solid arrow) and response (hollow arrow) messages. a FINDNODE message with the node ID it is looking for to its peers, which respond with a NEIGHBORS message containing the closest nodes in their routing tables. The querying node will then update its own table with the information (node ID, IP Address, UDP/TCP ports), based on the neighbor nodes sent by each peer. Additionally, the querying node sends out a PING message periodically to the nodes in its table, and all nodes that received the message will reply with a PONG. This process is repeated by the querying node until it finds the target node ID.

2.2 DEVp2p

After peer nodes have been discovered through RLPx and a secure TCP connection is established, DEVp2p negotiates an application session between two connected peers. Each node must first send its peer a HELLO message, which details its own node ID, DEVp2p version, client name, supported application protocols/versions, and the port number (30303 by default) that the node is theoretically listening on. The peers have to exchange the HELLO message and provide their node information in order to establish a DEVp2p connection. Based on HELLO message information, the nodes may begin to transmit application data packets over DEVp2p. During periods of inactivity, DEVp2p nodes will periodically send DEVp2p PING messages (not to be confused with RLPx PING) at an interval set by the client to ensure their connected peers are still active and have not crashed. If a corresponding DEVp2p PONG message is not received within the maximum allowed idle time set by the client, then the node will send a DISCONNECT message, which may include an error code explaining the disconnect.

2.3 Ethereum Subprotocol

The Ethereum subprotocol runs on top of DEVp2p and is denoted as “eth” during DEVp2p HELLO exchange. At a high level, the Ethereum subprotocol is used to retrieve and store information on the Ethereum blockchain. Note that this does not include the details of smart contract execution and Ethereum blockchain mining—rather, we focus on the messages used to communicate blockchain state information over the network. Since the official launch of Ethereum in July 2015 [19], three major versions of the Ethereum subprotocol have been released: 61, 62, and 63. The network initially used version 61, and 62/63 were added in October 2015 [20]. Versions 62/63 became the standard when 61 was disabled in August 2016 [21]. The following description applies to versions 62/63.

The first message that must be sent by both peer nodes after the DEVp2p HELLO handshake is a STATUS message, which conveys the current state of a node’s blockchain. It contains a node’s protocol version, network ID (multiple distinct Ethereum networks exist), and the Keccak-256 hash of the first block in the blockchain, a.k.a. the genesis hash, since there may also be multiple distinct blockchains for a single network ID. The mainstream Ethereum blockchain exists on network ID 1 (i.e. Mainnet) with genesis hash d4e56740...b1cb8fa3, and it supports the DAO fork1 STATUS information is used by nodes to determine which peers they should connect to. If a node encounters a peer that is on a different Ethereum network or genesis hash, it will disconnect from that peer.

Peers that remain connected after STATUS message exchange utilize two additional STATUS message fields to coordinate blockchain syncing: the hash of the most recent block known to a node (i.e. best hash) and the total difficulty of its blockchain. For illustrative purposes, consider a new node joining the Ethereum network. It begins downloading a local copy of the full blockchain by first sending GET BLOCK HEADERS messages to obtain a list of block headers, which include block meta information such as parent block hash, miner address, and a freeform field for extra information, which is used to detect the DAO fork and distinguish between mainstream Ethereum and Ethereum Classic, among other uses. After it has compiled a list of missing block hashes, the node then sends GET BLOCK BODIES messages to retrieve full block contents and verify the validity of the blockchain.

Blockchain validation consists of two general phases: (1) block header validation and (2) blockchain state validation. Block header validation, as defined in section 4.3.4 of the Ethereum Yellow Paper [14], checks a block’s

1The DAO fork is a hard fork that occurred on July 20, 2016 returning approximately $40 million worth of Ether stolen from the DAO contract in June 2016 to a refund smart contract [22]. As a result of the fork, the mainstream Ethereum blockchain split into two, and the non-supporting blockchain became Ethereum Classic.

parent block hash, block number, timestamp, difficulty, gas limit, and valid mix hash, which is the output of the Hashimoto mining algorithm that proves sufficient computation has been carried out on the block. Blockchain state validation consists of sequentially executing all transactions, recording every account’s state in a global database, and inserting each state snapshot as a node in the global Merkle Patricia state tree. Blockchain state validation requires significantly more computation and time than block header validation.

In order to reduce the time for new nodes to synchronize and validate the entire blockchain, Ethereum version 63 introduced fast sync, an optional operational mode which reduces the blockchain state validation workload and improves syncing times by approximately an order of magnitude [23]. After downloading all block headers and bodies, a fast sync node picks a pivot point block that is close to the most recent head of the blockchain. From the genesis block to the pivot point, the node only performs block header validation, and in lieu of blockchain state validation, the node downloads transaction receipts via GET RECEIPTS messages, which retrieve meta information including gas consumption, transaction logs, and status code. At the pivot point, a fast sync node utilizes GET NODE DATA messages to download a global state database at that block. From the pivot point onward, the node performs full blockchain validation.

Once a node has been synced to the blockchain, it can actively participate in the network by announcing and listening to the two possible blockchain events: new transactions and new blocks. In order to add new transaction(s) to the blockchain, an Ethereum node (hereafter referred to as the “transaction origin node”) can broadcast a TRANSACTIONS message to all of its active Ethereum peers. A TRANSACTIONS message typically contains one or more transaction objects, which contain three main fields - sender address, receiver address and amount. However, there are other fields that can be specified, such as GasPrice or Gas, which define how much the sender is willing to pay to get the transaction confirmed on the blockchain. Usually, the higher the GasPrice and Gas specified, the quicker the transaction gets confirmed. For non-origin nodes, upon receipt of a TRANSACTIONS message, all transactions in the message are validated locally to ensure that they are signed properly, do not exceed size/gas limits, do not transact a negative value, and have senders with sufficient Ether/gas. The recipient node then broadcasts valid transactions to all peers except those that are likely to already know about the transaction, i.e. the peers that sent the transaction and the peers that have previously been sent the transaction. New block propagation occurs similarly through NEW BLOCK HASHES and NEW BLOCK messages. The primary difference is that a node with n peers will only broadcast NEW BLOCK to √ n peers, which reduces the network load on individual nodes at the cost of longer overall block propagation times.

CHAPTER 3

METHODOLOGY AND RESULTS

3.1 Case Study

While the documentation for Ethereum’s full network stack (RLPx, DEVp2p, Ethereum subprotocol) defines message formats and functionality, it provides sparse guidance on transaction sending behavior, which can be implemented in a variety of ways. For instance, when a node is broadcasting a set of transactions to its peers using TRANSACTIONS messages, the order and speed of sending can potentially vary based on implementation, and this choice can have drastically different impacts with regards to transaction propagation and confirmation. In order to gain insight into transaction propagation behavior on the network, we deployed and profiled the operation of the two most popular Ethereum clients [24], Go Ethereum (also known as Geth), which is Ethereum’s Golang implementation [25], and Parity, a Rust implementation [26].

From January 24 – February 1, 2018, we instrumented and ran Parity version 1.7.9 with default settings on an Ubuntu 16.04 machine with 128GB RAM, 32 cores, and a 10 Gb/s network link. Similarly from April 1–10, 2018, we instrumented and profiled Geth version 1.7.3 with the same resources as Parity. We recorded all messages sent and received (Figures 3.1 and 3.2), along with any changes in the number of connected peers (Figure 3.3).

200k 400k 600k 800k 1.0M 1.2M 1.4M

Sent

ETH_TX ETH_STATUS ETH_NEW_BLK_HSH ETH_NEW_BLK ETH_GET_RCPT ETH_RCPT ETH_GET_NODE_DATA ETH_NODE_DATA ETH_GET_BLK_HDRS ETH_BLK_HDRS ETH_GET_BLK_BODS ETH_BLK_BODS DEVP2P_PING DEVP2P_PONG DEVP2P_HELLO DEVP2P_DISC RLPX_PING RLPX_PONG RLPX_NEIGHBORS RLPX_FINDNODE

Full sync 200k 400k 600k 800k 1.0M 1.2M 1.4M 04-01 04-02 04-03 04-04 04-05 04-06 04-07 04-08 04-09 04-10

Date Received

ETH_TX ETH_STATUS ETH_NEW_BLK_HSH ETH_NEW_BLK ETH_GET_RCPT ETH_RCPT ETH_GET_NODE_DATA ETH_NODE_DATA ETH_GET_BLK_HDRS ETH_BLK_HDRS ETH_GET_BLK_BODS ETH_BLK_BODS DEVP2P_PING DEVP2P_PONG DEVP2P_HELLO DEVP2P_DISC RLPX_PING RLPX_PONG RLPX_NEIGHBORS RLPX_FINDNODE

Full sync Full sync

Figure 3.1: Geth Message I/O—The counts of messages sent/received by Geth reveal that an overwhelming 84.6% and 79.2% of sent/received messages were TRANSACTIONS messages.

500k 1.0M 1.5M 2.0M 2.5M 3.0M 3.5M 4.0M

Sent

ETH_TX ETH_STATUS ETH_NEW_BLK_HSH ETH_NEW_BLK ETH_GET_RCPT ETH_RCPT ETH_GET_NODE_DATA ETH_NODE_DATA ETH_GET_BLK_HDRS ETH_BLK_HDRS ETH_GET_BLK_BODS ETH_BLK_BODS DEVP2P_PING DEVP2P_PONG DEVP2P_HELLO DEVP2P_DISC RLPX_PING RLPX_PONG RLPX_NEIGHBORS RLPX_FINDNODE

Full sync 500k 1.0M 1.5M 2.0M 2.5M 3.0M 3.5M 4.0M

01-25 01-26 01-27 01-28 01-29 01-30 01-31 02-01

Date Received

ETH_TX ETH_STATUS ETH_NEW_BLK_HSH ETH_NEW_BLK ETH_GET_RCPT ETH_RCPT ETH_GET_NODE_DATA ETH_NODE_DATA ETH_GET_BLK_HDRS ETH_BLK_HDRS ETH_GET_BLK_BODS ETH_BLK_BODS DEVP2P_PING DEVP2P_PONG DEVP2P_HELLO DEVP2P_DISC RLPX_PING RLPX_PONG RLPX_NEIGHBORS RLPX_FINDNODE

Full sync Full sync

Figure 3.2: Parity Message I/O—The counts of messages sent/received by Parity reveal that Parity sends significantly fewer TRANSACTIONS messages than Geth, only 4.6% of sent messages. Parity also displays irregular RLPx PING/PONG spikes.

Days running

Geth Parity

5 10 15 20 25 30 35 40 45 50

1 2 3 4 5 6 7 8 0

Figure 3.3: Peer Counts—Geth and Parity converge to their default 25 and 50 peers, respectively, and remain relatively stable over the course of a week.

From our case study, we made the following observations:

1. Geth and Parity reached their default peer limits in a matter of minutes, with Geth converging to a maximum of 25 peers, and Parity converging to 50 peers (Figure 3.3). A network-encompassing scanner must ignore the hardcoded peer limits to continuously discover new nodes and monitor existing ones. Additionally, even though Geth and Parity nodes were relatively stable—they were at maximum peer occupancy 98.1% and 91.5% of the time, respectively—they still fluctuated enough to provide brief windows of opportunity for a network scanner to connect to them over time. This also gives us insight into the fact that each transaction can be sent to at most 25 peers for Geth, and 50 peers for Parity, which is useful in determining topology as the maximum edges for a node can be either 25 or 50.

2. Once a node has synchronized with the blockchain, TRANSACTIONS messages dominate network I/O. Geth and Parity received similar proportions of TRANSACTIONS messages, but Geth sent significantly more to the network. Examining the source code reveals that while Geth broadcasted transactions to all of its peers, Parity only sent transactions to √ n peers. This difference in the transaction broadcast mechanism highlights a key difference between Geth and Parity, which may be a cause for concern as we apply our technique.

3. To gain a deeper understanding into topology we needed to look at why nodes would disconnect from their peers and to that effect, we examined the DISCONNECT messages (Table 3.1). The most popular disconnect reason for both Geth and Parity was Too many peers, which occurs when connecting to a node that has already reached its maximum peer limit. The next most commonly observed disconnect reasons were Subprotocol error, Disconnect requested, and Useless peer. These indicate either a non-Ethereum protocol on the DEVp2p network, an incompatible Ethereum blockchain (e.g. Ethereum Classic), or a faulty protocol implementation. Because we ultimately aim to measure the functional Ethereum network (i.e. the main network with correct genesis hash and DAO fork), we do not try to reduce these disconnections.

3.2 Private Network Test

In order to gain a full understanding of transaction propagation between multiple nodes, we ran a private network locally that simulated the real Ethereum network. Ethereum, since it is built on top of DEVp2p, allows different networks of Ethereum to exist, but to ensure these other networks do not interact or affect the main network, each network has its own network ID. Due to this, it is possible to create our own private network, specifically for the purpose of understanding transaction propagation. The advantages of this over running on the main network is that we will not be using real money, and we are able to control all nodes that would be on the network. Our goal with this experiment was to identify all factors that would affect transaction propagation times, and we narrowed these factors down to:

• Latency between nodes

• Client processing times, at both the sender and receiver

Our network consisted of 26 nodes in total, all running Geth, and included one miner node that would allow movement of blocks and transactions on the network. Figure 3.4 shows our private network setup, which includes:

• S, the node from which all transactions would originate.

• M , the monitor node at which we track all transactions sent by all other nodes on the network.

• Ri, the relay nodes, which are normal Ethereum nodes which will only propagate transactions.

• M i, the miner node.

Each of these nodes was running Geth version 1.7.3, with modifications to the source code that allowed us to log timing information for each sent and received transaction, on each of the nodes. There were no other modifications to the propagation mechanism, as we wanted to simulate the normal Geth client as much as possible. All nodes were run on the same location, which meant that any latency would be minimal. With this setup, we sent 100 transactions, all originating from node S, and monitored three different times:

Figure 3.4: Private network setup.

• The time between the first transaction being sent and the last transaction being sent on node S.

• The time between receiving a transaction and sending a transaction on the relay nodes Ri.

• The time of arrivals of the transactions at the monitor node M .

This setup ensures that latency delay will not affect any of the transaction processing or transaction propagation times. In order to understand the effect of latency on these times, we conducted the same experiment, but we swapped 25% of the relay nodes with 5 nodes running on an Amazon Web Services (AWS) EC2 instance in a different geographic region. The instance was a T2 unlimited micro1 Ubuntu 16.04 LTS instance equipped with 1 virtual CPU and 1 GB RAM in Asia Pacific Southeast region (Sydney). We performed the same experiment, sending 100 transactions from node S and monitored the same times. Figure 3.5 shows the average times for each of the relay nodes (with 25% of the relay nodes on AWS) to receive a transaction and then send that same transaction.

1https://aws.amazon.com/ec2/instance-types/ Node ID 0.000000 0.200000 0.400000 0.600000 0.800000 1.000000 10

Figure 3.5: Distribution of processing time by node on the private network.

From this we learned the following:

• The time taken by a relay node to process a received transaction and propagate has little impact on the overall transaction propagation time. This time is also unaffected by latency, as this processing is carried out locally, within the client itself.

• The average time at the origin (node S) between sending a transaction to the first peer and the final peer is the same order of magnitude in the case where all nodes are on the same machine (2.8ms), and when 25% of the nodes are running on AWS (2.4ms). This implies that the time between sending the transaction to the first peer and the last peer is minimal, and is unaffected by latency.

3.3 Code Analysis and Testing on Ropsten Network

3.3.1 Code Analysis

To gain insight into transaction propagation from a code perspective, we conducted a code analysis of both the Geth and Parity. We focused on the transaction propagation mechanism only, as that was the only portion of the code that would affect how transactions were sent to peers, and was relevant to our goal of identifying the origin of a transaction.

Figure 3.6: The code for the BroadcastTx function in Geth v1.7.3.

Figure 3.7: The code for the propagate transactions to peers function in Parity v1.7.9.

For Geth, we looked at version 1.7.3, specifically at the BroadcastTx function shown in Figure 3.6. Whenever a transaction is received, it triggers an event which causes this function to be called, passing to it two arguments - hash, which is the hash of the transaction to be broadcasted, and tx, which contains the full transaction information corresponding to hash. We found that Geth sends the transaction to its peers in a loop, which at first led us to believe that this could lead to blocking future sends until the current iteration completes. However, this loop is only write-blocked, which means that blocking only occurs until the message has been sent, and it does not wait for a response from the target. The other observation we made was that the choice of data structure for peers was a map. For a map data structure in Go, the ordering of peers in a loop is randomized, which means that each transaction, even if broadcasted to the same set of peers, will have a unique ordering of peers for the broadcast.

In the case of Parity, we analyzed version 1.7.9, looking at the propagate transactions to peers function. Figure 3.7 shows a portion of the function, where we can see a loop in which the transaction packet is sent to all peers in a lucky peers set. This set lucky peers highlights the major difference between sending transactions in Parity, which unlike Geth, sends a received transaction to a subset of its peers, specifically a random √ n set of its peers who do not already know about the transaction. Parity, similar to Geth, keeps track of which transactions were sent to a peer, and makes sure that it does not select a peer to send to, that already knows about the transaction. Another similarity between Geth and Parity is that both use a map data structure to represent the peers to send the transaction to. An interesting point to note here is that in the Geth code, there is a comment which makes a note to change the peers from accessing all peers in the loop, to a subset of peers, the length determined by √ n of its total peers. As of Geth version 1.8.11, this change has not been implemented.

3.3.2 Ropsten Testing

To do further testing, we set up a Geth node and a Parity node on the Ropsten network. In order to verify our understanding of the code, we performed a simple test to see if the clients behaved in the way we predicted. Our setup involved us running 1 Geth and 1 Parity node, connected to a normal operation Geth node. Using this standard Geth, we connected to the Geth and Parity nodes, and sent them a number of transactions. For the Geth node, we used version 1.7.3, modified to add logging information to both send transaction and receive transaction events. Similarly, we used version 1.7.9 for Parity, with modifications to log send transaction and receive transaction events.

We find that for the Geth client, the behavior matches that of the code, and we also see that the time between a node receiving a transaction and sending that transaction to its peers is much higher than we saw earlier in the case of the private network. The reason for this is due to other nodes sending us transactions at the same time. All the transactions get put into a queue, and each transaction is then sent to its peers from the queue. This means that if a transaction arrives when the queue is empty, the time between receiving and sending will be small, but if the queue is filled, then the time will be much larger.

In the case of Parity, we find that the sent transactions do mirror the code, in that for each send transaction event, it sends to √ n of the total peers. However, for a particular transaction, it makes multiple send events, with each successive send event having fewer peers to send to. From this, we can surmise that eventually, all the peers of the Parity node will receive the transaction, however, it will take longer on average to receive a transaction from a parity node than from a Geth node. This also has implications for using timing analysis to infer transaction origin, because we rely on the fact that a directly connected peer should receive a transaction fastest. However, in the case of Parity, even a directly connected node may receive the transaction much later, if the node is not chosen in the first set of peers to send to.

3.4 Validation

3.4.1 Tools - NodeFinder, EthMonitor, and TxSniper

Validating our hypothesis requires full visibility of Ethereum networks and logging all TRANSACTIONS messages coming from other nodes. Unlike the private network, which is a small P2P network with 26 nodes that we control, real Ethereum networks, such as the main network Homestead and the test network Ropsten, have several hundreds to thousands of nodes that we have no information on. To overcome this challenge, we used NodeFinder and EthMonitor, open-source2 tools for scanning and monitoring Ethereum’s P2P network [13]. NodeFinder identifies active DEVp2p nodes, periodically retrieves their client information (from DEVp2p HELLO) as well as their Ethereum blockchain status (from Ethereum STATUS), and stores every node’s information on a remote database. EthMonitor periodically obtains addresses of all nodes on a target Ethereum network, maintains as many peer connections as possible, and logs details of every TRANSACTIONS message from the peers. Logged details include message arrival timestamp in Unix Epoch time with accuracy up to microseconds, message size, data and hash of each transaction in the message, peer’s node ID in hex, peer’s IP address, and connection latency.

2https://www.github.com/teamnsrg/ethereum-p2p

To identify nodes on Ethereum Mainnet and Ropsten networks, we ran 30 instances of NodeFinder on an Ubuntu 16.04 machine with 128GB RAM, 32 cores, and a 10 Gb/s network link from April 18 to July 9, 2018. On different Ubuntu 16.04 machines with the same hardware specification, we ran 1 instance of EthMonitor for each network and collected TRANSACTIONS messages from peers, from May 6 to July 7 for Ropsten and from June 22 to July 9 for Mainnet. To handle a large number of concurrent peer connections, we increased the system limits on number of open files to 1,048,576 and configured network buffer size and ephemeral port range of TCP as listed below:

net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 net.ipv4.tcp_rmem = 4096 87380 16777216 net.ipv4.tcp_wmem = 4096 65536 16777216 net.ipv4.ip_local_port_range = 1024 65000

Our validation setup also requires an origin node, where we generate new transactions and control their initial propagation routes. To enable this, we built and ran TxSniper, a tool that sends a transaction to one or more selected peers at a time instead of always broadcasting it to all peers. We implemented TxSniper by modifying Geth 1.7.3. We first made the client so that it only connects to and maintains connections with targeted nodes instead of participating in node discovery, just like EthMonitor. Second, we implemented a new function called SnipeTransaction which—unlike the original function SendTransaction—sends a transaction to only the peers whose node IDs are specified in arguments of the function call. We made the function available to users in a form of Javascript API that can be used through the Geth’s built-in Javascript console or RPC requests [27].

3.4.2 Results

Ropsten

In order to perform our test on the Ropsten network, we first created 300 Ethereum accounts on the Ropsten network, which were then each given 1 Ether, using the Ropsten Ethereum Faucet [28]. All of these accounts were

node ID 0 100 200 300

0 5 10 15 20 25 30

Figure 3.8: Average rank over 10 transactions for 30 TxSniper target nodes

- Ropsten.

Figure 3.9: Client distribution of the 30 TxSniper target nodes - Ropsten. created on the TxSniper client, which we would use to send transactions to a single specified node. In addition to having the TxSniper on the network, we set up EthMonitor on Ropsten as well, so that we would have the full monitoring capability in order to log all the messages coming in from the nodes on the Ropsten network. We connected EthMonitor to as many nodes as possible, and selected a random set of 30 nodes which we would use as targets for TxSniper. We ensured that TxSniper connected to all 30 nodes, and then we sniped each node 100 times, which meant that we sent 100 transactions using TxSniper to each of the 30 nodes. This gave us a final set of 3,000 transactions, with 100 transactions being sent to a single target node ID. Once we sent out all 3,000 transactions, we analyzed the logs from EthMonitor. Since we sent the transaction to a single node using TxSniper, that would mean that the target node would be the one to propagate it and since EthMonitor was connected to the target node, EthMonitor should receive it from that node. Since EthMonitor is directly connected to the target node, the first node to send that particular transaction to EthMonitor should be the target node itself. The results of our test on Ropsten are shown in Figure 3.8, which displays the average rank of the sniper targets, for the particular transactions that were sent to them only. As we can see, there are a number of transactions where this hypothesis does not hold true. As we know from earlier experiments, this will fail on Parity nodes, due to their method of propagating transactions to √ n peers. However, there are a large number of Geth nodes where this method does not work. A closer inspection of these nodes reveals that there are many of them that are using various modified versions of the clients as shown in Figure 3.9 due to this being the official Ethereum test network. We think that due to this, there may be additional code running on these clients that might interfere with the propagation mechanism of Geth. In order to verify if this is really true, additional testing needed to be done on the main Ethereum network. Figure 3.10 showcases the ASNs for the nodes that were sniped on Ropsten, along with the node rank. It seems that some of the nodes that are on specific ASNs seem to have a much higher average rank. This could imply that these ASNs might have some restrictions that cause any Ethereum nodes on the network to send transactions slower, such as firewall rules. This explains why some nodes on specific ASNs have a high average rank.

Figure 3.10: ASN distribution of the 30 TxSniper target nodes - Ropsten.

Figure 3.11: Average rank over 10 transactions for 10 TxSniper target nodes - Homestead.

Homestead

Our testing on Homestead, the main Ethereum network, was much more limited in scope than the Ropsten test, due to the fact that transactions require real money on the Mainnet. Because of this, we decided to scale the experiment down to 10 nodes, using TxSniper to send each node 10 transactions for a total of 100 transactions. Figure 3.11 showcases our results with the same experiment on Homestead, displaying average rank of the targeted node IDs. Compared to the previous graph from the Ropsten experiment, we have about 70% of the target nodes that show up as the first node. This shows that it is possible to identify the origin of a transaction, with about 70% probability.

CHAPTER 4

DISCUSSION

4.1 Related Work

Inferring the toplogy of the Bitcoin network is something that has been done in a few studies over the years. Miller et al. [29] introduced a technique that leveraged timestamp leakage from GETADDR and ADDR messages to construct the network topology graph of Bircoin. This study focused only on Bitcoin’s publicly reachable nodes, and this vulnerability in the bitcoind client was fixed in March 2015, rendering the technique ineffective. Neudecker et al. [3] created a new timing analysis-based method to infer Bitcoin’s topology. They used flood analysis, applying maximum likelihood estimation to timing data for each message that arrived from peers to calculate the path lengths between those nodes. This technique works only for nodes that are active on the network and send transactions, which amounted to ˜44% of all peers on the network. In order to enable the attack to work on the entire network, actively inserting transactions is required, which would increase the cost of the attack significantly. These kinds of deanonymization studies have been performed for other cryptocurrencies as well.

Monero is a privacy-centric cryptocurrency that uses a protocol allowing users to obfuscate the sources of transactions, and Moser et al. [30] showed that using “chain-reaction” analysis and age distribution it is possible to deanonymize the sender of a transaction on Monero. This thesis complements these studies by providing a novel technique that can be used to deanonymize senders for Ethereum as well as other cryptocurrencies.

4.2 Limitations

The technique we use relies on the node sending the transaction to its peers as soon as possible. However, as we noted, the Parity client, which is one of the most popular clients on Ethereum, uses a different propagation technique that sends transactions to only a subset of its peers. This means that Parity clients will not reliably forward transactions to our monitor, and so we are unable to determine the origin of transactions coming from Parity clients reliably. Another issue we face is that if there are any nodes that are behind a firewall or NAT, those nodes may not send us messages as quickly as other nodes, due to the firewall. This would cause these nodes to have additional send time, and this would cause problems in identifying these nodes as the origin of a transaction.

4.3 Future Work

This is a relatively new area for Ethereum, as there has not been much research into deanonymizing Ethereum senders. Prior work for Bitcoin does provide a starting point, however, Ethereum’s transaction propagation algorithm is unique and vastly different from Bitcoin. One main improvement on this work is to develop a technique that will allow even origin nodes using Parity to be deanonymized, which would make the entire network susceptible to deanonymization of sender. Another approach would be to increase coverage of the network by using multiple vantage points, which would allow further coverage of the network and would allow analysis of multiple routes taken by a particular transaction. This would help shed light on Ethereum’s peer-to-peer network by revealing the topology of the network, and give information about connectivity of the nodes as well as other network metrics.

CHAPTER 5

CONCLUSION

Due to their ballooning financial value, the robustness (i.e. performance, availability, and security) of cryptocurrencies has recently come under high scrutiny. Recent work investigating the peer-to-peer network underlying Bitcoin has demonstrated that network robustness is imperative for proper blockchain operation. In this thesis, we looked into the transaction propagation mechanisms employed by Ethereum clients, and leveraged that in a novel method to identify the origin of a transaction. We found that for one of the popular clients used by a large majority of the network, the propagation speed is lower, and the propagation technique used by that client is unsuitable for inferring the origin of the client.

Using TxSniper, a tool that allowed us to propagate transactions to only targeted peers instead of all, we validated our sender deanonymization approach on Ethereum’s test network and main network. In the main network, we identified the origin of transactions with 70% probability. We observed that our technique is much less effective in the test network due to the presence of unstable, unexpected client behaviors.

REFERENCES

[1] CoinMarketCap, “Cryptocurrency market capitalizations,” accessed:

2017-11-29. [Online]. Available: https://coinmarketcap.com/

[2] C. Decker and R. Wattenhofer, “Information propagation in the Bitcoin network,” in IEEE P2P Proceedings. IEEE, 2013, pp. 1–10.

[3] T. Neudecker, P. Andelfinger, and H. Hartenstein, “Timing analysis for inferring the topology of the Bitcoin peer-to-peer network,” in IEEE UIC/ATC/ScalCom/CBDCom/IoP/SmartWorld, 2016.

[4] CryptoKitties, “Cryptokitties - collect and breed digital cats,” accessed:

2018-07-01. [Online]. Available: https://www.cryptokitties.co/

[5] V. Buterin, “Ethereum white paper,” accessed: 2017-11-29. [Online].

Available: https://github.com/ethereum/wiki/wiki/White-Paper

[6] L. Luu, D.-H. Chu, H. Olickel, P. Saxena, and A. Hobor, “Making smart contracts smarter,” in ACM CCS, 2016.

[7] M. Bartoletti and L. Pompianu, “An empirical analysis of smart contracts: Platforms, applications, and design patterns,” in Financial Cryptography and Data Security, 2017.

[8] Y. Zhou, D. Kumar, S. Bakshi, J. Mason, A. Miller, and M. Bailey, “Erays: Reverse engineering Ethereum’s opaque smart contracts,” in USENIX Security, 2018.

[9] K. Delmolino, M. Arnett, A. Kosba, A. Miller, and E. Shi, “Step by step towards creating a safe smart contract: Lessons and insights from a cryptocurrency lab,” in Financial Cryptography and Data Security, 2016.

[10] N. Atzei, M. Bartoletti, and T. Cimoli, “A survey of attacks on Ethereum smart contracts (SOK),” in International Conference on Principles of Security and Trust, 2017.

[11] E. Heilman, A. Kendler, A. Zohar, and S. Goldberg, “Eclipse attacks on Bitcoin’s peer-to-peer network,” in USENIX Security, 2015.

[12] K. W¨ust and A. Gervais, “Ethereum eclipse attacks,” ETH Zurich, Tech.

Rep., 2016. [13] S. K. Kim, “Measuring Ethereum’s peer-to-peer network,” M.S. thesis, University of Illinois at Urbana-Champaign, Urbana, 2017.

[14] G. Wood, “Ethereum: A secure decentralised generalised transaction ledger,” accessed: 2017-11-29. [Online]. Available:

http://gavwood.com/paper.pdf [15] V. Buterin, “Ethereum wire protocol,” accessed: 2017-11-12. [Online].

Available: https://github.com/ethereum/wiki/wiki/Ethereum-Wire- Protocol

[16] F.Lange,“DEVp2pwireprotocol,”ac-
cessed:2017-11-12.[Online].Available:

https://github.com/ethereum/wiki/wiki/%C3%90%CE%9EVp2p- Wire-Protocol [17] A. Leverington, “RLPx: Cryptographic network & transport protocol,” accessed: 2017-11-12. [Online]. Available:

https://github.com/ethereum/devp2p/blob/master/rlpx.md [18] P. Maymounkov and D. Mazieres, “Kademlia: A peer-to-peer information system based on the XOR metric,” in International Workshop on Peer-to-Peer Systems. Springer, 2002, pp. 53–65.

[19] J. Ray, “Releases,” accessed: 2018-05-08. [Online]. Available:

https://github.com/ethereum/wiki/wiki/Releases [20] Go-Ethereum, “Release bugfoot (1.2.1),” accessed: 2018-

05-08. [Online]. Available: https://github.com/ethereum/goethereum/releases/tag/1.2.1 [21] Go-Ethereum, “Release minor text fixes (1.4.11),” accessed:

2018-05-08. [Online]. Available: https://github.com/ethereum/goethereum/releases/tag/v1.4.11 [22] M. del Castillo, “Ethereum executes blockchain hard fork to return DAO funds,” accessed: 2018-05-08. [Online]. Available: https://www.coindesk.com/ethereum-executes-blockchain-hard- fork-return-dao-investor-funds/ [23] P. Szil´agyi, “eth/63 fast synchronization algorithm,” accessed:

2018-05-15. [Online]. Available: https://github.com/ethereum/goethereum/pull/1889 [24] ethernodes.org, “The Ethereum node explorer,” accessed: 2017-12-01.

[Online]. Available: https://www.ethernodes.org/network/1 [25] Go-Ethereum, “Go Ethereum,” accessed: 2016-12-11. [Online].

Available: https://github.com/ethereum/go-ethereum

[26] P. Technologies, “Parity - fast, light, and robust Ethereum client,” accessed: 2016-12-11. [Online]. Available:

https://github.com/paritytech/parity

[27] P. Szilgyi, “Management APIs - Ethereum,” accessed: 2017-

11-16. [Online]. Available: https://github.com/ethereum/goethereum/wiki/Management-APIs

[28] S. Ponnet, “Ropsten Ether faucet,” accessed: 2018-04-01. [Online].

Available: http://faucet.ropsten.be:3001/

[29] A. Miller, J. Litton, A. Pachulski, N. Gupta, D. Levin, N. Spring, and B. Bhattacharjee, “Discovering Bitcoins public topology and influential nodes,” 2015.

[30] M. M¨oser, K. Soska, E. Heilman, K. Lee, H. Heffan, S. Srivastava, K. Hogan, J. Hennessey, A. Miller, A. Narayanan et al., “An empirical analysis of traceability in the monero blockchain,” Proceedings on Privacy Enhancing Technologies, vol. 2018, no. 3, pp. 143–163, 2018.