pub struct Geth { /* private fields */ }node-bindings only.Expand description
Builder for launching geth.
§Panics
If spawn is called without geth being available in the user’s $PATH
§Example
use alloy_node_bindings::Geth;
let port = 8545u16;
let url = format!("http://localhost:{}", port).to_string();
let geth = Geth::new().port(port).block_time(5000u64).spawn();
drop(geth); // this will kill the instanceImplementations§
Source§impl Geth
impl Geth
Sourcepub fn at(path: impl Into<PathBuf>) -> Geth
pub fn at(path: impl Into<PathBuf>) -> Geth
Creates a Geth builder which will execute geth at the given path.
§Example
use alloy_node_bindings::Geth;
let geth = Geth::at("../go-ethereum/build/bin/geth").spawn();
println!("Geth running at `{}`", geth.endpoint());Sourcepub fn path<T>(self, path: T) -> Geth
pub fn path<T>(self, path: T) -> Geth
Sets the path to the geth executable
By default, it’s expected that geth is in $PATH, see also
std::process::Command::new()
Sourcepub const fn is_clique(&self) -> bool
pub const fn is_clique(&self) -> bool
Returns whether the node is launched in Clique consensus mode.
Sourcepub fn clique_address(&self) -> Option<Address>
pub fn clique_address(&self) -> Option<Address>
Calculates the address of the Clique consensus address.
Sourcepub fn set_clique_private_key<T>(self, private_key: T) -> Geth
👎Deprecated: clique support was removed in geth >=1.14
pub fn set_clique_private_key<T>(self, private_key: T) -> Geth
Sets the Clique Private Key to the geth executable, which will be later
loaded on the node.
The address derived from this private key will be used to set the miner.etherbase field
on the node.
Sourcepub fn port<T>(self, port: T) -> Geth
pub fn port<T>(self, port: T) -> Geth
Sets the port which will be used when the geth-cli instance is launched.
If port is 0 then the OS will choose a random port. GethInstance::port will return the port that was chosen.
Sourcepub fn host<T>(self, host: T) -> Geth
pub fn host<T>(self, host: T) -> Geth
Sets the host which will be used when the geth instance is launched.
Defaults to localhost.
Sourcepub fn p2p_port(self, port: u16) -> Geth
pub fn p2p_port(self, port: u16) -> Geth
Sets the port which will be used for incoming p2p connections.
This will put the geth instance into non-dev mode, discarding any previously set dev-mode options.
Sourcepub const fn block_time(self, block_time: u64) -> Geth
pub const fn block_time(self, block_time: u64) -> Geth
Sets the block-time which will be used when the geth-cli instance is launched.
This will put the geth instance in dev mode, discarding any previously set options that
cannot be used in dev mode.
Sourcepub const fn insecure_unlock(self) -> Geth
pub const fn insecure_unlock(self) -> Geth
Allow geth to unlock accounts when rpc apis are open.
Sourcepub const fn enable_ipc(self) -> Geth
pub const fn enable_ipc(self) -> Geth
Enable IPC for the geth instance.
Sourcepub fn disable_discovery(self) -> Geth
pub fn disable_discovery(self) -> Geth
Disable discovery for the geth instance.
This will put the geth instance into non-dev mode, discarding any previously set dev-mode options.
Sourcepub fn genesis(self, genesis: Genesis) -> Geth
pub fn genesis(self, genesis: Genesis) -> Geth
Sets the genesis.json for the geth instance.
If this is set, geth will be initialized with geth init and the --datadir option will be
set to the same value as data_dir.
This is destructive and will overwrite any existing data in the data directory.
Sourcepub const fn authrpc_port(self, port: u16) -> Geth
pub const fn authrpc_port(self, port: u16) -> Geth
Sets the port for authenticated RPC connections.
Sourcepub const fn keep_stderr(self) -> Geth
pub const fn keep_stderr(self) -> Geth
Keep the handle to geth’s stderr in order to read from it.
Caution: if the stderr handle isn’t used, this can end up blocking.
Sourcepub fn extend_args<I, S>(&mut self, args: I)
pub fn extend_args<I, S>(&mut self, args: I)
Adds multiple arguments to pass to the geth.
Sourcepub fn arg<T>(self, arg: T) -> Geth
pub fn arg<T>(self, arg: T) -> Geth
Adds an argument to pass to geth.
Pass any arg that is not supported by the builder.
Sourcepub fn args<I, S>(self, args: I) -> Geth
pub fn args<I, S>(self, args: I) -> Geth
Adds multiple arguments to pass to geth.
Pass any args that is not supported by the builder.
Sourcepub fn spawn(self) -> GethInstance
pub fn spawn(self) -> GethInstance
Sourcepub fn try_spawn(self) -> Result<GethInstance, NodeError>
pub fn try_spawn(self) -> Result<GethInstance, NodeError>
Consumes the builder and spawns geth. If spawning fails, returns an error.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Geth
impl RefUnwindSafe for Geth
impl Send for Geth
impl Sync for Geth
impl Unpin for Geth
impl UnwindSafe for Geth
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
Source§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
impl<T> ErasedDestructor for Twhere
T: 'static,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 1152 bytes