friend_tech 套利到底有多卷

背景

最近有准备搞一下friend tech的套利…

就写个 sql看看目前有多少人盈利.这个数据不会基于没有卖出去的key

数据在这friend tech top profit

按照盈利金额排序

按照亏损金额排序

头几个盈利的肯定是机器人账号.就看看他们的数据,这一看就发现了一些问题.

数据分析

所有的数据基于block 411977,真实用户0xda, 购买 tx

数据长这样

1
2
3
4
5
6
7
8
9
10
11
12

from nonce to transactionIndex gasPrice gasFee status new_status
0 0xa3afA500e3d88CAfA41AA7B95a8dEF7d2CBce92b 94166 0xfF231524719dB94a0Ef08A88fC4e6939134EadE8 1 125469887 24349517231279 0 0
1 0x135557B95fc164cB152e853568b25880Ba06F94A 9487 0x4Ff30D7222B852c67A66Dc8E8d56A8cf92B8411c 2 125469887 23946164139867 0 0
2 0x8ac85761268B9Ac3fDe06d381611b64B232CEa97 66293 0x4Ff30D7222B852c67A66Dc8E8d56A8cf92B8411c 3 125469887 23975035551359 0 0
3 0x1BA4C73e7831b8099377c0583acfF4DBE488dFc6 16626 0x4C99B25DdD0887D88b6C1364E3Df63a3bE76A5c3 4 125469887 24287970299239 0 0
4 0xa92a6331d0174c0eDC463B097E8564a492D451FA 93609 0xfF231524719dB94a0Ef08A88fC4e6939134EadE8 5 125469887 24349517231279 0 0
5 0x9a34845CCBeA93925B15F5af6d9F4aFae4EC590a 93755 0xfF231524719dB94a0Ef08A88fC4e6939134EadE8 6 125469887 24349517231279 0 0
6 0x5ED1222A1c0BdBA479B61201231f539ac131DD69 64131 0x4C99B25DdD0887D88b6C1364E3Df63a3bE76A5c3 7 125469887 24287970299239 0 0
7 0xe8C5433d6E8Fc7a2b38eF0391FabA7470c9576e4 5142 0x4C99B25DdD0887D88b6C1364E3Df63a3bE76A5c3 8 125469887 24287970299239 0 0
8 0x38Cd1a8474A948a5a3e4d4b06c4069F2116DD184 85574 0x4Ff30D7222B852c67A66Dc8E8d56A8cf92B8411c 9 125469887 24061649785835 0 0
9 0x3c2c170296446e241dE2eE39d7036254d55Df9E4 93602 0xfF231524719dB94a0Ef08A88fC4e6939134EadE8 10 125469887 24262902996803 0 0

交易数量

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import json
import pandas as pd

from hexbytes import HexBytes

with open('4119771_da681.json') as f:
txs = json.loads(f.read())

def filter_da68(txs):
flashruntxs = []
for tx in txs:
_input = tx["input"]
if "da68ee" in _input:
flashruntxs.append(
{
"from": tx["from"],
"nonce": tx["nonce"],
"to": tx["to"],
"transactionIndex": tx["transactionIndex"],
"gasPrice": tx["gasPrice"],
"gasFee": tx["gasFee"],
"status": tx["status"],
}
)
return flashruntxs

da68 = filter_da68(txs)

len(da68),len(txs)

(506, 517)

可以看到整个区块交易517 条,其中和da68相关的 506. 就非常离谱,97.87%的用户都是来抢跑的.

一共有多少机器人?

我们这边按照合约地址分一下类. 可以看到有几个头部机器人.
前3 占了大部分交易.

1
2
3
4
5
6
7
8
9
10
11
to_count = df['to'].value_counts()
to_count

0x4C99B25DdD0887D88b6C1364E3Df63a3bE76A5c3 184
0xfF231524719dB94a0Ef08A88fC4e6939134EadE8 161
0x4Ff30D7222B852c67A66Dc8E8d56A8cf92B8411c 123
0xCF205808Ed36593aa40a44F10c7f7C2F67d4A4d4 19
0xe27ddadbC8779D01fC539Bf5BA8529D728418625 9
0x27E8A5B043d3f58dde1c7ab96d2E3cF07558A1f1 8
0xAfE6795A9097BbCE00fe61462d22CCeeF706a3e8 2
Name: to, dtype: int64

看看这几个机器人花了多少gas费,没想到发送 184 条交易才花 7.69刀.

1
2
3
4
5
6
7
8
9
10
11
12
13
ethprice = 1640
for to in to_count.index:
tteth = sum(df[df.to==to].gasFee)/1e18
ttusd = tteth*ethprice
print(tteth,ttusd)

0.004690181471662096 7.691897613525838
0.004104812550636566 6.731892583043968
0.003097893590529322 5.080545488468088
0.000457215606189089 0.749833594150106
0.000226412037571068 0.3713157416165515
0.00017632952477182 0.2891804206257848
5.0244385725274e-05 0.08240079258944936

再看看这些机器人有多少小号
有发现几个菜鸟机器人…

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
for to in to_count.index:
print('to:',to)
print(df[df.to==to]['from'].value_counts())
print()
print('#'*30)


to: 0x4C99B25DdD0887D88b6C1364E3Df63a3bE76A5c3
0x5ED1222A1c0BdBA479B61201231f539ac131DD69 27
0x1BA4C73e7831b8099377c0583acfF4DBE488dFc6 26
0xd9E4b9579a5CF5B336E258820CC95cA34411c9D6 26
0x27C2a598Db389b5276c0156f14B4dE75E490712F 26
0xe8C5433d6E8Fc7a2b38eF0391FabA7470c9576e4 24
0xDd2B7694259a83753918BF5b6dC6961fabd2FDbC 24
0xC81a00ee6839EE0dFbF465d3C08E5F0b0291b71A 20
0x3Ee2183b706cf381e7e4586b8063a779f1E7b7dA 11
Name: from, dtype: int64

##############################
to: 0xfF231524719dB94a0Ef08A88fC4e6939134EadE8
0xa3afA500e3d88CAfA41AA7B95a8dEF7d2CBce92b 9
0xa92a6331d0174c0eDC463B097E8564a492D451FA 9
0x2bE3973950D0F1951E12C21bC7bB8e2428101Fdd 9
0x63cEe818600f91C4473CD14cDfD9C10d918B587b 9
0x92c21dB4a7cC0302ccCb71d444aE674Ec3980c93 9
0xCb44B9062eB0Cd22c4C0701385e6482BF4a77759 9
0x57ae46a097751124f8c35A86f64B4c38d2C62675 9
0x8eE3847cAE34e6e0292dc3DF8DD3C0C69a266b97 9
0x807db242cD37b5E2B53697842197611f51693C06 9
0xDb6f56639AaeA09FfEA6080D31A32851524128d4 9
0x9D94BdAf42d7906b3D3c011053ed2cBF42A1cA3f 9
0x244Fb415A8765812B9bc5B52cA14fd83C9d7E0e5 9
0xF689ac0322786Ac2D7245Fcd665fe120ff1d0408 9
0x895D2d10FB9b92D0e1002c1a1bCdb90Ed42c3588 9
0xF53010525Df586e78b14114C9cd05481E79E6C8C 9
0x3c2c170296446e241dE2eE39d7036254d55Df9E4 9
0x9a34845CCBeA93925B15F5af6d9F4aFae4EC590a 9
0x36da68690F238366156890010c411394FC529cd9 8
Name: from, dtype: int64

##############################
to: 0x4Ff30D7222B852c67A66Dc8E8d56A8cf92B8411c
0x8ac85761268B9Ac3fDe06d381611b64B232CEa97 13
0x135557B95fc164cB152e853568b25880Ba06F94A 12
0x38Cd1a8474A948a5a3e4d4b06c4069F2116DD184 12
0x3547DbcD816bc17D7dE0e7e67a8B8bEE74384ACF 12
0xa9ff99346829E7c578E6d38C2269997a2FCcEEE1 12
0xd65eD99CB8b3b65CE378e3E5CaE545B751f4DAc6 11
0x1F238B47ab9fD915e5852601E83c6c1358297870 11
0x75Ff68BDe78974ab54a642fD294369447bD9Feef 10
0xf1E7E7Ad07C046abb6e488F73c126B897892755c 10
0x76eF08c772Db73E05fa00398746FbA31eFC5804F 10
0x7CfE232Ed8b0acc111ec780b7Cb95C68f3CF7Aa6 10
Name: from, dtype: int64

##############################
to: 0xCF205808Ed36593aa40a44F10c7f7C2F67d4A4d4
0x188eCF8f4290C4e5d641449B88CEf94574174972 15
0xDa68EEe4c5b10D8A574b9ec072335c583B1C67A2 1
0xbEbA981C5697b1CFa7c04fCB523E94bD42F79afB 1
0x40954b9B4bAfC41Ec6387325fD0069C68674a04d 1
0x296D3324Ee4b2316E87f965F4A04F073780f5310 1
Name: from, dtype: int64

##############################
to: 0xe27ddadbC8779D01fC539Bf5BA8529D728418625
0xeFa4b454A64049ff93cC37b54102982ACEdf4Eae 9
Name: from, dtype: int64

##############################
to: 0x27E8A5B043d3f58dde1c7ab96d2E3cF07558A1f1
0x8b113ad5c2b2E3ddb102305e32259c6b23D12aa3 4
0x89B5BB48f016b809EB2eE78416550487334C1331 4
Name: from, dtype: int64

##############################
to: 0xAfE6795A9097BbCE00fe61462d22CCeeF706a3e8
0xC1322133ACbAd823614bf79Ca9eC409fA3A7E39A 2
Name: from, dtype: int64

##############################

最后总览看看

26是用户的交易.可以看到所有的 gasPrice都和用户的一样…

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 筛选出 transactionIndex 在 16-40 范围内的数据
filtered_df = df[(df['transactionIndex'] >= 16) & (df['transactionIndex'] <= 36)]

# 按照 transactionIndex 从小到大排序
sorted_df = filtered_df.sort_values(by='transactionIndex')

def highlight_row(row):
if row['transactionIndex'] == 26:
return ['background-color: yellow'] * len(row)
else:
return [''] * len(row)

highlighted_df = filtered_df.style.apply(highlight_row, axis=1)
highlighted_df


from nonce to transactionIndex gasPrice gasFee status
15 0xa9ff99346829E7c578E6d38C2269997a2FCcEEE1 73039 0x4Ff30D7222B852c67A66Dc8E8d56A8cf92B8411c 16 125469887 24061649785835 0
16 0x895D2d10FB9b92D0e1002c1a1bCdb90Ed42c3588 94987 0xfF231524719dB94a0Ef08A88fC4e6939134EadE8 17 125469887 24349517231279 0
17 0xDd2B7694259a83753918BF5b6dC6961fabd2FDbC 3180 0x4C99B25DdD0887D88b6C1364E3Df63a3bE76A5c3 18 125469887 24287970299239 0
18 0xF689ac0322786Ac2D7245Fcd665fe120ff1d0408 94382 0xfF231524719dB94a0Ef08A88fC4e6939134EadE8 19 125469887 24349517231279 0
19 0xC81a00ee6839EE0dFbF465d3C08E5F0b0291b71A 2708 0x4C99B25DdD0887D88b6C1364E3Df63a3bE76A5c3 20 125469887 24287970299239 0
20 0x244Fb415A8765812B9bc5B52cA14fd83C9d7E0e5 56203 0xfF231524719dB94a0Ef08A88fC4e6939134EadE8 21 125469887 24234031585311 0
21 0x5ED1222A1c0BdBA479B61201231f539ac131DD69 64132 0x4C99B25DdD0887D88b6C1364E3Df63a3bE76A5c3 22 125469887 24287970299239 0
22 0xeFa4b454A64049ff93cC37b54102982ACEdf4Eae 6682 0xe27ddadbC8779D01fC539Bf5BA8529D728418625 23 125469887 23374811326750 1
23 0x1BA4C73e7831b8099377c0583acfF4DBE488dFc6 16627 0x4C99B25DdD0887D88b6C1364E3Df63a3bE76A5c3 24 125469887 24201356064763 0
24 0xd65eD99CB8b3b65CE378e3E5CaE545B751f4DAc6 66063 0x4Ff30D7222B852c67A66Dc8E8d56A8cf92B8411c 25 125469887 24061649785835 0
25 0xDa68EEe4c5b10D8A574b9ec072335c583B1C67A2 0 0xCF205808Ed36593aa40a44F10c7f7C2F67d4A4d4 26 125469887 28895454735018 1
26 0x9D94BdAf42d7906b3D3c011053ed2cBF42A1cA3f 55712 0xfF231524719dB94a0Ef08A88fC4e6939134EadE8 27 125469887 33659956846186 1
27 0xe8C5433d6E8Fc7a2b38eF0391FabA7470c9576e4 5143 0x4C99B25DdD0887D88b6C1364E3Df63a3bE76A5c3 28 125469887 25586583629689 0
28 0xd9E4b9579a5CF5B336E258820CC95cA34411c9D6 7656 0x4C99B25DdD0887D88b6C1364E3Df63a3bE76A5c3 29 125469887 25586583629689 0
29 0x1F238B47ab9fD915e5852601E83c6c1358297870 188626 0x4Ff30D7222B852c67A66Dc8E8d56A8cf92B8411c 30 125469887 25293638606288 0
30 0xDb6f56639AaeA09FfEA6080D31A32851524128d4 55742 0xfF231524719dB94a0Ef08A88fC4e6939134EadE8 31 125469887 25474803297854 0
31 0x27C2a598Db389b5276c0156f14B4dE75E490712F 8112 0x4C99B25DdD0887D88b6C1364E3Df63a3bE76A5c3 32 125469887 25586583629689 0
32 0x8ac85761268B9Ac3fDe06d381611b64B232CEa97 66294 0x4Ff30D7222B852c67A66Dc8E8d56A8cf92B8411c 33 125469887 25293638606288 0
33 0x75Ff68BDe78974ab54a642fD294369447bD9Feef 74796 0x4Ff30D7222B852c67A66Dc8E8d56A8cf92B8411c 34 125469887 25207024371812 0
34 0xDd2B7694259a83753918BF5b6dC6961fabd2FDbC 3181 0x4C99B25DdD0887D88b6C1364E3Df63a3bE76A5c3 35 125469887 25586583629689 0
35 0x807db242cD37b5E2B53697842197611f51693C06 55979 0xfF231524719dB94a0Ef08A88fC4e6939134EadE8 36 125469887 25474803297854 0

代码以及相关数据下载

https://github.com/jin10086/friend-tech-bot-analyze

推荐文章