Network
in package
Represents a Stellar network with its unique passphrase
Each Stellar network (public, testnet, futurenet) has a unique network passphrase that is included in every transaction signature. This ensures transactions cannot be replayed on different networks, providing critical security.
Network Passphrases:
- Public Network: "Public Global Stellar Network ; September 2015"
- Test Network: "Test SDF Network ; September 2015"
- Future Network: "Test SDF Future Network ; October 2022"
Usage:
// Use predefined networks
$network = Network::public();
$network = Network::testnet();
$network = Network::futurenet();
// Or create a custom network $network = new Network("Custom Network Passphrase");
// Sign a transaction for a specific network $transaction->sign($keyPair, Network::testnet());
Tags
Table of Contents
Methods
- __construct() : mixed
- Creates a Network with the specified passphrase
- futurenet() : Network
- Returns a Network instance for the Stellar future network
- getNetworkPassphrase() : string
- Returns the network passphrase
- public() : Network
- Returns a Network instance for the Stellar public network
- testnet() : Network
- Returns a Network instance for the Stellar test network
Methods
__construct()
Creates a Network with the specified passphrase
public
__construct(string $networkPassphrase) : mixed
Parameters
- $networkPassphrase : string
-
The unique passphrase for this network
futurenet()
Returns a Network instance for the Stellar future network
public
static futurenet() : Network
This network is used for testing upcoming protocol features. It may undergo frequent resets and should be used with caution.
Return values
Network —The future network instance
getNetworkPassphrase()
Returns the network passphrase
public
getNetworkPassphrase() : string
The network passphrase is hashed and included in transaction signatures to prevent replay attacks across different networks.
Return values
string —The network passphrase
public()
Returns a Network instance for the Stellar public network
public
static public() : Network
This is the main production network where real assets with value are traded.
Return values
Network —The public network instance
testnet()
Returns a Network instance for the Stellar test network
public
static testnet() : Network
Use this network for testing and development. Test network assets have no value and accounts can be funded using friendbot.
Return values
Network —The test network instance