# Running a node

Running a node can be done for two purposes: relaying transactions and/or mining. For relaying transactions all you need to do is run the executable and you are good to go. If you want to mine then you need to set a username and password so that your miner is able to connect to it.

There are two ways to do this: set them in your config file or pass them in using parameters.

#### Method 1: config file

The advantage of this method is that you don't have to enter it anywhere. You can run your node and use the cli tools wihtout passing in the rpcuser and rpcpassword flags all the time.

Create the file `~/.factorn/factorn.conf` if it does not exist. Add the following to it:

```
rpcuser=<Type a username of your choice>
rpcpassword=<Type in any password of your choosing>
```

That's it. You can start your node or use the cli tools and it will use that username and password automafically.

#### Method 2: Command line RPC flags

From the directory where you untar-ed your binaries from the release page do the following:

```
./factornd -rpcuser=<set your username here> -rpcpassword=<set your password here>
```

Your miner will need these to connect to your node and ask for the next block to mine. If you are mining locally your port are the standard ports: mainnet -> 8332 and testnet -> 18332. By default `factornd` runs on mainnet. To run testnet do:

```
./factornd -rpcuser=<set your username here> -rpcpassword=<set your password here> -testnet
```

You will need to know this ro run FACTOR.py from the mining code at `https://github.com/FACT0RN/factoring`.


---

# 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://docs.fact0rn.io/node/running-a-node.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.
