WebX is decentralized peer-to-peer overlay network with cryptographic IPv6 addressing and source verification.
When launched, WebX daemon generates you a wallet (if not already present under .webx/wallet) and opens a TUN interface on your system. The interface is then assigned a WebX IPv6 address corresponding to your wallet, MTU of 1500 bytes and is brought up.
Each peer can operate as both server and client. You can enable/disable server and set port in the config file (either system-wide at .webx/config.toml or user's personal at ~/.config/webx/config.toml) along with initial peers, which daemon will try to connect to as soon as it's launched.
Warning
Addressing will soon be modified excluding timezone offset and country code due to planned transition to new routing algorithm. The new addresses will keep the 4c00::/8 prefix and leave 14 bytes (112 bits) instead of 12 bytes (96 bits) for the public key hash. The hash function change is also considered, but not yet decided.
Each peer has its own "wallet" which is an ECDSA Secp256k1 keypair and timezone offset from GMT-12 + a 2 letter country code (these are associated with the timezone set on the system, where the wallet was generated and are used to designate "a region" in P2P network, which helps to find a route to peer).
The WebX IPv6 address consists of 3 parts:
- Constant prefix colliding with no actively used IPv6 addresses. The
4c00::/8was picked for this purpose. - Information about the peer's region (timezone offset + country code). Timezone offset takes 1 byte (it is raw uint8 value from 0 to 26) and country code takes 2 bytes (represented as 2 ASCII characters). This way, the Germany (GMT+1) will have
0x0d(13 in hexadecimal) as timezone offset and0x4445(DEencoded in ASCII) as country code. - The last 12 bytes (96 bits) are the first 12 bytes of xxHash128 hash of the public key in compressed form (SEC1).
It is important to note, that the WebX IPv6 address is not the public key itself, but rather a hash of it. This way, the public key is not exposed to the network, but can be easily "recovered" from the packet signature (which is a part of the packet itself). The recovery would return invalid public key when packet is corrupted or modified, but that is not the problem since the hash of valid public key is embedded in source address and there are still pretty low chances of a hash collision. That's exactly how WebX packets are verified.
Warning
Soon WebX will transition to a new routing algorithm, which will be based on the xor distance between the internal IPv6 addresses. The current routing algorithm is based on the region (timezone offset + country code) and described below.
Each peer in WebX network stores a tree of peers it knows about (3 levels deep; neighbors of neighbors of neighbors). The tree is updated every time peer connects to/disconnects from another peer or gets information that some peer from its tree connected to/disconnected from another peer. The tree is used to determine which neighbor to forward packet to in order to get to the destination peer. If the tree does not contain the destination peer, the peer from the same country (and in the next step timezone) is picked. If there are still no such peers, the packet is forwarded to the first neighbor in the tree. If there are no neighbors, the packet is dropped.
To prevent infinite routes and routing loops, a Hop Limit field of IPv6 (equivalent of IPv4's TTL field) header is limited to 16. This way, the packet can travel at most 16 hops before it is dropped. Also a packet is dropped when it would be routed back to the source peer.
You will need to have a rust toolchain installed along with build-essential package on Debian-based distros, base-devel on Arch-based distros or corresponding packages on other distros to build WebX.
WebX itself also depends on libcap, python3, findutils, iproute2 and coreutils packages, but those are usually preinstalled on most distros.
You can get rust toolchain from rustup.rs.
If you're running Arch Linux or Debian-based distro (including Debian itself) it is recommended to build the package and install it using a package manager. Detailed instructions below.
Arch Linux:
git clone https://github.com/HXM4Tech/webx.git
cd webx
makepkg -siDebian-based distros:
cargo install cargo-deb
git clone https://github.com/HXM4Tech/webx.git
cd webx
cargo deb
sudo dpkg -i target/debian/webx_*.debFor other distros you will need to build and install WebX manually. Detailed commands for user-wide installation below:
git clone https://github.com/HXM4Tech/webx.git
cd webx
cargo build --release
install -Dm755 "target/release/webx" "$HOME/.local/bin/webxd"
sudo setcap CAP_NET_ADMIN+eip "$HOME/.local/bin/webxd"
install -Dm755 "py-src/cli.py" "$HOME/.local/bin/webx-cli"
install -Dm644 "config.toml" "$HOME/.webx/config.toml"After completing, ensure that $HOME/.local/bin is in your $PATH.
If you used a package manager to install WebX, you can find the config file at /etc/webx/config.toml. You can override it by creating a config file at ~/.webx/config.toml.
If you built WebX manually, you can find the config file at ~/.webx/config.toml.
If you used a package manager to install WebX, you can start daemon using systemd:
sudo systemctl start webx@$USERYou can also enable it to start on boot:
sudo systemctl enable webx@$USERIf you prefer running WebX as different user, replace $USER with desired username.
If you built WebX manually, you can start daemon by directly launching daemon binary:
webxdIf you want to run it in background, you can use screen.
If the daemon has started successfully and connected to network you can start accessing WebX addresses right away.
You can also use webx-cli to check what is your WebX address, how many packets have you sent/received/forwarded and what peers are in your peer's tree.