Private Keys Relationship in HD Wallets

  1. What’s the relationship between the first pkey/addr (the one with hdkeypath: m/0'/0'/0 and the third one m/0'/0'/2?

They are derived from the same parent key. Other than that, there is no relation.

Does the first key/addr is the master (key) who can recover all later keys generated in the wallet.

No. They are both child keys of the key at m/0'/0'. The actual master private key (the key at m) is not exportable. There is a HD seed (which is used to generate the master private key at m), but this is only exportable through the dumpwallet RPC.

  1. I only backup the private key of m/0'/0'/2, and removed the whole wallet (the .dat file). Is there a risk of this method? Since I only choose to use this key/addr to receive and store BTC.

Don’t do that, you will lose money. When you send Bitcoin, Bitcoin Core will generate new change addresses and send any change there. Those change addresses have different private keys. Without them, you will lose money.

Additionally, by reusing the same address, you are significantly hurting your privacy. By using the same address over and over, anyone you transact with will know how much money you have in your wallet and be able to see all of your incoming and outgoing transactions. This allows anyone to track your spending habits.

  1. I later create a new wallet and restore this m/0'/0'/2 key with command importprivkey. and send some BTC to other people, and found it generate a CHANGE addr, so I also backup this new addr’s private key too. Since I mainly use this m/0'/0'/2 to store long term BTC, and will not use it to make a lot transactions. So I keep the privatekey of m/0'/0'/2, and keep backups priv keys of change addresses it generated, then drop all wallet files. Is this method enough to restore all my balances in a futher day.

Bitcoin Core constantly generates new change addresses. The one time you forget means that you will lose money. If you accidentally request a new address and use it, you will lose money.

In general, backing up individual private keys is not recommended. You should back up the entire wallet.dat file itself. There is no need to export each key individually and back it up in that way. That is a surefire way to lose money at some point in the future.

  1. Can the private key of m/0'/0'/2 be used to recover the change addresses’ private keys? (What is the master seed of HD wallet, it is the private key of m/0'/0'/0?)

No. The change addresses are unrelated. You would need to have the HD seed mentioned previously in order to derive them.

rsa – Difference between these two extracted public keys?

I generated an RSA Private Key using openssl genrsa -out mykey.pem 2048

To extract the public key I have found 2 commands, one using openssl :

openssl rsa -in mykey.pem -pubout >

And the other using ssh-keygen:

ssh-keygen -y -f mykey.pem >

However I noticed that boths outputs doesn’t look anything alike. I know that a private key can only have one unique public key so why the outputs are different?

private key – HD Wallet with BIP44 – workaround of deriving public keys knowing only a xpub

My goal: I don’t want to require a private key to hierarchically derive new addresses.

Sure, I can create a batch of addresses, given a private key, at first. But once I have surpassed that batch I’ll require the private key again to generate more addresses.

I want to derive addresses knowing only a public key. I know this is possible with BIP39, but understand there can be security concerns involved with this, ie. if an attacker stumbles upon an xpub and xprv they can derive as many addresses as they want and be able to sign transactions using them.

Attempting to derive from a HD public key with BIP44 results in a exception stating a hardened path requires a HD private key. However, I have found a workaround, but I fear it is cheating and might sacrifice the benefits of path hardening in BIP44.

Here’s an example:

// It starts off with a `userCode` that represents a BIP39 Mnemonic code.
const codeUser = new Mnemonic('select scout crash enforce riot rival spring whale hollow radar rule sentence')

// Convert to HD private key...
const hdUserPrivateKey = codeUser.toHDPrivateKey()

// Gives: `xpub661MyMwAqRbcEngoXGfFNahZ5FzSDGqY8pWKTqo6vtXxK15otDNLXJmbeHV7DUjvPc7CAFhYp6hzBiTanr8rgoHPHf6NSgZAyejK5bk8MiW`
// But we won't use it...

// Instead, I can then derive a BIP44 without the `change`, `address_index` segments from `hdUserPrivateKey`...
// Gives: `xpub6CsrEMgU2f8uEGfFMvsPjKB9ekHuZiesLqSHLwCJuNFkP2uJGm7WjTo2gy95S4KEBc4etdodNQXAvn5Vsf4kupJQ1DKR4DMfcHwKdhQ3k6h`
// This is the xpub I can use to derive addresses without requiring the initial private key.

// So knowing this, I can build a HD public key given that xpub...
const hdPublicKey = Mnemonic.bitcore.HDPublicKey('xpub6CsrEMgU2f8uEGfFMvsPjKB9ekHuZiesLqSHLwCJuNFkP2uJGm7WjTo2gy95S4KEBc4etdodNQXAvn5Vsf4kupJQ1DKR4DMfcHwKdhQ3k6h')

const derivative = 0

// We can derive from it this path, but what is this path defined as? Are we back in BIP39 territory now?
const publicKey = hdPublicKey.deriveChild(`m/0/${derivative}`).publicKey

const address = new Mnemonic.bitcore.Address(publicKey)

console.log(address.toString()) // 12XyHwtmoq5w4VQ5mzcu6BQzdLqCLxUv5e

…and of course, I can increment the derivative as many times as I wish to create new addresses from the public key.

Whenever I wish to sign a transaction…

const codeUser = new Mnemonic('select scout crash enforce riot rival spring whale hollow radar rule sentence')
const hdUserPrivateKey = codeUser.toHDPrivateKey()
const derivative = 0

// BIP 44 derivation path for private key...
const privateKey = hdUserPrivateKey.deriveChild(`m/44'/0'/0'/0/${derivative}`).privateKey

Is this approach valid or am I dodging BIP44 standards?

Laravel 7 error 150 foreign keys – Xampp / wamp

resulta que siempre trabajé con Wamp sin ningún problema, ahora me mudé a Xampp y en laravel creo las migraciones de la misma forma pero al momento de hacer php artisan migrate, me arroja:

error: 150 “foreign key constraint is incorrectly formed”

Hice una prueba con las mismas migraciones de un proyecto, y en Wamp funciona como siempre y con Xampp arroja siempre ese error.
Leí que podria ser problema del orden en que se crean las tablas, aún asi no funciona. No sé que puede ser ya.

keyboard – keys 789jklm. do not work with imac

I have tried 3 different apple magic keyboards with my older imac, these specific 8 keys don’t work at all, 7 8 9 j k l m . on any of them.
I have a wireless acer and all keys work just fine.
I use macOS Catalina 10.15.7
I use Logic pro X for recording on my imac and really need the shortcuts on the apple keyboard. Is there any hope?

malware – Is it possible to achieve persistence in Windows through using WinLogon without touching userinit, notify, or shell keys?

I am interested in finding out if it is possible to achieve persistence through winlogon without using one of those 3 mentioned keys. I am trying to determine if it’s safe to ignore registry key entries made into Winlogon parent directory. I’ve never seen an instance of malware achieving persistence through winlogon without using any of those keys, does anyone know of any techniques?

encryption – Whether TLS session resumption reuse the symmetric keys?

I am learning TLS Session Resumption.

What I got is session resumption can reduce 1 RTT for TLS 1.2 by reusing MasterSecret. Both the client and server needn’t to run key exchange algorithm.

My questions are:

  1. Whether session resumption reuses symmetric encryption keys (to encrypt TLS records).
  2. What factors affect whether to reuse symmetric encryption keys?

I searched around Google, but cannot find a authoritative answer. Here is what I got:

  1. Do not reuse encryption keys. Refer to SSL session key usage when browser opens multiple sockets to same server.
  2. Reuse encryption keys. Refer to

Any ideas are welcome.

digital signature – It’s securely to store private keys in AWS Secret Manager?

I’m implementing a service that makes signs and sends transactions at the end of the day, this acts as a crypto exchange. The service creates for every new user a key pair (Private key with his public key). The user can deposit his funds to his respective public key (this is a hot wallet and he has no access to the private key of it) and the service must send these funds to a cold wallet at the end of the day. I’m looking for a solution to store these private keys safely using AWS infrastructure.

Reading the description of AWS Secret Manager, it says that it can store API keys, DB Credentials, or tokens OAuth, but it doesn’t mention crypto private keys.

I found other solutions using Hashicorp, but if I prefer a solution using any AWS solutions.

So, the questions are:

  1. It’s safe to store Private keys in AWS KMS or Secret Manager?
  2. If is not, is there a solution using AWS?

If both AB and AC are candidate keys for R(A,B,C), then is there any relation between B and C?

I mean, if AB -> C, and C -> B, then we can infer that AC is also a candidate key. I would like to know that given AB -> C, and AC -> B, is there some inference like B->C or C-> A?

keyboard – Late 2011 Macbook Pro 13″ FGHJKL Keys Intermittently Working

My MacBook Pro, a late 2011 model running High Sierra has been giving me this issue where some keys – FGHJKL, aren’t working sporadically. Sometimes it works fine for a while but then after some time now it starts to behave more sporadic until it works none at all.

I’ve read a lot of posts on this issue, but none offered any real help. Some say it could be that since the battery is swollen (which it is) then that could be the root cause, so I let it run without the battery and it didn’t work fine without. Some say it could be a software issue, so I went ahead to resetting the SMC, PRAM, reinstalling the OS, clearing junk cache, and even clearing out some .plist files from the Library > Preferences folder.

My only remedy is to restart the computer where it works fine for a while. I’m also using karabiner to map combinations to the keys that don’t work.

I’ve been having this problem from late December up until now. However, it’s not the first time.
Last year around this time I had the same issue with it and I had to buy a new keyboard, but even so, the issue persisted. As time went by it went away until now. I’m not sure if Apple is screwing with my computer ( I’m getting pop-ups telling me I should upgrade the OS ) or this issue is legitimately either a software or hardware issue. I would like to know what I’m experiencing so I can act decisively. Any help is appreciated thanks.