Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions tools/SendBlobs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,22 @@ ARG COMMIT_HASH
ARG TARGETARCH
ARG TARGETOS

COPY . .
COPY ./src/Nethermind ./src/Nethermind
COPY ./tools/SendBlobs ./tools/SendBlobs
COPY ./Directory.*.props .
COPY ./global.json ./global.json
COPY ./nuget.config ./nuget.config
COPY ./tools/Directory.Build.props ./tools/Directory.Build.props

RUN arch=$([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH") && \
dotnet publish tools/SendBlobs -c $BUILD_CONFIG -r $TARGETOS-$arch -o out --sc true \
-p:BuildTimestamp=$BUILD_TIMESTAMP -p:Commit=$COMMIT_HASH
dotnet publish tools/SendBlobs/SendBlobs.csproj -c $BUILD_CONFIG -r $TARGETOS-$arch -o /out --sc true \
-p:DebugType=None \
-p:DebugSymbols=false

FROM --platform=$TARGETPLATFORM ubuntu
FROM mcr.microsoft.com/dotnet/runtime-deps:9.0-noble

WORKDIR /nethermind

COPY --from=build /out/SendBlobs .
COPY --from=build /out ./

RUN apt update && apt-get install -y ca-certificates
ENTRYPOINT ["./SendBlobs"]
119 changes: 44 additions & 75 deletions tools/SendBlobs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,37 @@ docker run nethermindeth/send-blobs:latest --rpcurl http://localhost:8545 --blob

## Usage


The tool can help with:

- blob spamming with random data, from multiple accounts
- sending files as blobs,
- batch funds distribution

Use "SendBlobs [command] --help" for more information about supported commands.

The default fork for now is Prague, which means blob will be sent with V0 proofs. Use `--fork Osaka` option to change it to V1. The default behavior may change post Osaka.

## Build

```sh
apt install libsnappy-dev dotnet-sdk-9.0 -y
cd ./nethermind/tools/SendBlobs
dotnet publish --sc -o .
./SendBlobs
```

or via docker

```sh
cd ./nethermind/ # repository root
docker build . -f ./tools/SendBlobs/Dockerfile -t send-blobs
docker run send-blobs
```
Usage: SendBlobs [options] [command]

Options:
--help Show help information
--rpcurl <rpcUrl> Url of the Json RPC.
--bloboptions <blobOptions> Options in format '10x1-2', '2x5-5' etc. for the blobs.
--privatekey <privateKey> The key to use for sending blobs.
--keyfile <keyFile> File containing private keys that each blob tx will be send from.
--receiveraddress <receiverAddress> Receiver address of the blobs.
--maxfeeperblobgas <maxFeePerBlobGas> (Optional) Set the maximum fee per blob data.
--feemultiplier <feeMultiplier> (Optional) A multiplier to use for gas fees.
--maxpriorityfee <maxPriorityFee> (Optional) The maximum priority fee for each transaction.
--fork <fork> (Optional) Fork rules: Cancun/Prague/Osaka

Commands:
distribute Distribute funds from an address to a number of new addresses.
reclaim Reclaim funds distributed from the 'distribute' command.


Use "SendBlobs [command] --help" for more information about a command.

Usage: SendBlobs __distribute__ [options]

Options:
--help Show help information
--rpcurl <rpcUrl> Url of the Json RPC.
--privatekey <privateKey> The private key to distribute funds from.
--number <number> The number of new addresses/keys to make.
--keyfile <keyFile> File where the newly generated keys are written.
--maxpriorityfee <maxPriorityFee> (Optional) The maximum priority fee for each transaction.
--maxfee <maxFee> (Optional) The maxFeePerGas fee paid for each transaction.


Usage: SendBlobs __reclaim__ [options]

Options:
--help Show help information
--rpcurl <rpcUrl> Url of the Json RPC.
--receiveraddress <receiverAddress> The address to send the funds to.
--keyfile <keyFile> File of the private keys to reclaim from.
--maxpriorityfee <maxPriorityFee> (Optional) The maximum priority fee for each transaction.
--maxfee <maxFee> (Optional) The maxFeePerGas paid for each transaction.

sh

### Examples

```sh
./SendBlobs --rpcurl http://localhost:8545 # url-that-does-not-require-auth-in-header
--bloboptions 1000,5x6,100x2 # transaction count: just a number or a list of tx-count x blob-count
--privatekey 0x0000..0000 # secret-key
Expand All @@ -62,9 +48,12 @@ sh
--feemultiplier 4 # fee multiplier to compete with other txs in the pool, 4 by default

# send 5 transactions, 1 blob each
./SendBlobs --rpcurl http://localhost:8545 --bloboptions 5 \
0x0000000000000000000000000000000000000000000000000000000000000000 \
0x000000000000000000000000000000000000f1c1 10000 4
./SendBlobs --rpcurl http://localhost:8545 \
--bloboptions 5 \
--privatekey 0x0000000000000000000000000000000000000000000000000000000000000000 \
--receiveraddress 0x000000000000000000000000000000000000f1c1 \
--maxfeeperblobgas 10000 \
--feemultiplier 4

# send several transactions with 1 blob, with 6 blobs and than with 2 blobs
./SendBlobs --rpcurl http://localhost:8545
Expand All @@ -74,19 +63,21 @@ sh
--maxfeeperblobgas 10000 \
--feemultiplier 4

#send a couple of transactions
# send a couple of broken transactions

./SendBlobs --rpcurl http://localhost:8545 \
--bloboptions 2x4-1 \
--bloboptions 2x4-2 \
--privatekey 0x0000000000000000000000000000000000000000000000000000000000000000 \
--receiveraddress 0x0000000000000000000000000000000000000001 \
--maxfeeperblobgas 10000 \
--feemultiplier 4
```

## Blob options
```
<<BrokenTxs
Issues/Options that can be intentionally added:

Issues that can be intentionally added to simulate broken transactions:

```txt
1 = 0 blobs
2 = 1st blob has more blobs than allowed
3 = 1st blob is shorten
Expand All @@ -108,30 +99,8 @@ Syntax:
^ tx count
^ blobs in every tx (optional, default to 1)
^ how it's broken (optional, tx is correct by default) or write true

BrokenTxs
```

## Debug

```
For funding the private key used in the project launch settings, the address is:
0x428a95ceb38b706fbfe74fa0144701cfc1c25ef7
```

## Build

```sh
apt install libsnappy-dev dotnet-sdk-7.0 -y
cd ./nethermind/tools/SendBlobs
dotnet publish --sc -o .
./SendBlobs
```

or via docker

```sh
cd ./nethermind/ # repository root
docker build . -f ./tools/SendBlobs/Dockerfile -t send-blobs
docker run send-blobs ... # args samples above
```
For funding the private key used in the project launch settings, the address is: `0x428a95ceb38b706fbfe74fa0144701cfc1c25ef7`
86 changes: 46 additions & 40 deletions tools/SendBlobs/SendBlobs.slnx
Original file line number Diff line number Diff line change
@@ -1,47 +1,53 @@
<Solution>
<Folder Name="/Nethermind/">
<Project Path="../../src/Nethermind/Ethereum.Test.Base/Ethereum.Test.Base.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Abi/Nethermind.Abi.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Api/Nethermind.Api.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Blockchain/Nethermind.Blockchain.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Config/Nethermind.Config.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Consensus.AuRa/Nethermind.Consensus.AuRa.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Consensus.Ethash/Nethermind.Consensus.Ethash.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Consensus/Nethermind.Consensus.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Core.Test/Nethermind.Core.Test.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Core/Nethermind.Core.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Crypto/Nethermind.Crypto.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Db.Rocks/Nethermind.Db.Rocks.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Db.Rpc/Nethermind.Db.Rpc.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Db/Nethermind.Db.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Era1/Nethermind.Era1.csproj" Id="c5860ac9-1f41-4035-a873-a2f851104030" />
<Project Path="../../src/Nethermind/Nethermind.Evm.Precompiles/Nethermind.Evm.Precompiles.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Evm/Nethermind.Evm.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Facade/Nethermind.Facade.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Grpc/Nethermind.Grpc.csproj" />
<Project Path="../../src/Nethermind/Nethermind.History/Nethermind.History.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Init/Nethermind.Init.csproj" />
<Project Path="../../src/Nethermind/Nethermind.JsonRpc/Nethermind.JsonRpc.csproj" />
<Project Path="../../src/Nethermind/Nethermind.KeyStore/Nethermind.KeyStore.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Logging/Nethermind.Logging.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Merge.Plugin/Nethermind.Merge.Plugin.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Merkleization/Nethermind.Merkleization.csproj" Id="5919141f-9e50-4817-8c9f-8d631c8cecfa" />
<Project Path="../../src/Nethermind/Nethermind.Monitoring/Nethermind.Monitoring.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Network.Contract/Nethermind.Network.Contract.csproj" Id="ef53ed8d-6484-49a7-80ab-99e13d918a90" />
<Project Path="../../src/Nethermind/Nethermind.Network.Discovery/Nethermind.Network.Discovery.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Network.Dns/Nethermind.Network.Dns.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Network.Enr/Nethermind.Network.Enr.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Network.Stats/Nethermind.Network.Stats.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Network/Nethermind.Network.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Serialization.Json/Nethermind.Serialization.Json.csproj" Id="3fdb2a75-9b4f-4728-b61c-d38cafb8105c" />
<Project Path="../../src/Nethermind/Nethermind.Serialization.Rlp/Nethermind.Serialization.Rlp.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Serialization.Ssz/Nethermind.Serialization.Ssz.csproj" Id="5aae74fe-1ba1-4d80-9b29-f759a8dcf702" />
<Project Path="../../src/Nethermind/Nethermind.Sockets/Nethermind.Sockets.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Specs.Test/Nethermind.Specs.Test.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Specs/Nethermind.Specs.csproj" />
<Project Path="../../src/Nethermind/Nethermind.State/Nethermind.State.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Synchronization/Nethermind.Synchronization.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Trie/Nethermind.Trie.csproj" Id="84bac49d-709a-4f36-87ef-a8d46014449e" />
<Project Path="../../src/Nethermind/Nethermind.TxPool/Nethermind.TxPool.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Wallet/Nethermind.Wallet.csproj" />
</Folder>
<Folder Name="/Solution Items/" Id="e5b9697c-fef1-46a0-ab52-353749433ed6">
<File Path="../../src/Nethermind/Directory.Build.props" />
<File Path="../../src/Nethermind/Directory.Packages.props" />
</Folder>
<Project Path="../../src/Nethermind/Ethereum.Test.Base/Ethereum.Test.Base.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Abi/Nethermind.Abi.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Api/Nethermind.Api.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Blockchain/Nethermind.Blockchain.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Config/Nethermind.Config.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Consensus.AuRa/Nethermind.Consensus.AuRa.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Consensus.Ethash/Nethermind.Consensus.Ethash.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Consensus/Nethermind.Consensus.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Core/Nethermind.Core.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Crypto/Nethermind.Crypto.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Db.Rocks/Nethermind.Db.Rocks.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Db.Rpc/Nethermind.Db.Rpc.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Db/Nethermind.Db.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Era1/Nethermind.Era1.csproj" Id="c5860ac9-1f41-4035-a873-a2f851104030" />
<Project Path="../../src/Nethermind/Nethermind.Evm/Nethermind.Evm.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Facade/Nethermind.Facade.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Grpc/Nethermind.Grpc.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Init/Nethermind.Init.csproj" />
<Project Path="../../src/Nethermind/Nethermind.JsonRpc/Nethermind.JsonRpc.csproj" />
<Project Path="../../src/Nethermind/Nethermind.KeyStore/Nethermind.KeyStore.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Logging/Nethermind.Logging.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Merge.Plugin/Nethermind.Merge.Plugin.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Merkleization/Nethermind.Merkleization.csproj" Id="5919141f-9e50-4817-8c9f-8d631c8cecfa" />
<Project Path="../../src/Nethermind/Nethermind.Monitoring/Nethermind.Monitoring.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Network.Contract/Nethermind.Network.Contract.csproj" Id="ef53ed8d-6484-49a7-80ab-99e13d918a90" />
<Project Path="../../src/Nethermind/Nethermind.Network.Discovery/Nethermind.Network.Discovery.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Network.Dns/Nethermind.Network.Dns.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Network.Enr/Nethermind.Network.Enr.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Network.Stats/Nethermind.Network.Stats.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Network/Nethermind.Network.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Serialization.Json/Nethermind.Serialization.Json.csproj" Id="3fdb2a75-9b4f-4728-b61c-d38cafb8105c" />
<Project Path="../../src/Nethermind/Nethermind.Serialization.Rlp/Nethermind.Serialization.Rlp.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Serialization.Ssz/Nethermind.Serialization.Ssz.csproj" Id="5aae74fe-1ba1-4d80-9b29-f759a8dcf702" />
<Project Path="../../src/Nethermind/Nethermind.Sockets/Nethermind.Sockets.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Specs/Nethermind.Specs.csproj" />
<Project Path="../../src/Nethermind/Nethermind.State/Nethermind.State.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Synchronization/Nethermind.Synchronization.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Trie/Nethermind.Trie.csproj" Id="84bac49d-709a-4f36-87ef-a8d46014449e" />
<Project Path="../../src/Nethermind/Nethermind.TxPool/Nethermind.TxPool.csproj" />
<Project Path="../../src/Nethermind/Nethermind.Wallet/Nethermind.Wallet.csproj" />
<Project Path="SendBlobs.csproj" />
</Solution>
16 changes: 8 additions & 8 deletions tools/SendBlobs/SetupCli.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// SPDX-FileCopyrightText: 2023 Demerzel Solutions Limited
// SPDX-FileCopyrightText: 2025 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using Nethermind.Consensus;
using Nethermind.Crypto;
using Nethermind.Int256;
using Nethermind.Logging;
using System.CommandLine;
using Nethermind.Core.Specs;
Expand All @@ -13,6 +12,7 @@
using Nethermind.Specs;

namespace SendBlobs;

internal static class SetupCli
{
public static void SetupExecute(RootCommand command)
Expand Down Expand Up @@ -178,12 +178,12 @@ public static void SetupDistributeCommand(Command root)
Description = "File where the newly generated keys are written",
HelpName = "path"
};
Option<UInt256> maxPriorityFeeGasOption = new("--maxpriorityfee")
Option<ulong> maxPriorityFeeGasOption = new("--maxpriorityfee")
{
Description = "The maximum priority fee for each transaction",
HelpName = "fee"
};
Option<UInt256> maxFeeOption = new("--maxfee")
Option<ulong> maxFeeOption = new("--maxfee")
{
Description = "The maxFeePerGas fee paid for each transaction",
HelpName = "fee"
Expand Down Expand Up @@ -242,12 +242,12 @@ public static void SetupReclaimCommand(Command root)
Description = "File of the private keys to reclaim from",
HelpName = "path"
};
Option<UInt256> maxPriorityFeeGasOption = new("--maxpriorityfee")
Option<ulong> maxPriorityFeeGasOption = new("--maxpriorityfee")
{
Description = "The maximum priority fee for each transaction",
HelpName = "fee"
};
Option<UInt256> maxFeeOption = new("--maxfee")
Option<ulong> maxFeeOption = new("--maxfee")
{
Description = "The maxFeePerGas fee paid for each transaction",
HelpName = "fee"
Expand Down Expand Up @@ -312,7 +312,7 @@ public static void SetupSendFileCommand(Command root)
HelpName = "address",
Required = true,
};
Option<UInt256> maxFeePerBlobGasOption = new("--maxfeeperblobgas")
Option<ulong> maxFeePerBlobGasOption = new("--maxfeeperblobgas")
{
DefaultValueFactory = r => 1000,
Description = "Set the maximum fee per blob data",
Expand All @@ -324,7 +324,7 @@ public static void SetupSendFileCommand(Command root)
Description = "A multiplier to use for gas fees",
HelpName = "value"
};
Option<UInt256?> maxPriorityFeeGasOption = new("--maxpriorityfee")
Option<ulong?> maxPriorityFeeGasOption = new("--maxpriorityfee")
{
Description = "The maximum priority fee for each transaction",
HelpName = "fee"
Expand Down