Anyone Docs
  • 🔷The Documentation For Anyone
    • About
    • FAQ
  • 🔷Relay Setup
    • Get Started
    • Installation and Usage
      • Setting Your Environment
        • Virtualization on Windows
        • Virtualization on macOS
        • Install Ubuntu Server 22.04
        • Server management with SSH in Windows and macOS
      • Install Anon on Linux
      • Install Anon using the apt repository
      • Update Anon and accept terms and conditions
      • Install Anon in Docker
      • Configure SOCKS5 Proxy for Anyone
      • Install Anyone Exit Relay
    • Troubleshooting Common Issues
      • Diagnosing CGNAT and Public IPv4
      • Confirm ORPort Reachability
    • Firewall and Network Configurations
      • Router Port Forwarding
      • Install and Configure Firewall
    • Advanced Configuration and Troubleshooting
      • Configure IPv4 and IPv6
      • DoS mitigation parameters
    • Relay Operator Standards
    • Exit Relay Guidelines
  • 🔷Hardware Setup
    • Setup Guide
    • Description and Specifications
    • Relay Control Panel
      • Home
      • Network Settings
      • Relay Settings
      • Relay Family
      • Proxy Settings BETA
      • Change Password
      • Logs
      • Update
    • Update (Using USB)
    • Update to WEB 3.2.0 (Using UI)
    • Troubleshooting and additional configuration
      • Router Port Forwarding
      • Diagnosing CGNAT and Public IPv4
    • Router Setup
  • 🔷Security and Privacy
    • VPS Hardening
  • 🔷Rewards Dashboard
    • Registering to the Rewards Program
    • Accessing the Rewards Dashboard
    • Using the Rewards Dashboard
    • Rewards Status
  • 🔷Anyone SDK
    • NPM SDK
      • Install NPM Package
      • Run as Library
        • Anon
        • AnonSocksClient
        • AnonControlClient
      • Run from CLI
      • Tutorials
        • Hello Anon World I
        • Hello Anon World II
        • Circuit Control I
        • Circuit Control II
    • Native SDK
      • Anyone Client Releases
      • MAN - Anon Manual
      • Tutorials
        • Anyone Services I
        • Anyone Services II
    • iOS SDK [Beta]
      • Manual Install - CocoaPods
  • 🔷Connect to Anyone
    • Connecting to Linux
      • [Beta] One-Click Linux Setup
    • Connecting to macOS
      • macOS with NPM
      • [Beta] One-Click macOS Setup
    • Connecting to Windows
      • [Beta] One-Click Windows Setup
    • Individual Applications with Anyone
    • Connect Through Hardware
  • 🔷Tokenomics
    • Introduction
    • Token Distribution
      • Token Outflow
      • Other Tokens
    • Relay Rewards
      • Lock Requirement
      • Lock Adjustments
      • Reward Multipliers
    • Additional Roles
      • Authorities and Staking
      • Governance Voting
    • Premium Circuits
      • Premium Circuits
      • Premium Circuits: Metrics
    • Summary
      • Value Accrual Summary
      • Rewards Case Study
    • Appendix
      • M Derivation
      • Risk Equation Derivation
  • 🔷Resources
    • Community and Customer Support
    • Links
    • Token
    • Whitepaper
    • Roadmap
    • API
      • REST
      • [Future] GraphQL
Powered by GitBook
On this page
  • Creating a Random Circuit
  • Creating a Manual Circuit

Was this helpful?

  1. Anyone SDK
  2. NPM SDK
  3. Tutorials

Circuit Control II

Now that we've used the AnonControlClient to see some circuit info, lets use it to assemble circuits with a little more customization!

Aside: Relay Fingerprints and Circuits

Fingerprints All relays have a unique identifier known as a fingerprint. Within the clients, authorities and even on-chain, the fingerprint is a relay's foremost identifier (even ahead of it's IP address). When selecting relays to build a circuit through, the fingerprint is how you specify them.

Example Fingerprint
41B78C1198702625B30FB225AE37AAC0B2FA4ED

Circuits A chain of relays that continually decrypt packets between an Anyone client and its destination (website or hidden service) is called a circuit.

The default onion routing circuit in the Anyone Network is 3 hops- an Entry relay, Middle relay and Exit relay. This model provides a certain level of defence against malicious relays, as a single relay does not have enough information to deanonymize a user.

However, circuits of any length can be constructed, including just one relay. However, if used to visit public websites, one of the relays must be an Exit.

Creating a Random Circuit

We will be introducing the function extendCircuits , which is used to negotiate a new circuit. If no arguments are passed, extendCircuits will select a circuit using the default, randomized selection process, and return a circuit ID number.

const circuitID = await anonControlClient.extendCircuit();
console.log("Randomly created circuit:", circuitID);

This circuit ID can then be used to manage it further, including closing that specific circuit:

await anonControlClient.closeCircuit(circuitID)

Creating a Manual Circuit

The extendCircuit function can also take in an object structured like below, specifying the relays in order by fingerprint:

{
    serverSpecs: [
        "41E262A8DAFB34B7AD5F82280813584101E2A47A",
        "41ADDE21CDCE614FF35DA58CDC15BC7A4A6DFE4D"
    ]
}

As is evident, it is not essential to specify a path of exactly three relays. So long as the first fingerprint has the Guard flag (which means the relay can act as an entry relay) and the final fingerprint has the Exit flag (which means it's able to forward your traffic over the clear-web), the circuit can be of any length. It can even consist of a single node, so long as that relay can be both an Entry and Exit node!

How do we find the available fingerprints and the information needed to build a circuit from them? We have recently rolled out a new function in the NPM SDK: routerStatus that does exactly that!

Using the routerStatus Function

Note: Ensure that you have updated your npm client by running npm update within the working directory after it has been setup, to have access to this new function. Once the control client is setup, the new function simply needs to be called asynchronously:

const routerStatus = await anonControlClient.routerStatus();
console.log(JSON.stringify(routerStatus, null, 2));

Once the promise is resolved, the function returns a JSON file listing. Let's have a look at its format:

{
    "nickname": "AnyoneRelay02",
    "fingerprint": "Dz8wKhDvPf0z8Y1PCoWm9q3eMSE",
    "digest": "xBuwTXYjA2HoNP5jum/aJ4QPqCg",
    "publishedTime": "2038-01-01T00:00:00.000Z",
    "ip": "162.55.183.223",
    "orPort": 9001,
    "dirPort": 0,
    "flags": [
      "Fast",
      "Guard",
      "HSDir",
      "Running",
      "Stable",
      "V2Dir",
      "Valid"
    ],
    "bandwidth": 38000
},
{
  "nickname": "DeadZone",

Relays are listed in order, and have their own object which includes information on its IP, bandwidth and flags!

The introduction of custom circuits and the ability to build them based on manual criteria opens up a huge range of potential applications, including the use of algorithms and AI to create circuits. However, it also shifts the risk of de-anonymization onto you - the application developer - and subsequently your users. Be wary of the centralization risks of choosing circuits from a limited set of circuits, and look out for algorithms developed by the community to get the best of both worlds!

PreviousCircuit Control INextNative SDK

Last updated 5 months ago

Was this helpful?

🔷