# Using a remote node

In order to interrogate a node with cardano-cli and submit transactions to it with cardano-cli, cardano-cli needs to connect to its socket file.&#x20;

It is possible to use `socat` to connect to the socket of a remote node. For that, 2 things must be done:

* on the server running the node, where the socket file is, the following `socat` command must be executed:\
  `socat TCP-LISTEN:2010,reuseaddr,fork UNIX-connect:/opt/cardano/cnode/db/node.socket`\
  This command will create a TCP socket on the port 2010 (the port can be any available port), and will connect it to the cardano-node socket file (the path `/opt/cardano/cnode/db/node.socket` must be adjusted to point to the existing socket file).
* on the client, where the `cardano-cli` commands will be executed, the following command must executed:\
  `socat UNIX-LISTEN:/run/cardano-node.socket,fork,reuseaddr,unlink-early,user=<username>,group=<group>,mode=755 TCP:<server_ip_address>:2010`\
  The `/run/cardano-node.socket` is where the local socket file will be created. The \<username> and \<group> must be replaced with the username and the group of the user who will run the cardano-cli commands, the `<server_ip_address>` the must be the server's ip address or hostname, and the port 2010 must be the same port configured on the server.&#x20;

After doing this, the `CARDANO_NODE_SOCKET_PATH` environment variable must be set to the `/run/cardano-node.socket` file (the name that was used in the second command), and then cardano-cli can be used to interrogate the cardano-node.


---

# 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://apexpool.gitbook.io/stake-pool-scripts/stake-pool-registration/transaction/using-a-remote-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.
