# 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/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/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
```
