Closed Mudkip closed 11 years ago
± python bloocoin.py 18:44:37
The BlooCoin Official Client version 0.01
BlooCoin$ coins
You have 130 coins
BlooCoin$ addr
Your address is: 57ea52793598778a71fb6a64fe51c2ef31ecc17d
BlooCoin$ send 1 519b0351274a01ee6ae07d72638720ac69a1b93d
Transaction Successful!
BlooCoin$ transactions
From: b51786c75d1fbc6584daebdecd6de89d3351904a
From: 3322b38c8651665a4fd74fa02f0f3f43fc12f960
From: 519b0351274a01ee6ae07d72638720ac69a1b93d
To: 519b0351274a01ee6ae07d72638720ac
To: 519b0351274a01ee6ae07d72638720ac69a1b93d
To: 519b0351274a01ee6ae07d72638720ac69a1b93d
To: 519b0351274a01ee6ae07d72638720ac69a1b93d
To: 519b0351274a01ee6ae07d72638720ac69a1b93d
To: 519b0351274a01ee6ae07d72638720ac69a1b93d
BlooCoin$ coins
You have 129 coins
I don't know what's going on for you, but I'm able to send coins successfully.
I used the official client as well, can't send :\
Well if I'm not having troubles, I don't know why you are. Are you certain that you've got enough coins?
C:\Users\Mudkip\Desktop\bloocoin-client-master>python bloocoin.py The BlooCoin Official Client version 0.01 BlooCoin$ coins You have 9 coins
The updated client is now at bloocoin/bloocoin-client, rather than bloocoin/bloocoin, for whatever reasons Max had.
I see, you guys changed the json submit format... Don't see why though.
Nevermind, still unable to send for whatever reasons from other clients.
Sending coins (the command from client -> server
) is still the same.
{"cmd": "send_coin", "to": _, "amount": _, "addr": _, "pwd": _}
The reply is standardized JSON with a success boolean and a payload, but even if your client just printed whatever the reply was, it would still work.
What other clients are you using, are they updated? Do they say it's failed? IIRC, the old system simply sent True
or False
back as a reply, and most clients would check if reply.strip() == "True"
for verification, and since the new payload != True
, they'll state a failure.
I am using my own web-client which is currently in developent. I am simply returning any error that your server returns. Sending exact same json request as the official client.
$json = array("cmd"=>"send_coin", "to"=>"$to", "addr"=>"$adr", "pwd"=>"$key", "amount"=>"$amount"); $strlen = strlen(json_encode($json)); $array = json_decode(senddata($json, $strlen),1); if($array['success'] == "true"){ return 1; } else { return $array['message']; }
Alright, here's where you're going wrong:
You're checking if($array['success'] == "true")
, note again, "true"
.
json_decode()
will return objects, and JSON null -> NULL, true -> PHP true, etc etc. This means you're checking for a literal true
string, which the server does not reply with.
Simply checking if($array['success'])
should be sufficient.
That's not the point, it wouldn't return anything if there was no error message, right? But is is returning "You do not have enough coins"
Edit: removed the check to true, no result.
Then for whatever reason, the server thinks you don't have enough coins. What do you want me to say, if it says there aren't enough coins, there aren't enough coins in its database.
Send those same details to a my_coins request, and see what it says under amount. If you do that and get > whatever you're trying to send now, I'll be mildly concerned. As it stands now, I haven't had trouble, so I really have no clue what the hell is up. Sorry, brah.
Sent:
{"cmd":"my_coins","addr":"519b0351274a01ee6ae07d72638720ac69a1b93d","pwd":"XXXX"}
Recieved:
{"message": null, "payload": {"amount": 9}, "success": true}
Don't see anything wrong with my code.
Oh sweet jesus, that is mildly concerning.
Try out the new updated client (located at bloocoin-client), and do coins
, send 1 <addr>
then coins
again. If for whatever reason that screws up, I'll have to do some serious scouting, or we'll have to call in @Max00355, the bloocoins database overlord.
In the strange event it does work, your site code might be mangled.
The new client DOES work, the old client however, does not work (it sends the same json request as the old one, don't see why it doesn't work), same as my website code. It worked perfectly until the json update.
I've got no idea why the old client wouldn't work either, but if it doesn't then... it doesn't for some reason. I'll have a dig around later, see what I can discover, but from where I'm looking, it shouldn't be a problem.
Something changed, and we don't know about it. Obviously if only one client is working it is an issue.
Confirming that I get the same result from my Java miner. Retrieving the amount of coins works fine, but sending them does not. I have tried sending them to myself and to the address in the comment above. Both attempts return "{"message": "You don't have enough coins", "payload": null, "success": false}".
Thank you for confirming, Mohatu.
It works. The issue was that the server now accepts the amount value as an integer instead of a string.
Solved: JSON Format changed. Amount must be an integer.
Oh, come to think of it:
When I updated the old code, I noticed a lot of the JSON things were run through the base literals (e.g. strings run through str()
and integers run through int()
) rather than just letting JSON decoding work stuff out.
The old code must have done an int(data['amount'])
rather than directly using the amount.
My bad, I'll document the protocols tonight so stuff like this doesn't become a common occurrence.
With the new update, sending coins is currently impossible with a return of You don't have enough coins.
Here is my send json request:
{"cmd":"send_coin","amount":"1","to":"57ea52793598778a71fb6a64fe51c2ef31ecc17d","addr":"519b0351274a01ee6ae07d72638720ac69a1b93d","pwd":"snip"}
Here is what I receive back, knowing that my BLC amount is 5:
{"message": "You don't have enough coins", "payload": null, "success": false}
Need a fix.