PSA: SegWit changes the format of data returned by JSON-RPC API, thus making it backward-incompatible (

As far as I know, all soft-forks so far were backwards-compatible, i.e. a piece of software working with JSON-RPC API doesn’t need to be upgraded when a soft-fork is activated. For example, OP_CHECKLOCKTIMEVERIFY will interpreted by old software as OP_NOP2, which is harmless. But SegWit is different in this respect because it changes data formats. For example, suppose you use getblock API to get raw block contents and parse it using bitcore-lib to extract some useful information of new…


Format of mkey field in encrypted wallet.dat file

I am writing a C++ application to scour large files (typically disk images) for wallet.dat files, with the intention of recovering the private keys.

At the moment I am struggling the data contained in the ‘mkey’ (Master Key) section of an encrypted wallet.dat file.

From Googling and pouring over the source code for Bitcoin and various other utilities that do what I want to do (such as pywallet) I have deduced the that data layout of mkey data is:

mkey – a size prefixed string denoting the start of the master key data.

nID – an integer whose purpose I have been unable to determine.

encrypted_key – a size prefixed buffer containing the encrypted master key.

salt – a size prefixed buffer containing the salt data used when encrypting the key.

derivation_method – an integer containing either 0 or 1 for the method used to encrypt the master key using the wallet password.

derivation_rounds – an integer containing the number of rounds used to encrypt the master key.


However, having examined my wallet.dat file with a hex editor (screenshot attached) I cannot seem to get the data it contains to correlate with the above.

enter image description here

Can someone point me in the right direction or tell me what I have missed.

Recent Questions – Bitcoin Stack Exchange

How can I create a raw transaction in hex format with Bitcoinj?

How can I create a raw transaction when I’m given the input scripts, input indexes, input txids, output script, output address and output amount? The method below works but it requires the method Transaction setHash to be public which it is not. Can I get what I want without having to make any changes to Bitcoinj?

    NetworkParameters params = MainNetParams.get();     Transaction tx = new Transaction(params);     tx.addOutput(Coin.ZERO, new Script(HEX.decode(outputScript)));     try {         Address addr = new Address(params, toAddress);         tx.addOutput(Coin.valueOf(toAmount), addr);     } catch (AddressFormatException name) {         return null;     }      Script script = new Script(HEX.decode(inputScript));     Address addr = new Address(params, script.getPubKeyHash());      Transaction parentTx = new Transaction(params);     for (int j = 0; j < inputIndex; j++) {         parentTx.addOutput(new TransactionOutput(params, parentTx, Coin.ZERO, addr));     }     parentTx.addOutput(new TransactionOutput(params, parentTx, Coin.ZERO, addr));     parentTx.setHash(Sha256Hash.wrap(txid)); // requires setHash method to be public     try {         ECKey key = new DumpedPrivateKey(params, privateKey).getKey();         tx.addSignedInput(parentTx.getOutput(inputIndex), key);     } catch (AddressFormatException name) {         return null;     }     return HEX.encode(tx.bitcoinSerialize()); 

Recent Questions – Bitcoin Stack Exchange