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

factom-walletd does not work with usernames FD-683 #65

Open
carryforward opened this Issue Oct 22, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@carryforward
Contributor

carryforward commented Oct 22, 2018

I'm not sure what is the problem is, but I suspect that the call to wallet-balances is failing when factomd is setup with an RPC password. The wallet-balances call does not work when factomd has an RPC password.
https://docs.factom.com/api#wallet-balances

This is normal operation. Example is from the testnet:

> factomd -customnet=fct_community_test

>  factom-walletd

> curl -X POST --data-binary '{"jsonrpc": "2.0", "id": 0, "method": "wallet-balances"}' -H 'content-type:text/plain;' http://localhost:8089/v2

returns {"jsonrpc":"2.0","id":0,"result":{"fctaccountbalances":{"ack"...  This is correct.

When factomd is started with an RPC password, the wallet-balances call fails:

> factomd -customnet=fct_community_test -rpcpass pass1 -rpcuser user1

> factom-walletd -factomdpassword pass1 -factomduser user1

> curl -X POST --data-binary '{"jsonrpc": "2.0", "id": 0, "method": "wallet-balances"}' -H 'content-type:text/plain;' http://localhost:8089/v2

returns {"jsonrpc":"2.0","id":0,"error":{"code":-32602,"message":"Invalid params"}}

my guess is that the user strings aren't being set.
https://github.com/FactomProject/factom/blob/master/wallet/wsapi/wsapi.go#L310

not many wallet commands talk to the factomd, but getting the current EC rate I know does:
https://github.com/FactomProject/factom/blob/master/wallet/wsapi/wsapi.go#L1107

Editing the wallet can be tricky, as the code for it is held in the FactomProject/factom repo, but compiled in the factom-walletd folder. if you do a glide install on the wallet, but also edit the ~/go/src/github.com/FactomProject/factom folder, golang should use the non-vendor directory code. goland is a good ide with a debugger.

Pull requests can go against these branches:
https://github.com/FactomProject/factom-walletd/tree/FD-683_total_balance_http_auth_fail
https://github.com/FactomProject/factom/tree/FD-683_total_balance_http_auth_fail

@carryforward carryforward changed the title from factom-walletd does not work with FD-683 to factom-walletd does not work with usernames FD-683 Oct 22, 2018

@PaulBernier

This comment has been minimized.

PaulBernier commented Oct 23, 2018

Hi Brian,
I think you were right on spot for the root cause. After adding the header for basic auth to both calls to factomd the API call was returning correctly. PR: FactomProject/factom#82

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment