'How to run Cardano Wallet?

I have installed cardano-wallet using this documentation. Everything is OK, Just I don't know how to run it so I can have interaction with it via node js:

const { WalletServer } = require('cardano-wallet-js');

let walletServer = WalletServer.init('http://127.0.0.1:1337/v2');
async function test() {
  let information = await walletServer.getNetworkInformation();
  console.log(information);
}
test()

Does's anyone have an idea?



Solution 1:[1]

According to IOHK documentation, prior to running a server you have to run a node:

cardano-node run \                                   
    --topology ~/cardano/config/mainnet-topology.json \
    --database-path ~/cardano/db/ \
    --socket-path ~/cardano/db/node.socket \
    --host-addr 127.0.0.1 \                
    --port 1337 \
    --config ~/cardano/config/mainnet-config.json

And after that call a serve command with appropriate flags:

cardano-wallet serve \                            
    --port 8090 \
    --mainnet \
    --database ~/cardano/wallets/db \
    --node-socket $CARDANO_NODE_SOCKET_PATH

If you need more details, read my medium post.

Solution 2:[2]

you have to run cardano node in order query blockchain. follow this article https://developers.cardano.org/docs/get-started/cardano-wallet-js

you have to first download this file docker-compose.yml

wget https://raw.githubusercontent.com/input-output-hk/cardano-wallet/master/docker-compose.yml 

then run your node either testnet or mainnet by this command

NETWORK=testnet docker-compose up

then you can able to connect with blockchain ref - https://github.com/tango-crypto/cardano-wallet-js

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Andy Jazz
Solution 2 aniket gholap