Grinnode-live / 2020-grin-bug-bash-challenge

Finding bugs in Grin-Wallet & Grin-nodes for a bounty prior to Grin fork v5.
3 stars 1 forks source link

[GRIN-Wallet][Owner API] testing list of accounts method #27

Closed marekyggdrasil closed 3 years ago

marekyggdrasil commented 3 years ago

Description Testing the accounts method from the Owner API

Prerequisites

  1. GRIN-Node
  2. GRIN-Wallet with some accounts setup

Test procedure

  1. Run GRIN-Wallet in Owner API listener mode
  2. Use node.js or python to run an encrypted request to accounts method

Expected result: Request returns a list of accounts stored in the wallet (i.e. mappings between user-specified labels and BIP32 derivation paths. Provide requests and response full payloads as well as wallet and node logs.

mojitoo commented 3 years ago

Prerequisites:

Step 1 (Runs the wallet's local web API)

grin-wallet owner_api
Password: 
20201220 07:55:46.473 WARN grin_wallet_controller::controller - Starting HTTP Foreign API on Owner server at 127.0.0.1:3420.
20201220 07:55:46.473 WARN grin_wallet_controller::controller - Starting HTTP Owner API server at 127.0.0.1:3420.
20201220 07:55:46.473 WARN grin_wallet_controller::controller - HTTP Owner listener started

HTTP Owner successfully started.

Step 2 (Run wallet_v3.py)

Before runnning the script, we need to make sure to edit the configuration.

change to your grin owner_api sercret file

api_sercet_file = '/Users/path/.grin/main/.owner_api_secret'

change to you wallet password

wallet_password = 'xxx'

and to add at the end : pp.pprint(wallet.accounts())

pyhton3 wallet_v3.py
[   {'label': 'default', 'path': '0200000000000000000000000000000000'},
    {'label': 'newaccount', 'path': '0200000001000000000000000000000000'}]

Request returns a list of accounts stored in the wallet (i.e. mappings between user-specified labels and BIP32 derivation paths. Provide requests and response full payloads as well as wallet and node logs.

grin-wallet.log

20201220 07:55:43.286 INFO grin_util::logger - log4rs is initialized, file level: Info, stdout level: Warn, min. level: Info
20201220 07:55:43.286 INFO grin_wallet - Using wallet configuration file at /Users/workstation/.grin/main/grin-wallet.toml
20201220 07:55:43.287 INFO grin_wallet - This is Grin Wallet version 4.0.0 (git v4.0.0), built for x86_64-apple-darwin by rustc 1.44.1 (c7087fe00 2020-06-17).
20201220 07:55:46.473 WARN grin_wallet_controller::controller - Starting HTTP Foreign API on Owner server at 127.0.0.1:3420.
20201220 07:55:46.473 WARN grin_wallet_controller::controller - Starting HTTP Owner API server at 127.0.0.1:3420.
20201220 07:55:46.473 WARN grin_wallet_controller::controller - HTTP Owner listener started.
marekyggdrasil commented 3 years ago

Awesome!

marekyggdrasil commented 3 years ago

@mojitoo I forgot to ask, can you please provide version of wallet that has the owner api listener on?

mojitoo commented 3 years ago