-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: ERC5564
Stealth Address scanning
#1
Open
joshieDo
wants to merge
2
commits into
main
Choose a base branch
from
joshie/5564
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[package] | ||
name = "stealth-addresses" | ||
version = "0.0.0" | ||
publish = false | ||
edition.workspace = true | ||
license.workspace = true | ||
|
||
[dependencies] | ||
reth.workspace = true | ||
reth-chainspec.workspace = true | ||
reth-cli-commands.workspace = true | ||
reth-cli-runner.workspace = true | ||
reth-db.workspace = true | ||
reth-exex.workspace = true | ||
reth-node-api.workspace = true | ||
reth-node-builder.workspace = true | ||
reth-node-ethereum.workspace = true | ||
reth-tracing.workspace = true | ||
reth-execution-types.workspace = true | ||
|
||
alloy-primitives.workspace = true | ||
alloy-sol-types = { workspace = true, features = ["json"] } | ||
|
||
k256 = { version = "0.13", default-features = false, features = ["ecdsa"] } | ||
chacha20poly1305 = "0.10.1" | ||
|
||
eyre.workspace = true | ||
futures.workspace = true | ||
clap.workspace = true | ||
|
||
[[bin]] | ||
name = "stealthy" | ||
path = "src/main.rs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Stealth addresses | ||
|
||
Scans committed blocks for stealth addresses according to [ERC5564](https://eips.ethereum.org/EIPS/eip-5564). | ||
|
||
## Node | ||
|
||
```bash | ||
export VIEW_KEY=0x... | ||
stealthy node | ||
``` | ||
|
||
## Generation | ||
|
||
```bash | ||
Usage: stealthy gen [OPTIONS] <COMMAND> | ||
|
||
Commands: | ||
addr Generate a stealth address from a stealth meta address alongside an optional encrypted note | ||
meta Generate a stealth meta address from view and spend private keys | ||
key Generate the stealth address private key from the ephemeral public key and view & spend private keys | ||
``` | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
//! CLI definition and entrypoint to executable | ||
|
||
use clap::{Parser, Subcommand}; | ||
use reth::args::{ | ||
utils::{chain_help, chain_value_parser, SUPPORTED_CHAINS}, | ||
LogArgs, | ||
}; | ||
use reth_chainspec::ChainSpec; | ||
use reth_cli_commands::node::{self, NoArgs}; | ||
use reth_cli_runner::CliRunner; | ||
use reth_db::DatabaseEnv; | ||
use reth_node_builder::{NodeBuilder, WithLaunchContext}; | ||
use std::{future::Future, sync::Arc}; | ||
|
||
/// Entrypoint. | ||
#[derive(Debug, Parser)] | ||
pub struct Cli { | ||
/// The command to run | ||
#[command(subcommand)] | ||
command: Commands, | ||
|
||
/// The chain this node is running. | ||
/// | ||
/// Possible values are either a built-in chain or the path to a chain specification file. | ||
#[arg( | ||
long, | ||
value_name = "CHAIN_OR_PATH", | ||
long_help = chain_help(), | ||
default_value = SUPPORTED_CHAINS[0], | ||
value_parser = chain_value_parser, | ||
global = true, | ||
)] | ||
chain: Arc<ChainSpec>, | ||
|
||
#[command(flatten)] | ||
logs: LogArgs, | ||
} | ||
|
||
impl Cli { | ||
pub fn run<L, Fut>(mut self, launcher: L) -> eyre::Result<()> | ||
where | ||
L: FnOnce(WithLaunchContext<NodeBuilder<Arc<DatabaseEnv>>>, NoArgs) -> Fut, | ||
Fut: Future<Output = eyre::Result<()>>, | ||
{ | ||
// add network name to logs dir | ||
self.logs.log_file_directory = | ||
self.logs.log_file_directory.join(self.chain.chain.to_string()); | ||
|
||
let _guard = self.logs.init_tracing()?; | ||
Comment on lines
+45
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need to do it separately here? |
||
let runner = CliRunner::default(); | ||
match self.command { | ||
Commands::Node(command) => { | ||
runner.run_command_until_exit(|ctx| command.execute(ctx, launcher)) | ||
} | ||
Commands::Generator(command) => runner.run_command_until_exit(|_| command.execute()), | ||
} | ||
} | ||
} | ||
|
||
/// Commands to be executed | ||
#[derive(Debug, Subcommand)] | ||
pub enum Commands { | ||
/// Start the node | ||
#[command(name = "node")] | ||
Node(node::NodeCommand<NoArgs>), | ||
/// Generate stealth addresses, meta addresses and stealth address private keys. | ||
#[command(name = "gen")] | ||
Generator(Box<crate::generator::Command>), | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we show a full flow of generating the address and using it, including the command outputs?