Title: Bitcoin RPC send error code -3 - Invalid Amount Post by: icreator on July 03, 2018, 09:04:19 PM ?? Why I see this error code -3 ??
PYTHON code: Code: print 'res = cc.sendtoaddress(addr, amo - txfee)', amo - txfee first run >>> Quote balance 0.25229647 try send: 0.14307412BTC to 3QgwCppatHV847dA4BYv538aZq8xz6uWuv res = cc.sendtoaddress(addr, amo - txfee) 0.14297412 SENDed? {u'id': 1, u'result': None, u'error': {u'message': u'Invalid amount for send', u'code': -3}} second run >>> Quote balance 0.25229647 try send: 0.14307412BTC 3QgwCppatHV847dA4BYv538aZq8xz6uWuv res = cc.sendtoaddress(addr, amo - txfee) 0.14297412 SENDed? 032e3710d5ac263ddb8bc9f9e295b086c00af8997f7f7ad3af8beca99287f85f PAYed xcurr - res: {'payment_id': u'032e3710d5ac263ddb8bc9f9e295b086c00af8997f7f7ad3af8beca99287f85f', 'status': 'success'} why?? balances not changed... Title: Re: Bitcoin RPC send error code -3 - Invalid Amount Post by: achow101 on July 04, 2018, 12:08:12 AM The error has nothing to do with the wallet.
Error code -3 means that there was a type error. With the error message "invalid amount for send", the amount that was specified was less than or equal to 0. This means that your code probably has a bug in it where amo is too small. Title: Re: Bitcoin RPC send error code -3 - Invalid Amount Post by: RGBKey on July 04, 2018, 12:35:07 AM Are you sending the amounts in Satoshis, instead of in floating points? I'm unfamiliar with the interface that you're using but that would be the first thing I check.
Title: Re: Bitcoin RPC send error code -3 - Invalid Amount Post by: icreator on July 05, 2018, 11:21:38 AM The error has nothing to do with the wallet. Error code -3 means that there was a type error. With the error message "invalid amount for send", the amount that was specified was less than or equal to 0. This means that your code probably has a bug in it where amo is too small. no, amount in float is > 0 but some times when bitcoin rate move up or down and amount to send is updating and transaction was created successfully why? It only was on 0.15 version of core wallet Title: Re: Bitcoin RPC send error code -3 - Invalid Amount Post by: bob123 on July 05, 2018, 07:48:06 PM As achow101 already mentioned, it most probably is a bug in your code.
Mind sharing the relevant parts? We can't spot your bug without anything to look at. but some times when bitcoin rate move up or down and amount to send is updating and transaction was created successfully Could you explain this ? Why does the bitcoin rate (BTC/USD price ?) influence your ability to create transactions ? And what libary are you using? python-bitcoinrpc (https://github.com/jgarzik/python-bitcoinrpc (https://github.com/jgarzik/python-bitcoinrpc)) ? Title: Re: Bitcoin RPC send error code -3 - Invalid Amount Post by: achow101 on July 05, 2018, 07:52:40 PM no, amount in float is > 0 That error code and string occur in only 4 places in the code, with each one protected by an if branch checking whether the amount given is <= 0. If you are getting this error, then your amount is being interpreted as being <= 0, regardless of what you intended it to be.Title: Re: Bitcoin RPC send error code -3 - Invalid Amount Post by: bob123 on July 05, 2018, 08:00:25 PM no, amount in float is > 0 That error code and string occur in only 4 places in the code, with each one protected by an if branch checking whether the amount given is <= 0. If you are getting this error, then your amount is being interpreted as being <= 0, regardless of what you intended it to be.I don't think it is because the value is <= 0. According to OP, there is a value > 0 (at least thats what it looks like according to the output to the screen): print 'res = cc.sendtoaddress(addr, amo - txfee)', amo - txfee res = cc.sendtoaddress(addr, amo - txfee) 0.14297412 I assume it is a type error. Thats what status code -3 should be for: Quote RPC_TYPE_ERROR = -3, //!< Unexpected type was passed as parameter from: https://github.com/bitcoin/bitcoin/blob/v0.15.0.1/src/rpc/protocol.h#L50 (https://github.com/bitcoin/bitcoin/blob/v0.15.0.1/src/rpc/protocol.h#L50)Title: Re: Bitcoin RPC send error code -3 - Invalid Amount Post by: achow101 on July 05, 2018, 10:04:47 PM no, amount in float is > 0 That error code and string occur in only 4 places in the code, with each one protected by an if branch checking whether the amount given is <= 0. If you are getting this error, then your amount is being interpreted as being <= 0, regardless of what you intended it to be.According to OP, there is a value > 0 (at least thats what it looks like according to the output to the screen): print 'res = cc.sendtoaddress(addr, amo - txfee)', amo - txfee I assume it is a type error. Thats what status code -3 should be for:res = cc.sendtoaddress(addr, amo - txfee) 0.14297412 Quote RPC_TYPE_ERROR = -3, //!< Unexpected type was passed as parameter from: https://github.com/bitcoin/bitcoin/blob/v0.15.0.1/src/rpc/protocol.h#L50 (https://github.com/bitcoin/bitcoin/blob/v0.15.0.1/src/rpc/protocol.h#L50)Title: Re: Bitcoin RPC send error code -3 - Invalid Amount Post by: icreator on July 06, 2018, 08:00:29 PM ?? Why I see this error code -3 ?? PYTHON code: Code: print 'res = cc.sendtoaddress(addr, amo - txfee)', amo - txfee first run >>> Quote balance 0.25229647 try send: 0.14307412BTC to 3QgwCppatHV847dA4BYv538aZq8xz6uWuv res = cc.sendtoaddress(addr, amo - txfee) 0.14297412 SENDed? {u'id': 1, u'result': None, u'error': {u'message': u'Invalid amount for send', u'code': -3}} second run >>> Quote balance 0.25229647 try send: 0.14307412BTC 3QgwCppatHV847dA4BYv538aZq8xz6uWuv res = cc.sendtoaddress(addr, amo - txfee) 0.14297412 SENDed? 032e3710d5ac263ddb8bc9f9e295b086c00af8997f7f7ad3af8beca99287f85f PAYed xcurr - res: {'payment_id': u'032e3710d5ac263ddb8bc9f9e295b086c00af8997f7f7ad3af8beca99287f85f', 'status': 'success'} why?? balances not changed... as You see I print value of "amo - txfee" = 0.14297412 - and in first case it is INVALID but in another case the same value of "amo - txfee" = 0.14297412 - is GOOD and this error I got only when update core wallet to 0.15 version (( may be in 0.16 It will be fixed? Title: Re: Bitcoin RPC send error code -3 - Invalid Amount Post by: achow101 on July 06, 2018, 09:58:32 PM as You see I print value of "amo - txfee" = 0.14297412 - and in first case it is INVALID Can you print out the values for amo and txfee too?but in another case the same value of "amo - txfee" = 0.14297412 - is GOOD and this error I got only when update core wallet to 0.15 version (( No, it will not be fixed because 0.16 has the same error messages guarded by the same conditions.may be in 0.16 It will be fixed? If you have an http packet inspection tool, you can intercept the packets being sent to your node and see what the actual JSON for the command is being sent. That will give you more information too about the error as you can see what was actually sent by your code. |