pub struct StaticTestnet {
pub testnet: Testnet,
/* private fields */
}Expand description
A testnet for interactive / CLI use — all ports are fixed and well-known.
Use this when you need a long-running testnet that external processes can connect to (e.g. browser tests, mobile apps, or manual debugging). The fixed ports make it easy to hard-code endpoints in client configuration.
Supports two storage modes:
- In-memory (default) — all state is lost on shutdown.
- Persistent — state is stored on disk and survives restarts.
Enable with
.persistent(data_dir)on the builder.
For automated tests with random ports, see EphemeralTestnet.
§Fixed ports
- DHT bootstrap node:
6881 - pkarr relay:
15411 - HTTP relay:
15412 - Homeserver ICANN HTTP:
6286 - Homeserver Pubky HTTPS:
6287 - Homeserver admin:
6288
The homeserver address is hardcoded to 8pinxxgqs41n4aididenw5apqp1urfmzdztr8jt4abrkdn435ewo.
Fields§
§testnet: TestnetInner flexible testnet.
Implementations§
Source§impl StaticTestnet
impl StaticTestnet
Sourcepub fn builder() -> StaticTestnetBuilder
pub fn builder() -> StaticTestnetBuilder
Create a builder for configuring the testnet.
Sourcepub async fn start() -> Result<Self>
pub async fn start() -> Result<Self>
Run an in-memory testnet with the default homeserver config.
Sourcepub async fn start_with_homeserver_config(config_path: PathBuf) -> Result<Self>
👎Deprecated since 0.9.0: Use StaticTestnet::builder().homeserver_config(path).build() instead
pub async fn start_with_homeserver_config(config_path: PathBuf) -> Result<Self>
Use StaticTestnet::builder().homeserver_config(path).build() instead
Run an in-memory testnet with a custom homeserver config.
Sourcepub fn is_persistent(&self) -> bool
pub fn is_persistent(&self) -> bool
Whether this testnet is running in persistent mode.
Sourcepub async fn create_random_homeserver(&mut self) -> Result<&HomeserverApp>
pub async fn create_random_homeserver(&mut self) -> Result<&HomeserverApp>
Create an additional homeserver with a random keypair.
Sourcepub fn client_builder(&self) -> PubkyHttpClientBuilder
pub fn client_builder(&self) -> PubkyHttpClientBuilder
Create a new pubky client builder.
Sourcepub fn client(&self) -> Result<PubkyHttpClient, BuildError>
pub fn client(&self) -> Result<PubkyHttpClient, BuildError>
Creates a pubky::PubkyHttpClient pre-configured to use this test network.
Sourcepub fn sdk(&self) -> Result<Pubky, BuildError>
pub fn sdk(&self) -> Result<Pubky, BuildError>
Creates a pubky::Pubky SDK facade pre-configured to use this test network.
This is a convenience method that builds a client from Self::client_builder.
Sourcepub fn pkarr_client_builder(&self) -> ClientBuilder
pub fn pkarr_client_builder(&self) -> ClientBuilder
Create a new pkarr client builder.
Sourcepub fn homeserver_app(&self) -> &HomeserverApp
pub fn homeserver_app(&self) -> &HomeserverApp
Get the homeserver in the testnet.
Sourcepub fn http_relay(&self) -> &HttpRelay
pub fn http_relay(&self) -> &HttpRelay
Get the http relay in the testnet.
Sourcepub fn pkarr_relay(&self) -> &Relay
pub fn pkarr_relay(&self) -> &Relay
Get the pkarr relay in the testnet.
Sourcepub fn bootstrap_nodes(&self) -> Vec<String>
pub fn bootstrap_nodes(&self) -> Vec<String>
Get the bootstrap nodes for the testnet.
Auto Trait Implementations§
impl !RefUnwindSafe for StaticTestnet
impl !UnwindSafe for StaticTestnet
impl Freeze for StaticTestnet
impl Send for StaticTestnet
impl Sync for StaticTestnet
impl Unpin for StaticTestnet
impl UnsafeUnpin for StaticTestnet
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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 more