New Born Care Gps

Bitcoin: How to load bitcoin wallet from any wallet in regtest mode

Loading Bitkainsky Koshka from any Portfeel in Regima Regtest

When you work with Bitcoins in a test medium, for example, regtest, non -residue with the problem to load the new Portfel. One of these problems is connected with the loading of Koshka in your or her wall. In this state, we disperse, how to load the bitcoin koshelek from any portfal in the regtest registst, using Bitcoinjs-Lib ‘library.

Prank Regtest

Regtest (Abbraviatuati of the Testnet) is an experimental dust medium, which allows you to verify their realization of the bitcoins, not vilia on the basis of the base. He works in the Lightning Network and introduces the coontrolyated medium for the testering of new functions, the doses or the walls.

Problem: Portfel, not loaded in registo

When you launch your Testnet server in Regima Regtest, he launches the scrap, if the portfel is not loaded from the “Regtest” repertoire. To solve this problem, we should change our script for downloading portfoli with Bitcoinjs-Lib ‘help libraries.

Loading Bitkainsky Koshka from any Portfeel in Regima Regtest

Here’s a swinging hand -breeding about Tom, how to load bitcoin -a shop from any portfal in the Regtest Registst:

  • Run the follow -up Commond to install her in the body:

`Bash

NPM -The -g Bitcoinjs -lib

'

  • Submit the new wall or change the correlated

    :

Act your script appointedregtest-wallet-leaader.js, make a new file with the following:

Javascript

Const Bitcoin = Require ('Bitcoinjs-Lib');

Const Skelletpath = 'Path / to / Your / Koshelek';

Const Regtestdir = processes. Regtest_dir || "./Regtest";

Constantwalletloader = (Walletpath) => {

IF (! Walletpath) is null;

Const Skellet = New Bitcoin.wallet (Walletpath);

IF (Wallet.isload ()) {

console.log (Portfel, loaded $ {waltpath});

Portpholio;

}

// Test download Portfel, Uspolse function "Regtest-Wallet-Chargeher" Regtest

To try {

Const Chardedwallet = RegtestwalletLedloader (Walletpath, Regtestdir);

IF (! Lovewallet) Start a new scoop ("Koshka");

console.log (Portfel, loaded $ {waltpath});

Returned into the information;

} Catch (error) {

Console.error (Oshbak);

Different; // or you can smooth the scrap and run out your script

}

};

Export module = Regtestwalletloader;

'

3.

Javascript

Const {regtest} = Require ('Regtest');

Consthetwalletloader = Require ('./ Regtest- Wallet-Cergerse');

Consttestserver = New Regtest ();

// ...

IF (Wallet.isload ()) {

// Download Portfel from any access to the way, enclosed Regtest on the Press.

Regtetwalletloader (Walletpath);

} second {

Console.error ("not loaded Portfel");

}

'

conclusion

Loading a bitcoin-brawl of any portfal in the regtest registst is possible with the use ofBitcoinjs-Lib. The following is this step, you can kill that your adjusts or the walls have access to the dwarf and to fill your planned functions without a scoop.

Do not forget to installBitcoinjs-lib` in the body, pre-Etot new walls. This is the booting of koshalkov from the signs of your server regtest.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top