Skip to content

Commit 36b82ef

Browse files
authored
Merge pull request #629 from input-output-hk/bwbush/mempool-2
Measurement and analysis of mainnet memory pool Fixes #644
2 parents 2a289be + 175c8ae commit 36b82ef

File tree

8 files changed

+3315
-504
lines changed

8 files changed

+3315
-504
lines changed

analysis/sims/kernels.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,15 @@ in
2727
curl
2828
data_table
2929
dplyr
30+
geosphere
3031
ggpattern
3132
ggplot2
3233
ggExtra
3334
igraph
35+
ltsa
3436
lubridate
37+
mapproj
38+
maps
3539
mongolite
3640
poibin
3741
quantreg

post-cip/mempool-measurements/Exploratory analysis.ipynb

Lines changed: 2442 additions & 0 deletions
Large diffs are not rendered by default.

post-cip/mempool-measurements/Preliminary exploratory analysis.ipynb

Lines changed: 519 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Empirical, anecdotal analysis of mainnet memory pool
2+
3+
This experiment collects data on the memory pool and blocks from instrumented nodes in three AWS regions.
4+
5+
6+
## Artifacts
7+
8+
- [template.tar.gz](template.tar.gz): Configuration files for setting up the nodes.
9+
- [fetch-logs.sh](fetch-logs.sh): Shell script for retrieving logs from the remote nodes.
10+
- [process-log.sh](process-log.sh): Shell script for processing the raw logs into `.tsv` files.
11+
- [process-log.sql](process-log.sql): SQL script for processing the raw logs into `.tsv` files.
12+
- [analysis.ipynb](analysis.ipynb): Jupyter R notebook for analyzing and plotting the results.

post-cip/mempool-measurements/analysis.ipynb

Lines changed: 0 additions & 496 deletions
This file was deleted.
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
#!/usr/bin/env bash
2+
3+
4+
export PATH=/extra/iohk/bin:$PATH
5+
export CARDANO_NODE_NETWORK_ID=mainnet
6+
export CARDANO_NODE_SOCKET_PATH=/extra/iohk/networks/mainnet/node.socket
7+
8+
9+
# First experiment
10+
11+
for i in {0..19}
12+
do
13+
echo -n "$i: "
14+
head -c 1536 /dev/urandom | basenc --base16 --wrap=128 | sed -e 's/^.*$/{"bytes":"&"}/' -e '2,$s/^/, /' -e '$a]}}' -e '1s/^/ /' -e '1i{"1536":{"list":[' > "tx-$i.metadata"
15+
cardano-cli conway transaction build \
16+
--tx-in "fa7c2496cff58610c92ee8fb0a8800d336e144d60e1e13155cc52c120e605bb7#$i" \
17+
--change-address addr1qy9prvx8ufwutkwxx9cmmuuajaqmjqwujqlp9d8pvg6gupcvluken35ncjnu0puetf5jvttedkze02d5kf890kquh60sut9jg7 \
18+
--json-metadata-detailed-schema \
19+
--metadata-json-file "tx-$i.metadata" \
20+
--out-file "tx-$i.unsigned"
21+
cardano-cli conway transaction sign \
22+
--signing-key-file payment.skey \
23+
--tx-body-file "tx-$i.unsigned" \
24+
--out-file "tx-$i.signed"
25+
cardano-cli conway transaction txid \
26+
--tx-file "tx-$i.signed" \
27+
> "tx-$i.txid"
28+
done
29+
30+
for i in {0..19}
31+
do
32+
(
33+
cardano-cli conway transaction submit --tx-file "tx-$i.signed"
34+
date -u > "tx-$i.submitted"
35+
) &
36+
done
37+
wait
38+
39+
# Wed Nov 26 02:01:16 PM UTC 2025
40+
41+
# 9161c5cd50f2fedc5e2c86ad17720b03f8cc232cee3cf39d073f6695da2697e7
42+
# 59b7d5965f7ccaf31c207999d48478ec112c2a8c1a18d076d56ecae14d6045af
43+
# 62f7aa82f8aa193c6a181ccb0ae050e037fa91e01a82acc09725a7ff2b4b5999
44+
# 5cc3dc20a744338a713709303eeae9fccc4b035e4b9b1aeaf483479125a7a030
45+
# 1f176c316231e138623364a4bed8574ceb070b2562c6867cf012e1c2cded6d7d
46+
# 6d71d94cffbffc9667925db20f13d4f060f67826fb3d541edbe79d86c58ea6d1
47+
# 0ed21a6ff7e05561a73ebe454cbfc7bbea04c443529c23ec6440bb29724bcb4f
48+
# 860cb1697749d2ab49bca6219d50b05b2da2c4183cae32fa4ed3d2be8870fe70
49+
# 8304148164ed0f943aa502173879bd66f0da18d22860c0b754acd9b894aa784d
50+
# 95960b004be8e5b889f1df1ec29356e061ebf9577b83a68a193d3f6aeb11b4ea
51+
# 98f0d4138828af650c871a8f142d46886ddb05231eb2c68876b5e60b735c2b2e
52+
# aff3e9160b309eefdf05ce8755bb075929315b1cdb68e1456fae0c8f5e723636
53+
# fdec199a2d69145fe191498e3225b595e10d459a99a05253cfd6b333f6d27db6
54+
# f30a474797b6f0ed878aca7b06c8895ccd24660b389045f097aeb07afc69fa97
55+
# 9ce69e0b5f63fdc9480f85a06977e86e2e1230b2815d7490de5192672c89e3cf
56+
# a553692d0e5df1a8699f4de3bca2e2aad0dc2d7383c244a887d870c32aab5a1a
57+
# c3db88205930be7012f0b37e64870d6f4817449f4de36c963cb01bd73bc78c5d
58+
# 94124f0a7df8ad4b1cae4d374ba145d547bda5ebee44e6a767e955f649aeb593
59+
# 711d440f3cacafe0db344e7065f60f7482d180326cf0387c6a625f16be0248da
60+
# d2c6825db389345be7be53bc34b6e77e76a46473608092075a7577aead94252b
61+
62+
63+
# Second experiment
64+
65+
for i in {0..19}
66+
do
67+
echo -n "$i: "
68+
head -c 8192 /dev/urandom | basenc --base16 --wrap=128 | sed -e 's/^.*$/{"bytes":"&"}/' -e '2,$s/^/, /' -e '$a]}}' -e '1s/^/ /' -e '1i{"1536":{"list":[' > "tx-$i.metadata"
69+
cardano-cli conway transaction build \
70+
--tx-in "3a22614b95bea58c73152c28b360ecf42e24c90045fd8bff068de76c932415c1#$i" \
71+
--change-address addr1qy9prvx8ufwutkwxx9cmmuuajaqmjqwujqlp9d8pvg6gupcvluken35ncjnu0puetf5jvttedkze02d5kf890kquh60sut9jg7 \
72+
--json-metadata-detailed-schema \
73+
--metadata-json-file "tx-$i.metadata" \
74+
--out-file "tx-$i.unsigned"
75+
cardano-cli conway transaction sign \
76+
--signing-key-file payment.skey \
77+
--tx-body-file "tx-$i.unsigned" \
78+
--out-file "tx-$i.signed"
79+
cardano-cli conway transaction txid \
80+
--tx-file "tx-$i.signed" \
81+
> "tx-$i.txid"
82+
done
83+
84+
for i in {0..19}
85+
do
86+
(
87+
cardano-cli conway transaction submit --tx-file "tx-$i.signed"
88+
date -u > "tx-$i.submitted"
89+
) &
90+
sleep 0.05s
91+
done
92+
wait
93+
94+
# 12be7f48a0bdd33a62df89c44b1ef6810d4d54ea26e7a4bf4c43e1fa3d8aa18f : Wed Nov 26 02:23:16 PM UTC 2025
95+
# 4906885ebf56d0806119f2d57128a9d20aa90867912a67f2faf6705be3febf6f : Wed Nov 26 02:23:16 PM UTC 2025
96+
# d8343e735a6fb5512bdd68fa076525ae7815fb7acd649cd11d927a7186fb6b30 : Wed Nov 26 02:23:16 PM UTC 2025
97+
# 315c821bd42e69fd03425aab4564408bcdf9ce0de6e8f551259011a8aaac650a : Wed Nov 26 02:23:16 PM UTC 2025
98+
# fa2a8d3824f0674f830889f2b1b0c9f998a610a7723c9a73cf7ca6b5b57f7f28 : Wed Nov 26 02:23:16 PM UTC 2025
99+
# 93fb26a1fde07afd41d86f2bb802dc7cd14827de5eac7094ab746dbdb77c2f06 : Wed Nov 26 02:23:16 PM UTC 2025
100+
# 0f55de2cd1cc3354297c855eb4ea62c4d6cf30e26fe9e010b9697bd553336e6c : Wed Nov 26 02:23:16 PM UTC 2025
101+
# 68b2fb3763882dddd54867769ad2b6cd2cdb25bba93d36fef2d8253d5149873d : Wed Nov 26 02:23:17 PM UTC 2025
102+
# d51d5d9ed2663194224596fb0c1a5e125f55647866a44ad9d3fc783a24ac504e : Wed Nov 26 02:23:17 PM UTC 2025
103+
# 80e714ae65fdc9d6725402629624fd7d11b0cafd876de397496304e2423d6ff7 : Wed Nov 26 02:23:17 PM UTC 2025
104+
# 2f93d4bade70efb1459923d14b1d5380565bd0313a9850b69c6b91c58451c205 : Wed Nov 26 02:23:17 PM UTC 2025
105+
# 72723e169663f43ac7d2ff2a0fbe919a24cb68c7508b2ad27f373dabd404ab99 : Wed Nov 26 02:23:17 PM UTC 2025
106+
# e9ffc14e92baccadc6d734630b3675c3d60ffbe2650135684af2fe409e297f40 : Wed Nov 26 02:23:17 PM UTC 2025
107+
# 563fc090ddace40cd0ec03f7812cd78aa4d946958ee5c74f9ad340b6ebb5b9d7 : Wed Nov 26 02:23:17 PM UTC 2025
108+
# 3753370103e9cddccf11de6915922147daf0430422c4708e8f9d8a794ee8ad47 : Wed Nov 26 02:23:17 PM UTC 2025
109+
# d798ed9489cdd977fa2155894edc27d3cb0137fcdb9454133448a242383e1384 : Wed Nov 26 02:23:17 PM UTC 2025
110+
# 6f9c85a92c040bd8a6c15d8242a5aadb25b6314fa3206dd40a380dfbd9671d5e : Wed Nov 26 02:23:17 PM UTC 2025
111+
# 5f63700878516370ecce4582e078865087cc7aa1646fe7fc06906d5f63ca9109 : Wed Nov 26 02:23:17 PM UTC 2025
112+
# 56d345d0c94ed0fce3b0ff6504d5215931133b3f30eb330b21f1855faedc77fa : Wed Nov 26 02:23:17 PM UTC 2025
113+
114+
115+
# Expenses
116+
117+
psql -h thelio mainnet
118+
select distinct
119+
block.time
120+
, encode(tx.hash, 'hex') as tx_hash
121+
, tx.fee
122+
from tx
123+
inner join block
124+
on block.id = tx.block_id
125+
inner join tx_in
126+
on tx_in.tx_in_id = tx.id
127+
inner join tx_out
128+
on (tx_out.tx_id, tx_out.index) = (tx_in.tx_out_id, tx_out_index)
129+
where block.time >= '2025-11-26 12:00:00'
130+
and tx_out.address = 'addr1qy9prvx8ufwutkwxx9cmmuuajaqmjqwujqlp9d8pvg6gupcvluken35ncjnu0puetf5jvttedkze02d5kf890kquh60sut9jg7'
131+
order by 1, 2
132+
;
133+
EOI
134+
135+
# time | tx_hash | fee
136+
# ---------------------+------------------------------------------------------------------+--------
137+
# 2025-11-26 13:34:05 | fa7c2496cff58610c92ee8fb0a8800d336e144d60e1e13155cc52c120e605bb7 | 251169
138+
# 2025-11-26 14:01:19 | 0ed21a6ff7e05561a73ebe454cbfc7bbea04c443529c23ec6440bb29724bcb4f | 241533
139+
# 2025-11-26 14:01:19 | 1f176c316231e138623364a4bed8574ceb070b2562c6867cf012e1c2cded6d7d | 241533
140+
# 2025-11-26 14:01:19 | 59b7d5965f7ccaf31c207999d48478ec112c2a8c1a18d076d56ecae14d6045af | 241533
141+
# 2025-11-26 14:01:19 | 5cc3dc20a744338a713709303eeae9fccc4b035e4b9b1aeaf483479125a7a030 | 241533
142+
# 2025-11-26 14:01:19 | 62f7aa82f8aa193c6a181ccb0ae050e037fa91e01a82acc09725a7ff2b4b5999 | 241533
143+
# 2025-11-26 14:01:19 | 6d71d94cffbffc9667925db20f13d4f060f67826fb3d541edbe79d86c58ea6d1 | 241533
144+
# 2025-11-26 14:01:19 | 711d440f3cacafe0db344e7065f60f7482d180326cf0387c6a625f16be0248da | 241533
145+
# 2025-11-26 14:01:19 | 8304148164ed0f943aa502173879bd66f0da18d22860c0b754acd9b894aa784d | 241533
146+
# 2025-11-26 14:01:19 | 860cb1697749d2ab49bca6219d50b05b2da2c4183cae32fa4ed3d2be8870fe70 | 241533
147+
# 2025-11-26 14:01:19 | 9161c5cd50f2fedc5e2c86ad17720b03f8cc232cee3cf39d073f6695da2697e7 | 241533
148+
# 2025-11-26 14:01:19 | 94124f0a7df8ad4b1cae4d374ba145d547bda5ebee44e6a767e955f649aeb593 | 241533
149+
# 2025-11-26 14:01:19 | 95960b004be8e5b889f1df1ec29356e061ebf9577b83a68a193d3f6aeb11b4ea | 241533
150+
# 2025-11-26 14:01:19 | 9ce69e0b5f63fdc9480f85a06977e86e2e1230b2815d7490de5192672c89e3cf | 241533
151+
# 2025-11-26 14:01:19 | a553692d0e5df1a8699f4de3bca2e2aad0dc2d7383c244a887d870c32aab5a1a | 241533
152+
# 2025-11-26 14:01:19 | aff3e9160b309eefdf05ce8755bb075929315b1cdb68e1456fae0c8f5e723636 | 241533
153+
# 2025-11-26 14:01:19 | c3db88205930be7012f0b37e64870d6f4817449f4de36c963cb01bd73bc78c5d | 241533
154+
# 2025-11-26 14:01:19 | d2c6825db389345be7be53bc34b6e77e76a46473608092075a7577aead94252b | 241533
155+
# 2025-11-26 14:01:19 | f30a474797b6f0ed878aca7b06c8895ccd24660b389045f097aeb07afc69fa97 | 241533
156+
# 2025-11-26 14:01:19 | fdec199a2d69145fe191498e3225b595e10d459a99a05253cfd6b333f6d27db6 | 241533
157+
# 2025-11-26 14:18:11 | 8ad72acb470abf3153d3c95026f253cd19a3c37531ace0ee55226edae73f841f | 290417
158+
# 2025-11-26 14:21:09 | 3a22614b95bea58c73152c28b360ecf42e24c90045fd8bff068de76c932415c1 | 224197
159+
# 2025-11-26 14:23:46 | 0f55de2cd1cc3354297c855eb4ea62c4d6cf30e26fe9e010b9697bd553336e6c | 543549
160+
# 2025-11-26 14:23:46 | 12be7f48a0bdd33a62df89c44b1ef6810d4d54ea26e7a4bf4c43e1fa3d8aa18f | 543549
161+
# 2025-11-26 14:23:46 | 315c821bd42e69fd03425aab4564408bcdf9ce0de6e8f551259011a8aaac650a | 543549
162+
# 2025-11-26 14:23:46 | 4906885ebf56d0806119f2d57128a9d20aa90867912a67f2faf6705be3febf6f | 543549
163+
# 2025-11-26 14:23:46 | 55b2dc844816545c834a97b4abd484e738dc08a6b1cfffc2e4209e7da1d2cc94 | 543549
164+
# 2025-11-26 14:23:46 | 68b2fb3763882dddd54867769ad2b6cd2cdb25bba93d36fef2d8253d5149873d | 543549
165+
# 2025-11-26 14:23:46 | 93fb26a1fde07afd41d86f2bb802dc7cd14827de5eac7094ab746dbdb77c2f06 | 543549
166+
# 2025-11-26 14:23:46 | d8343e735a6fb5512bdd68fa076525ae7815fb7acd649cd11d927a7186fb6b30 | 543549
167+
# 2025-11-26 14:23:46 | fa2a8d3824f0674f830889f2b1b0c9f998a610a7723c9a73cf7ca6b5b57f7f28 | 543549
168+
# 2025-11-26 14:23:47 | 2f93d4bade70efb1459923d14b1d5380565bd0313a9850b69c6b91c58451c205 | 543549
169+
# 2025-11-26 14:23:47 | 3753370103e9cddccf11de6915922147daf0430422c4708e8f9d8a794ee8ad47 | 543549
170+
# 2025-11-26 14:23:47 | 563fc090ddace40cd0ec03f7812cd78aa4d946958ee5c74f9ad340b6ebb5b9d7 | 543549
171+
# 2025-11-26 14:23:47 | 5f63700878516370ecce4582e078865087cc7aa1646fe7fc06906d5f63ca9109 | 543549
172+
# 2025-11-26 14:23:47 | 6f9c85a92c040bd8a6c15d8242a5aadb25b6314fa3206dd40a380dfbd9671d5e | 543549
173+
# 2025-11-26 14:23:47 | 72723e169663f43ac7d2ff2a0fbe919a24cb68c7508b2ad27f373dabd404ab99 | 543549
174+
# 2025-11-26 14:23:47 | 80e714ae65fdc9d6725402629624fd7d11b0cafd876de397496304e2423d6ff7 | 543549
175+
# 2025-11-26 14:23:47 | d51d5d9ed2663194224596fb0c1a5e125f55647866a44ad9d3fc783a24ac504e | 543549
176+
# 2025-11-26 14:23:47 | d798ed9489cdd977fa2155894edc27d3cb0137fcdb9454133448a242383e1384 | 543549
177+
# 2025-11-26 14:23:47 | e9ffc14e92baccadc6d734630b3675c3d60ffbe2650135684af2fe409e297f40 | 543549
178+
# 2025-11-26 14:24:05 | 56d345d0c94ed0fce3b0ff6504d5215931133b3f30eb330b21f1855faedc77fa | 543549
179+

post-cip/mempool-measurements/process-log.sh

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,34 @@ set -eo pipefail
44

55
SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
66

7-
echo $'Region\tTimestamp\tTxId' > tx_times.tsv
8-
echo $'Region\tTimestamp\tBlock\tSlot' > block_times.tsv
7+
8+
(
9+
echo $'Remote\tLongitude [deg]\tLatitude [deg]'
10+
zcat reallyfreegeoip.jsonl.gz | jq -r '.ip + "\t" + (.longitude | tostring) + "\t" + (.latitude | tostring)'
11+
) > reallyfreegeoip.tsv
12+
13+
14+
echo $'Region\tTimestamp\tTxId' > tx-times.tsv
15+
echo $'Region\tTimestamp\tBlock\tSlot' > block-times.tsv
16+
echo $'Region\tTimestamp\tLocal\tRemote\tTxId 1\tTxId 2' > outbounds.tsv
917

1018
for region in eu-central-1 us-east-2 ap-northeast-1
1119
do
12-
sed -n -e '/cardano\.node\.Mempool.*"TraceMempoolAddedTx"/{s/^.* .\([0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\} [0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}[^]]*\)].*("tx",Object (fromList \[\(.*\)]))]$/'"$region"'\t\1\t\2/;s/("txid",String "\(........\)")/\1/g;p}' "$region"/2025-*.log >> tx-times.tsv
13-
sed -n -e '/cardano\.node\.ChainDB.*new tip:/{s/^.* .\([0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\} [0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}[^]]*\)].*new tip: \(................................................................\) at slot \(.........\).*/'"$region"'\t\1\t\2\t\3/;p}' "$region"/2025-*.log >> block-times.tsv
20+
zcat "$region"/2025-*.log.gz \
21+
| sed -n -e '/cardano\.node\.Mempool.*"TraceMempoolAddedTx"/{s/^.* .\([0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\} [0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}[^]]*\)].*("tx",Object (fromList \[\(.*\)]))]$/'"$region"'\t\1\t\2/;s/("txid",String "\(........\)")/\1/g;p}' \
22+
>> tx-times.tsv
23+
zcat "$region"/2025-*.log.gz \
24+
| sed -n -e '/cardano\.node\.ChainDB.*new tip:/{s/^.* .\([0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\} [0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}[^]]*\)].*new tip: \(................................................................\) at slot \(.........\).*/'"$region"'\t\1\t\2\t\3/;p}'\
25+
>> block-times.tsv
26+
zcat "$region"/2025-*.log.gz \
27+
| sed -E \
28+
-e '/cardano.node.TxOutbound:.*"TxSubmissionOutboundRecvMsgRequestTxs"/!d' \
29+
-e 's/^.*:cardano.node.TxOutbound:Info:.* .([[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2} [[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2})\.[[:digit:]]{2} UTC]/'"$region"'\t\1\t/' \
30+
-e 's/\t[^\t]*\("local",Object \(fromList \[\("addr",String "([[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3})"\),\("port",String "([[:digit:]]{1,5})"\)\]\)\)/\t\1:\2\t/' \
31+
-e 's/\t,\("remote",Object \(fromList \[\("addr",String "([[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3})"\),\("port",String "([[:digit:]]{1,5})"\)\]\)\)/\t\1:\2\t/' \
32+
-e 's/\t[^\t]*\("txIds",String "\[HardForkGenTxId \{getHardForkGenTxId = S \(S \(S \(S \(S \(S \(Z \(WrapGenTxId \{unwrapGenTxId = txid: TxId \{unTxId = SafeHash \\"([[:xdigit:]]{64})\\"\}\}\)\)\)\)\)\)\)\}\]"\)\]/\t\1\t/' \
33+
-e 's/\t[^\t]*\("txIds",String "\[HardForkGenTxId \{getHardForkGenTxId = S \(S \(S \(S \(S \(S \(Z \(WrapGenTxId \{unwrapGenTxId = txid: TxId \{unTxId = SafeHash \\"([[:xdigit:]]{64})\\"\}\}\)\)\)\)\)\)\)\},HardForkGenTxId \{getHardForkGenTxId = S \(S \(S \(S \(S \(S \(Z \(WrapGenTxId \{unwrapGenTxId = txid: TxId \{unTxId = SafeHash \\"([[:xdigit:]]{64})\\"\}\}\)\)\)\)\)\)\)\}\]"\)\]/\t\1\t\2/' \
34+
>> outbounds.tsv
1435
done
1536

1637
psql -f "$SCRIPT_DIR/process-log.sql" mainnet

0 commit comments

Comments
 (0)