# Local Node Mode

Before using the local node mode of PIWallet, make sure you have done the bellow:

* Installed pchain
* Sync to the latest height (you can check by [Monitor](http://monitor.pchain.org/))
* Create Your Account
* Pchain running RPC (run pchain with flag –rpc –rpcapi=eth,web3,admin,debug,tdm,miner,personal,chain,txpool,del –rpcaddr=0.0.0.0)
* Opened RPC port to your local IP
* Copied keystore file to your datadir (required to send transactions)

{% hint style="info" %}
Pchain RPC’s default port is 6969, remember to open your port 6969 **ONLY** to your local IP and **DO NOT** keep your account unlocked for a long time.&#x20;
{% endhint %}

First, set the RPC URL in the wallet. The RPC URL is [http://yourserverip:rpcport/chainid](http://yourserverip/:rpcport/chainid), so suppose you are running pchain on a machine whose IP is 111.222.333.444, and you open RPC with pchain default RPC port, and you wanna interact with main chain, the RPC URL should be [http://111.222.333.444:6969/pchain](https://pliangroup.gitbook.io/plian/master/using-the-blockchain/piwallet/desktop-wallet/http:/111.222.333.444:6969/pchain). If you want to interact with subchain which chain id is child\_0, the RPC URL should be [http://111.222.333.444:6969/child\\\_0](https://pliangroup.gitbook.io/plian/master/using-the-blockchain/piwallet/desktop-wallet/http:/111.222.333.444:6969/child\\_0).

![](https://pchaindoc.readthedocs.io/en/latest/_images/seturl.jpg)

After this, PIWallet will read the chain state to the wallet.

{% hint style="info" %}
If you are having issues sending transactions in local node mode, make sure the keystore on your connected node is in the correct place. Your datadir looks like the below:
{% endhint %}

```
datadir/
        -chaininfo.db/
        -config.toml
        -nodekey
        -nodes/
        -tx3cache/
        -pchain/
                -data/
                -geth/
                -pchain.ipc
                -priv_validator.json
                -keystore/   //you should put your keystore file under here
        -child_0/
                -data/
                -geth/
                -pchain.ipc
                -priv_validator.json
                -keystore/       //you should put your keystore file under here
```


---

# 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://pliangroup.gitbook.io/plian/master/using-the-blockchain/piwallet/desktop-wallet/local-node-mode.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.
