diff --git a/tools/SendBlobs/Dockerfile b/tools/SendBlobs/Dockerfile index 9ef638c47053..45aaef59a838 100644 --- a/tools/SendBlobs/Dockerfile +++ b/tools/SendBlobs/Dockerfile @@ -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"] diff --git a/tools/SendBlobs/README.md b/tools/SendBlobs/README.md index ebd6d41899fd..b77291e350da 100644 --- a/tools/SendBlobs/README.md +++ b/tools/SendBlobs/README.md @@ -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 Url of the Json RPC. - --bloboptions Options in format '10x1-2', '2x5-5' etc. for the blobs. - --privatekey The key to use for sending blobs. - --keyfile File containing private keys that each blob tx will be send from. - --receiveraddress Receiver address of the blobs. - --maxfeeperblobgas (Optional) Set the maximum fee per blob data. - --feemultiplier (Optional) A multiplier to use for gas fees. - --maxpriorityfee (Optional) The maximum priority fee for each transaction. - --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 Url of the Json RPC. - --privatekey The private key to distribute funds from. - --number The number of new addresses/keys to make. - --keyfile File where the newly generated keys are written. - --maxpriorityfee (Optional) The maximum priority fee for each transaction. - --maxfee (Optional) The maxFeePerGas fee paid for each transaction. - - -Usage: SendBlobs __reclaim__ [options] - -Options: - --help Show help information - --rpcurl Url of the Json RPC. - --receiveraddress The address to send the funds to. - --keyfile File of the private keys to reclaim from. - --maxpriorityfee (Optional) The maximum priority fee for each transaction. - --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 @@ -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 @@ -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 -``` -< + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/SendBlobs/SetupCli.cs b/tools/SendBlobs/SetupCli.cs index d24f04ef84e3..4b68a8557ecd 100644 --- a/tools/SendBlobs/SetupCli.cs +++ b/tools/SendBlobs/SetupCli.cs @@ -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; @@ -13,6 +12,7 @@ using Nethermind.Specs; namespace SendBlobs; + internal static class SetupCli { public static void SetupExecute(RootCommand command) @@ -178,12 +178,12 @@ public static void SetupDistributeCommand(Command root) Description = "File where the newly generated keys are written", HelpName = "path" }; - Option maxPriorityFeeGasOption = new("--maxpriorityfee") + Option maxPriorityFeeGasOption = new("--maxpriorityfee") { Description = "The maximum priority fee for each transaction", HelpName = "fee" }; - Option maxFeeOption = new("--maxfee") + Option maxFeeOption = new("--maxfee") { Description = "The maxFeePerGas fee paid for each transaction", HelpName = "fee" @@ -242,12 +242,12 @@ public static void SetupReclaimCommand(Command root) Description = "File of the private keys to reclaim from", HelpName = "path" }; - Option maxPriorityFeeGasOption = new("--maxpriorityfee") + Option maxPriorityFeeGasOption = new("--maxpriorityfee") { Description = "The maximum priority fee for each transaction", HelpName = "fee" }; - Option maxFeeOption = new("--maxfee") + Option maxFeeOption = new("--maxfee") { Description = "The maxFeePerGas fee paid for each transaction", HelpName = "fee" @@ -312,7 +312,7 @@ public static void SetupSendFileCommand(Command root) HelpName = "address", Required = true, }; - Option maxFeePerBlobGasOption = new("--maxfeeperblobgas") + Option maxFeePerBlobGasOption = new("--maxfeeperblobgas") { DefaultValueFactory = r => 1000, Description = "Set the maximum fee per blob data", @@ -324,7 +324,7 @@ public static void SetupSendFileCommand(Command root) Description = "A multiplier to use for gas fees", HelpName = "value" }; - Option maxPriorityFeeGasOption = new("--maxpriorityfee") + Option maxPriorityFeeGasOption = new("--maxpriorityfee") { Description = "The maximum priority fee for each transaction", HelpName = "fee"