How to Decode Your Inleo Keystore File Hive Keys?

avatar
(Edited)

Hey everyone,

Since I have seen a couple of people using my #inleo referral, and recognizing that my attempt on reaching out might actually not be possible. I have decided to call for forces within the skilled enough (and with free time to produce something that will help the user in these cases).

What am I talking about?

As you can see, I have a bunch of referred people, of which the only one I know on the chain is @finpulse. The rest basically either want to give me referral rewards or are failed attempts, because they don't continue their experience on the chain.

And given some of them reported not understanding where their keys are... I then attempted to replicate the mistake/issue I think it is, and understand if there was anything I could help with.

What do you need for this?

Unfortunately, this is not a simple tool you can use, and it requires a bit of software skills for you to understand what I am going to explain. But in a broader perspective and strategy, this post will fit anyone else who would like to develop such too, still protecting people's keys by making sure when users use it, they will not accidentaly share or expose their private keys.

Problem Description?

People create a #inleo account, using the keystore method most of the time (because it's the recommended one). And when storing their keystore file, they forget completely to store the individual Hive Keys (especially the owner one).

Why is it important? Well, most people don't know how to generate the keys from the Master Password, which in #inleo UI, is represented by the "seed phrase". And then they feel (or might) security-wise afraid of progressing further with that account. One should never feel like that, and knowing ALL your keys is something you have to keep remmembering that is 100% essencial to have at all times. Because if there is any problem where you need to react, you will need them! And waiting for learning could cost you the attack (someone doing) or your own mistake.

So, YOU SHOULD always KNOW, ALL your #Hive private keys! AT ALL TIMES... even if you don't know what to do with them.

Note: Most people might be quite familiar with Hive Keychain, and they get used to use either individulay their keys, or the master password. But on other UX/UIs/tools you can use the owner key to save your ass or do other geeky things.

Right, let's begin!

Requirements:

  1. Your Keystore file
  2. Your Keystore file password (you entered/created this password before you downloaded your keystore file)
  3. A Linux-based system

Preparation

You need a couple of tools to accomplish this... like nodejs, python, and beem (a library/tool, to interface with hive).

On your Linux system (I am going to use Ubuntu):

sudo apt install nodejs python pip
pip install beem
npm install @xchainjs/xchain-crypto

Creating the scripts

Lets create a little space for us to work...

mkdir decrypt_keystore
# Then copy your inleo-ACCOUNT.json here and rename it to keystore.json

Create this JS file (use VIM 🤓 or any other editing tool). This should be the content of the script decrypt_keystore.js:

const { decryptFromKeystore } = require('@xchainjs/xchain-crypto');
const fs = require('fs');

// Load the keystore file
const keystore = JSON.parse(fs.readFileSync('./keystore.json', 'utf8'));
const password = "YOUR_PASSWORD_OF_THE_KEYSTORE_FILE" // You should replace the CAPS letters with your real password... and please remove it afterwards.

// Decrypt the keystore
async function decryptKeystore() {
  try {
    const phrase = await decryptFromKeystore(keystore, password);
    console.log("Decrypted Seed Phrase:", phrase);
  } catch (error) {
    console.error("Error decrypting keystore:", error.message);
  }
}

decryptKeystore();

Nice, so now we can decrypt the keystore file using JS... but before we do that, we should just create the python script that will show all your account keys, using the "seed password" that will be decrypted from the nodejs script.

Create a file called, for example, generate_hive_keys.py with the following code snippet:

from beemgraphenebase.account import PasswordKey

# Input your Hive username and master password
username = input("Enter your Hive username: ")
master_password = input("Enter your master password: ")

# Define the roles for Hive keys
roles = ["owner", "active", "posting", "memo"]

# Generate and print keys for each role
print("\nYour Hive Keys:")
for role in roles:
    # Generate private key
    private_key = PasswordKey(username, master_password, role)
    priv_key = str(private_key.get_private_key())
    # Derive public key from private key
    pub_key = str(private_key.get_private_key().pubkey)
    print(f"{role.capitalize()} Private Key: {priv_key}")
    print(f"{role.capitalize()} Public Key: {pub_key}")
    print("(♥_♥)")

Now you just execute things...

The reason I am explaining like this is to be sure you understand that this should be executed on a machine you trust that has not been compromised. Please don't use VMs on the web if you don't trust them.

node decrypt_keystore.js
# The output of this should be your seed phrase, assuming your password that you replaced under the YOUR_PASSWORD_OF_THE_KEYSTORE_FILE part, otherwise it will say your password is wrong.
# After seeing your seed phrase (record it in a safe place, because with this, ANY of your HIVE keys can be derived).
python3 generate_hive_keys.py
Enter your Hive username: <TYPE_THE_ACCOUNT_HERE_OF_YOUR_KEYSTORE_FILE>
Enter your master password: <PASTE_YOUR_SEED_PHRASE_HERE>

You will then get an output similar to this:

Your Hive Keys:
Owner Private Key: <PRIV_KEY>
Owner Public Key: <PUB_KEY>
(♥_♥)
Active Private Key: <PRIV_KEY>
Active Public Key: <PUB_KEY>
(♥_♥)
Posting Private Key: <PRIV_KEY>
Posting Public Key: <PUB_KEY>
(♥_♥)
Memo Private Key: <PRIV_KEY>
Memo Public Key: <PUB_KEY>
(♥_♥)

Copy those priv keys to a secure place, and there you go!

All done...

Now you can import stuff into @keychain or use any tools that require specific keys.

Didn't understand a word I said?

No worries... and if you need help recovering your keys, ping me anywhere... I will try to help you as soon as I can - (please indicate the urgency if it's urgent... as I sometimes check stuff and plan for later to respond due to time constraints).

With 💕

From @atexoras.witness

👉 Vote for Witnesses

(Quick⚡Vote4me) - Or vote for HIVE witnesses here - voting uses staked HIVE
(Quick⚡Vote4me) - Or vote for Hive-Engine witnesses here - voting uses staked WORKERBEE

Posted Using INLEO



0
0
0.000
6 comments
avatar

I still remember how difficult it was for me to manage my keys through keystore and you helped me a lot. I do not understand too much of coding but I think you made the process simple and easy

0
0
0.000
avatar

This is very helpful!

0
0
0.000
avatar

Hope more people learn about crypto.

These things are valid for many chains, and the methods of learning are very similar. Hive can have a huge opportunity to teach everyone on the crypto community.

This experience allied to the fact that we are decentralized and not prone to pressure by governments, makes it the perfect excuse to make a lot of our SOUND roar!

0
0
0.000
avatar

Congratulations @forkyishere! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

You got more than 5250 replies.
Your next target is to reach 5500 replies.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out our last posts:

Our Hive Power Delegations to the May PUM Winners
Feedback from the June Hive Power Up Day
Hive Power Up Month Challenge - May 2025 Winners List
0
0
0.000