Skip to content

Post IP to Chain

Posting your IP to the chain is an essential step for participating in the Fiber network. This process allows other nodes to discover and communicate with your node.

Using the Command Line

To post an IP to the chain, you can use the fiber-post-ip command:

Terminal window
fiber-post-ip --netuid <NETUID> --external_ip <YOUR_IP> --external_port <YOUR_PORT>

This command utilizes the post_ip_to_chain.py script to interact with the Fiber network.

Command Line Arguments

The fiber-post-ip command accepts several arguments:

  • --subtensor.chain_endpoint: (Optional) The chain address to connect to.
  • --subtensor.network: (Optional) The chain network to use (default: Finney network).
  • --wallet.name: (Optional) The name of the wallet to use (default: “default”).
  • --wallet.hotkey: (Optional) The name of the hotkey to use (default: “default”).
  • --netuid: (Required) The Network UID.
  • --external_ip: (Required) Your external IP address.
  • --external_port: (Required) Your external port number.

How It Works

  1. The script parses the command line arguments.

  2. It establishes a connection to the Fiber network using the provided chain endpoint and network.

  3. It loads the necessary keypairs (hotkey and coldkey) from your wallet.

  4. The script then calls the post_node_ip_to_chain function with the following parameters:

    • substrate_interface: The connection to the Fiber network.
    • keypair: Your hotkey keypair for signing the transaction.
    • netuid: The Network UID you’re operating on.
    • external_ip: Your external IP address.
    • external_port: Your external port number.
    • coldkey_ss58_address: Your coldkey’s public address.
  5. If the operation is successful, it logs a success message. Otherwise, it logs an error message.

Example Usage

Here’s an example of how you might use the command:

Terminal window
fiber-post-ip --netuid 1 --external_ip 203.0.113.1 --external_port 8080

This command would attempt to post the IP address 203.0.113.1 and port 8080 to the chain for the network with UID 1.

Important Notes

  • Make sure you have the correct permissions and have set up your wallet before running this command.
  • The external IP and port you provide should be the ones that other nodes can use to reach your node.
  • If you’re behind a NAT or firewall, ensure that the port you’re using is properly forwarded to your machine.