Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only legacy wallets are supported by this command #332

Open
dbligh opened this issue Jun 6, 2024 · 1 comment
Open

Only legacy wallets are supported by this command #332

dbligh opened this issue Jun 6, 2024 · 1 comment

Comments

@dbligh
Copy link

dbligh commented Jun 6, 2024

Hi, I'm trying to follow the installation guide but hitting some issues on testnet executing npm run bitcoin using the ION generated wallet import string.

npm WARN lifecycle The node binary used for scripts is /snap/bin/node but npm is using /snap/node/7026/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> [email protected] bitcoin /home/administrator/ion
> node dist/src/bitcoin.js

Loading configuration from /etc/ion/testnet-bitcoin-config.json...
Loading ION bitcoin versioning config from /etc/ion/testnet-bitcoin-versioning.json...
Creating bitcoin wallet using the import string passed in.
Getting blockchain info...
Sending RPC request: {"method":"getblockchaininfo","jsonrpc":"1.0","id":"1k733bnfc6a"}
Sidetree bitcoin service configuration:
(node:2281) Warning: Accessing non-existent property 'MongoError' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
Bitcoin sync progress: block height 2820246, sync-ed: 2820246
Bitcoin Core fully synchronized
Sending RPC request: {"method":"createwallet","params":["sidetreeDefaultWallet"],"jsonrpc":"1.0","id":"4cf13vka5p9"}
Wallet with name sidetreeDefaultWallet already exists.
Sending RPC request: {"method":"loadwallet","params":["sidetreeDefaultWallet",true],"jsonrpc":"1.0","id":"7p5ld85moff"}
Wallet with name sidetreeDefaultWallet already loaded.
Checking if bitcoin wallet for mfYXNBtmxeVVYNxCBFMJN5EN7fqrQ9e3M5 exists
Sending RPC request: {"method":"getaddressinfo","params":["mfYXNBtmxeVVYNxCBFMJN5EN7fqrQ9e3M5"],"jsonrpc":"1.0","id":"ocomdkpgmc"}
Configuring Bitcoin Core to watch address mfYXNBtmxeVVYNxCBFMJN5EN7fqrQ9e3M5. Requires parsing transactions starting from genesis, will take a while...
Sending RPC request: {"method":"importpubkey","params":["02d9f597ebe2053c47a63537c2a77de1e4d581d344199415bade83167ad7f66cdf","sidetree",true],"jsonrpc":"1.0","id":"2enaolvorf8"}
Sidetree-Bitcoin node initialization failed with error: {"stack":"Error: Unexpected fetch HTTP response: [500]: {\"result\":null,\"error\":{\"code\":-4,\"message\":\"Only legacy wallets are supported by this command\"},\"id\":\"2enaolvorf8\"}\n\n    at BitcoinClient.<anonymous> (/home/administrator/ion/node_modules/@decentralized-identity/sidetree/dist/lib/bitcoin/BitcoinClient.js:859:27)\n    at Generator.next (<anonymous>)\n    at fulfilled (/home/administrator/ion/node_modules/@decentralized-identity/sidetree/dist/lib/bitcoin/BitcoinClient.js:5:58)\n    at processTicksAndRejections (internal/process/task_queues.js:95:5)","message":"Unexpected fetch HTTP response: [500]: {\"result\":null,\"error\":{\"code\":-4,\"message\":\"Only legacy wallets are supported by this command\"},\"id\":\"2enaolvorf8\"}\n","code":"bitcoin_client_fetch_unexpected_error"}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] bitcoin: `node dist/src/bitcoin.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] bitcoin script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/administrator/.npm/_logs/2024-06-06T10_14_06_386Z-debug.log

In trying to get this working I've started bitcoind to support legacy wallets using:

./bitcoind -conf=/home/administrator/bitcoin-27.0/bitcoin.conf -testnet -deprecatedrpc=create_bdb -daemon

And created a legacy wallet:

$ bitcoin-cli -testnet -conf=/home/administrator/bitcoin-27.0/bitcoin.conf -named createwallet wallet_name=ion_wallet_legacy passphrase=<passphrase> descriptors=false

Produces the following output:

{
  "name": "ion_wallet_legacy",
  "warnings": [
    "Wallet created successfully. The legacy wallet type is being deprecated and support for creating and opening legacy wallets will be removed in the future."
  ]
}

I'm now stuck trying to get the right value from here to put into bitcoinWalletOrImportString.

Any idea where I'm going wrong here?

@Shariat-dotnet
Copy link

Steps to Generate the WIF String in Bitcoin Core Terminal

  1. Generate an Address in the Created Legacy Wallet

    • Ensure that you have a legacy wallet configured in Bitcoin Core.
  2. Check Wallet Information
    Execute the following command to get wallet information:

    bitcoin-cli -chain=testnet -rpcuser=<your user name> -rpcpassword=<your rpc password> -rpcwallet=sidetreeDefaultWallet getwalletinfo
  3. Generate a New Legacy Address
    Run the following command to create a new legacy address:

    bitcoin-cli -chain=testnet -rpcuser=<your user name> -rpcpassword=<your rpc password> -rpcwallet=sidetreeDefaultWallet getnewaddress "" legacy
  4. Dump the Private Key
    Use the command below to retrieve the private key associated with the generated address:

    bitcoin-cli -chain=testnet -rpcuser=<your user name> -rpcpassword=<your rpc password> -rpcwallet=sidetreeDefaultWallet dumpprivkey <address>
  5. Convert to WIF Format (if needed)
    The private key retrieved in the previous step will already be in WIF format in most cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants