4 releases

new 0.2.0-rc.1 Apr 18, 2025
0.1.2 Mar 20, 2025
0.1.1 Feb 20, 2025
0.1.0 Feb 13, 2025

#438 in Authentication

Download history 136/week @ 2025-02-12 200/week @ 2025-02-19 37/week @ 2025-02-26 50/week @ 2025-03-05 45/week @ 2025-03-12 154/week @ 2025-03-19 49/week @ 2025-03-26 13/week @ 2025-04-02 4/week @ 2025-04-09

227 downloads per month

MIT license

185KB
4K SLoC

Pubky Testnet

A local test network for developing Pubky Core or applications depending on it.

All resources are ephemeral, databases are in the operating system's temporary directories, and all servers are closed as the testnet dropped.

Usage

Inline testing

use pubky_testnet::EphemeralTestnet;

#[tokio::main]
async fn main () {
  // Run a new testnet. This creates a test dht,
  // a homeserver, and a http relay.
  let testnet = EphemeralTestnet::start().await.unwrap();

  // Create a Pubky Client from the testnet.
  let client = testnet.pubky_client_builder().build().unwrap();

  // Use the homeserver
  let homeserver = testnet.homeserver_suite();

  // Use the relay
  let http_relay = testnet.http_relay();
}

Binary (hardcoded testnet, and browser support).

If you need to run the testnet in a separate process, for example to test Pubky Core in browsers, you need to run this binary, which will create these components with hardcoded configurations:

  1. A local DHT with bootstrapping nodes: &["localhost:6881"]
  2. A Pkarr Relay running on port 15411
  3. A Homeserver with address is hardcoded to 8pinxxgqs41n4aididenw5apqp1urfmzdztr8jt4abrkdn435ewo
  4. An HTTP relay running on port 15412

Dependencies

~44–60MB
~1M SLoC