Making GHOST Node work with Polkadot JS

Introduction

Since GHOST Node is based on substrate, the same library Polkadot is based on, it stands to reason that its possible to make GHOST Node work on Polkadot JS website with Polkadot JS Extension.

TLDR How To

  1. Turn your GHOST Node into a RPC endpoint on your local network
  2. Plug the local RPC URL into Polkadot JS Website
  3. Import GHOST Node accounts into Polkadot JS Extension

and Presto! You can monitor/manage your GHOST Node via a website, instead of the terminal!

Why use the Polkadot Website

Polkadot.js Apps uses the node’s RPC interface to provide a user-friendly GUI for:

  • Account Management: Creating, importing, and exporting accounts (including raw seed import).

  • Transaction Submission: Sending funds, staking, voting, and interacting with any pallet’s extrinsics.

  • Chain State Queries: Browsing blocks, querying storage, and inspecting runtime metadata.

  • Basic Node Info: Viewing the node’s chain name, health, peers, and versionPolkadot.js Apps uses the node’s RPC interface to provide a user-friendly GUI.

Actual How To

  1. Have a working GHOST Node, follow all the guides here.
  2. Get inside the GHOST Node via terminal and run:
sudo cat /etc/default/ghost

Output should be something like this:

GHOST_CLI_ARGS="--port=30340 --rpc-port=9945 --chain=/etc/ghost/casper.json --node-key-file=/etc/ghost/node-key --validator --no-prometheus --name='random_name' --bootnodes=/dns/bootnode69.chain.ghostchain.io/tcp/30334/p2p/12D3KooWF9SWxz9dmy6vfndQhoxqCa7PESaoFWEiF8Jkqh4xKDRf --base-path=/var/lib/ghost --state-pruning=archive --blocks-pruning=archive --no-private-ip --rpc-methods=auto --no-mdns --telemetry-url='wss://telemetry.ghostchain.io/submit/ 9'"
  1. You have to add 2 flags and change 1 flag in your CLI arguments:

Add 2 flag:

--rpc-external --rpc-cors=all

And Change --rpc-methods flag from:

--rpc-methods=auto

to:

--rpc-methods=safe

You can do so via any editor for example nano:

sudo nano /etc/default/ghost

Make all the changes and make sure to save!

If you run the cat command again your CLI arguments should look something like this:

GHOST_CLI_ARGS="--port=30340 --rpc-port=9945 --chain=/etc/ghost/casper.json --node-key-file=/etc/ghost/node-key --no-prometheus --name='random_name' --bootnodes=/dns/bootnode69.chain.ghostchain.io/tcp/30334/p2p/12D3KooWF9SWxz9dmy6vfndQhoxqCa7PESaoFWEiF8Jkqh4xKDRf --base-path=/var/lib/ghost --state-pruning=archive --blocks-pruning=archive --no-private-ip --rpc-methods=safe --rpc-external --rpc-cors=all --no-mdns --telemetry-url='wss://telemetry.ghostchain.io/submit/ 9'"

Restart ghost-node:

sudo systemctl restart ghost-node

Finally take note of your rpc-port. It should be 9945 by default.

  1. Copy Secret Seed for you Stash Wallet

Run

cat /etc/ghost/stash-key

Save that string for later. You are now done with the terminal portion!

  1. Go to Polkadot JS Website and Install Polkadot JS Extension.

  2. Open Polkadot JS Extension and import account from pre-existing seed

Paste the Secret Seed from Step 4 into the text box, click Next. Create a secure password, give the a account name.

Now you should see something like this in your Polkadot JS Extension:

  1. Allow your Stash Address to talk to Polkadot JS Website. Go to Setting > Manage Website Access > https://polkadot.js.org > Connect your Stash Address



Now you might be thinking that the address in the extension DOES NOT match your sf address, and you would be correct! This is because Polkadot JS Extension uses the same Secret Seed but different Chain ID and Prefix to visualize addresses.

Here is how we fix it. We make the Polkadot Extension exclusive to CASPER STAGING TESTNET.

Update the metadata by going to Setting in the Polkadot JS Website. Under Extensions select Polkadot JS. Click Update Metadata, and approve the action.

You now have CASPER STAGING TESTNET inside your Polkadot Extension. Now open the extension and click the 3 dots for your Stash Account:
image

In the dropdown Allow on any chain, select CASPER STAGING TESTNET.

You Stash Account should transform to an sf address.
image

  1. This is where the magic happens! Go to Polkadot JS Website, it should look something like this:

Click on the very right to open the Chain Selector Menu:

Under the Development Section, change custom endpoint to, and click SAVE:

ws://localhost:9945

Refresh the website! Now It should transform to look like this:

Your Stash Account should already be there, see Step 7.

If you are a validator, now you can manage your GHOST Node via Staking Page.

You can Send $CSPR to other addresses.

You can even see the live explorer.

If you’ve made it this far congratulations! Let me know in the comments if it worked.

NOTE - What GHOST Project really needs is a publicly accessible RPC endpoint, then potential new users won’t even have to run their own nodes. They’ll be able to simply plug in the Public RPC URL into the Polkadot JS Website and it will simply work :wink:

2 Likes

We definitely should expose not only getAccount - which is our custom method - but also getAccounts, to make the extension work with the app as the app expects it to. Here is the list of methods exposed by the background script.

It would also be good to use ghost-connect as the RPC provider for the app, since it already has everything needed to operate with it. Need more investigation on how exactly to do that.

2 Likes

Hey Cosmos, I wanted to follow your lead and play around with this a bit, but I only have a full node at the moment due to the limited CSPR availability after TN7 launch.

Is it necessary to have a validator node already live to follow this, or am I good to go proceeding with just a full/boot node for now?

1 Like

On the Polkadot JS Website you can pretty do anything you would do via GHOST Eye.

You can send, receive, validate, nominate, do governance voting, query the chain, etc. You don’t need to be a validator to use it.

1 Like

Thanks Cosmos, I followed your steps and can confirm they work end to end on TN7. I’m running a full node on a separate Ubuntu machine and using Polkadot JS from my Mac. Connected, imported my stash into the polkadot{.js} extension, set the network to Casper Staging Testnet, and checked the chain state, session keys and staking pages. I also sent CSPR between two accounts and verified it in the Explorer. Sending, receiving and querying all worked as you described.

I also want to share one thing I learned that isn’t covered in the guide: how to empty a wallet completely without guessing the fee.

What’s the existential deposit?
The chain requires every account to keep a minimum balance, currently 0.0005 CSPR (GhostEye shows it as “min deposit”). If an account drops below that, the chain deletes it (“reaps” it) and the leftover dust is burned.

What happens if I move everything out?
Two things matter here:

  • An ordinary send GhostConnect / Light fails if you try to send your whole balance, because nothing is left to pay the fee. In my test, the block showed ExtrinsicFailed with Token: FundsUnavailable, and the fee was still charged.
  • The chain has a call built for this, balances.transferAll. It sends everything and takes the fee off the top, so there’s no math to guess.

Ghost Lite doesn’t offer a send-all option, but you can do it from Polkadot JS:

  1. Developer → Extrinsics

  2. Select the account you want to empty

  3. Choose balances and transferAll(dest, keepAlive)

  4. Set dest to the account that should receive the funds. It defaults to the selected account, so change it.

  5. Set keepAlive to No to empty the account completely and let it be reaped. Set it to Yes to leave the 0.0005 deposit behind so the account stays alive.

  6. Submit Transaction, sign in the extension

One note: reaping removes the account from the chain’s current state, but the history in past blocks stays visible. It tidies state up and doesn’t erase the trail.

Heads-up for anyone running a validator: on my setup (ghost-node 0.9.3), adding --rpc-external together with --validator made the node refuse to start. Since my browser is on a different machine, I used an SSH tunnel (ssh -N -L 9945:127.0.0.1:9945 user@node-ip) and pointed Polkadot JS at ws://127.0.0.1:9945. That works without exposing RPC.

1 Like