# Adding Routers and Components - Step by Step Guide

Adding new routers and components to a Node must be done in the correct order. The following constraints apply:

1. A Node Owner cannot add a Router that is not whitelisted at the protocol level
2. A Node Owner cannot add a component unless both:
   1. The component is whitelisted on a Router by the RegistryOwner
   2. This specific Router has already been added to the Node by the owner

#### 1. Protocol Owner Actions

```solidity
// Must happen first - whitelist router at protocol level
registry.setRegistryType(routerAddress, RegistryType.ROUTER, true);
```

#### 2. Registry Owner Actions

```solidity
// Whitelist component on specific router
router.setWhitelistStatus(componentAddress, true);
```

#### 3. Node Owner Actions

```solidity
// First add router to node
node.addRouter(routerAddress);

// Then add component that uses that router
node.addComponent(
    componentAddress,    // component address
    targetWeight,       // e.g., 0.7 ether for 70%
    maxDelta,          // acceptable deviation
    routerAddress      // must match router added above
);
```

If steps are performed out of order:

* Adding component before router: Reverts with `RouterNotApproved`
* Adding component before router whitelist: Reverts with `NotWhitelisted`
* Adding router before protocol whitelist: Reverts with `NotWhitelisted`
* Adding component before component whitelist: Reverts with `NotWhitelisted`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nashpoint.gitbook.io/nashpoint/adding-routers-and-components-step-by-step-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
