3.1 Ponzi Contract: A Case
One of the main contributions of our work is to manually check the source codes to determine whether a smart contract deploys Ponzi scheme logic. Recall that the key of Ponzi scheme logic is to use the investment of new investors to compensate for the previous investments. Hence, the source code of Ponzi contracts must reflect the same logic. In practice, Ponzi scheme logic can be adopted through various approaches, such as array-based schemes and tree-based schemes introduced in [
1].
The following example illustrates how we recognize Ponzi contracts, in other words, how we determine if a smart contract is a Ponzi contract from source code. The example contract, named Daily12, is a verified Ponzi smart contract with source code available on etherscan.io (one of the most famous Ethereum explorer).
We introduce some interesting characteristics of
Daily12. As shown in Figure
3,
Daily12 is swift: the lifecycle of the contract is only 10 days. The balance of
Daily12 rapidly increased to about 146.59 ETH in 3 days but drops to 0 in the following 7 days. We then download all the transactions of the contract to take an insight into this Ponzi contract. According to our statistics, 171.04 ETH had been involved in
Daily12 (now about $219,782.98), which is a considerable amount of money. These characteristics encounter our motivation to identify the Ponzi contract at the creation time. To the best of our knowledge, the key component of the existing method is the transaction record of a contract. However, the time for collecting sufficient records may be long enough for a swift Ponzi contract like
Daily12 to complete its lifecycle. Therefore, the detection result based on transactions is not that much meaningful as it seems.
The contract has made a seductive claim to attract participants. It promotes itself by claiming that the participants would gain 12% of their investments every day and they could withdraw the profits at any time:
However, the propaganda does not reflect the nature of
Daily12. The contract has made its source code available on the
etherscan.io to win the trust of the participants. In this sense, we reveal how the Ponzi logic is implemented by Daily12 source code shown in Figure
4.
The source code of Daily12 is brief and concise. Like most traditional Ponzi schemes, the contract would record the investments of participants (line 2). The mapping variable in line 3 records the time that the participants last retrieved their profits. Next, the function in line 4–11 reflects the critical logic of the Ponzi contract. Once the contract receives a transaction, it computes the 12% of the sender’s investment scaled by the time interval (line 6), and transfer the profit back to the sender (line 7), where the so-called profit comes from the investment of the participants.
It could be seen that the payback window size is about 8.3 days, since 100%/12% = 8.33. A participant was able to earn the investment back after 8.33 days, as long as the contract had enough balance. If there is even remaining balance, i.e., there are latter investment, an investor can earn from these investment.
Winning or losing in the Ponzi contract depends on whether there are latter investors. The key is to continuously attract new investors. Daily12 adopted the “12%” trick. In the first 8.33 days, Daily12 uses 12% of the participant’s investment to pay back to him/her, causing an illusion that the payback is stable and continuous. Due to this seeming long life cycle, the contract even received about 0.11 ETH on the last day. However, it could be interpreted that the contract had to use the investment of latter participants to compensate for the profit after running out of the investment of the previous.
This mechanism leads to the fact that only the earlier participants could win in the Ponzi contract. Figure
5 shows the ether flow of the smart contract. The ether flow graph is introduced to visualize the transactions involved in a smart contract. Three types of transactions are encoded in the graph: investment, payback, and profit. These types of transactions are denoted by blue circles, green squares and orange triangles, respectively. Only those who earned from the contract chould receive profit transactions (i.e., orange triangles in the graph). The amount of ether involved in these transactions are reflected by the size of the circles. The x-axis represents the time line, while the y-axis represents individual participants. There are also two lines in the figure. The solid line is the regression line of investments and the dotted line is the regression line of first profit transaction for each investor. Several insights come with the two lines: (1) The dotted line roughly splits the payback area (green) and profit area (orange). Investors can only get profit from the orange area below the dotted line. A number of investors have no transactions below the dotted line, meaning that they are victims of the Ponzi contract; (2) The two lines are parallel, indicating the payback window of 8.33 days. And the left margin of orange area have composed another parallel line of payback. Notably, most of the earned participants had made their first investment in the early stage of the contract. The fact is that only those investments before block height 6547454 (the contract lifetime minus the payback window size) have a chance to earn from the contract. Unfortunately, some early investors still lost their money. They reinvested the contract several times after their first investment. Apparently, they did not understand the degenerating nature behind the seemingly high and stable profit.
The Daily12 example shows that a Ponzi contract can be swift but may involve a considerable amount of money. Detection methods based on transaction records have weak constraints on these contracts, since the contracts may have completed their life cycle before sufficient transaction records are collected. Therefore, it is significant to develop a detection method independent of transaction records.
3.3 Problem Definition
Since smart contracts are the building blocks of DApps, the identification of smart Ponzi schemes is essentially the identification of whether any contracts it contains are Ponzi schemes or not. Let \(C = \lbrace c_1, c_2 \ldots ,c_n\rbrace\) be a set of smart contracts with labels \(L = \lbrace l_1, l_2,\ldots , l_n\rbrace\), where n is the number of contracts. The contracts labeled with \(-\)1 (i.e., negative) are non-Ponzi contracts, while contracts labeled with 1 (i.e., positive) are Ponzi contracts. Let \(D = \lbrace d_1, d_2,\ldots , d_n\rbrace\) be the set of developer information of the corresponding contracts, where the developer information of a certain contract is composed of its creator address and the height of the creation block. Let \(B = \lbrace b_1, b_2, \ldots , b_n\rbrace\) be the bytecode of the corresponding contracts. The task of our work is to construct a high-performance classification model to classify given contracts into non-Ponzi contracts or Ponzi contracts, where only bytecode B and developer information D are used for classification.