bcoin-org / bclient

Bcoin node and wallet clients
Other
11 stars 20 forks source link

send value is in BTC not satoshis (like curl): send value is multiplied x^8!!! #5

Closed pinheadmz closed 6 years ago

pinheadmz commented 6 years ago

Because of this line: https://github.com/bcoin-org/bclient/blob/master/bin/bwallet-cli#L278 ...for any send using bwallet-cli send the value is interpreted as WHOLE BTC and is exponentiated by ^8 to get a satoshis value, which is then sent to the actual wallet for composing a transaction.

This is VERY DIFFERENT from using curl: https://github.com/bcoin-org/bcoin/blob/c7d844ea3785c939cd546ce2fe7ff0e03f27197a/lib/wallet/http.js#L450 ...where the value is interpreted literally as satoshis. This is the same behavior when using the Javascript WalletClient from bclient

Currently the documentation does not distinguish between the two formats: http://localhost:4567/?shell--cli#send-a-transaction

So, when sending a value=1000 from cURL or from Javascript WalletClient, you will send 0.00001000 BTC. If you send the same value=1000 from bwallet-cli you will send 1,000 BTC (1000.00000000) !!

pinheadmz commented 6 years ago

Updating docs