Author

Topic: Chain Query [Alpha] - A web based interface to the Bitcoin API JSON-RPC (Read 1232 times)

copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.
I just tried to add the verifymessage of your site to my guide[1]. Since brainwallet is no longer operational and coinig[2] seems to be bugged when trying to verify message that have a linebreak. However your site seems to be affected by the same bug. I tried to verify the following two messages that verify just fine with bitcoin core 0.11. The first however does not verify. I added the return message directly below the message used.
Code:
-----BEGIN BITCOIN SIGNED MESSAGE-----
a line followed by a linebreak
this is shorena from bitcointalk.org, today is 2015.08.09 and this is a test for chainquery.com
-----BEGIN SIGNATURE-----
18uTXyQubfaYrkbQDdaXhzd2ALEY5YN77B
IG5WyElz95PZmiW47KV12iQd5Xnu4SkrkxJTkdaaqa0vav4tdDCTg1kVyqJ58inkDMrdoDCLAkKi4cwTAhGZmQ0=
-----END BITCOIN SIGNED MESSAGE-----


Thanks again for the bug report, this was challenging as we want Chain Query to be platform independent when released (we are getting very close)...

That means that not only do we have to support various platforms and browsers submitting the form, but also various platforms that bitcoind may be run on to process it.

Typically this is not a huge deal, but as we are verifying a signed message, the message must match the signature exactly or the result will be false.

There is really no standardization around end of line characters:

Code:
\n is a linux/unix line break
\r is a classic mac line break [OS X uses the above unix \n]
\r\n is a windows line break

And that does not take into account how various browsers handle the post data.

Surprisingly in PHP we were able to put together a rather elegant and efficient solution for OS independent end of line characters (after lots of trial and error):

Pseudo code:
Code:
$newLineChars = array("\r\n","\r","\n");
$fixedMessage = str_replace($newLineChars, PHP_EOL, $message);

The array of various new line characters looks for any variation of the newline and replaces it with the PHP_EOL constant in the signed $message.

PHP_EOL is a constant holding the line break character(s) used by the platform the app and bitcoind are running on.

This has been tested with your signed message (including the line break) browsing from OSx with Firefox, Chrome and Safari both in my dev environment, OSx, and on the beta server, Ubuntu 14.04, both with Bitcoin core 0.11.0.

It should also work just fine on your windows machine (fingers crossed)...

Again, thanks for the report and for considering Chain Query for your tutorial.

Thanks for the fast solution, messages verify just fine on Win7 and Win8.1. I will add the site over the next days.
legendary
Activity: 1258
Merit: 1027
I just tried to add the verifymessage of your site to my guide[1]. Since brainwallet is no longer operational and coinig[2] seems to be bugged when trying to verify message that have a linebreak. However your site seems to be affected by the same bug. I tried to verify the following two messages that verify just fine with bitcoin core 0.11. The first however does not verify. I added the return message directly below the message used.
Code:
-----BEGIN BITCOIN SIGNED MESSAGE-----
a line followed by a linebreak
this is shorena from bitcointalk.org, today is 2015.08.09 and this is a test for chainquery.com
-----BEGIN SIGNATURE-----
18uTXyQubfaYrkbQDdaXhzd2ALEY5YN77B
IG5WyElz95PZmiW47KV12iQd5Xnu4SkrkxJTkdaaqa0vav4tdDCTg1kVyqJ58inkDMrdoDCLAkKi4cwTAhGZmQ0=
-----END BITCOIN SIGNED MESSAGE-----


Thanks again for the bug report, this was challenging as we want Chain Query to be platform independent when released (we are getting very close)...

That means that not only do we have to support various platforms and browsers submitting the form, but also various platforms that bitcoind may be run on to process it.

Typically this is not a huge deal, but as we are verifying a signed message, the message must match the signature exactly or the result will be false.

There is really no standardization around end of line characters:

Code:
\n is a linux/unix line break
\r is a classic mac line break [OS X uses the above unix \n]
\r\n is a windows line break

And that does not take into account how various browsers handle the post data.

Surprisingly in PHP we were able to put together a rather elegant and efficient solution for OS independent end of line characters (after lots of trial and error):

Pseudo code:
Code:
$newLineChars = array("\r\n","\r","\n");
$fixedMessage = str_replace($newLineChars, PHP_EOL, $message);

The array of various new line characters looks for any variation of the newline and replaces it with the PHP_EOL constant in the signed $message.

PHP_EOL is a constant holding the line break character(s) used by the platform the app and bitcoind are running on.

This has been tested with your signed message (including the line break) browsing from OSx with Firefox, Chrome and Safari both in my dev environment, OSx, and on the beta server, Ubuntu 14.04, both with Bitcoin core 0.11.0.

It should also work just fine on your windows machine (fingers crossed)...

Again, thanks for the report and for considering Chain Query for your tutorial.


legendary
Activity: 1258
Merit: 1027
-snip-
Interesting, I'll look into it on Monday, what OS are you running bitcoin core on? I'll have to dig into how core handles hard returns on various OS's and have the app mimic that.

Thanks. Its Win7, but I can set it up on other systems if that helps you. Win 8.1 Pro and Ubuntu 14.04.2 would be the easiest as I already have VMs for those.



It may just be how HTTP post handles hard returns, I'll post back tomorrow after I've have a chance to dig around a little.
copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.
-snip-
Interesting, I'll look into it on Monday, what OS are you running bitcoin core on? I'll have to dig into how core handles hard returns on various OS's and have the app mimic that.

Thanks. Its Win7, but I can set it up on other systems if that helps you. Win 8.1 Pro and Ubuntu 14.04.2 would be the easiest as I already have VMs for those.

legendary
Activity: 1258
Merit: 1027

Just added the verifymessage endpoint at http://chainquery.com/bitcoin-api/verifymessage

Up to this point all the other endpoints only accept HTTP GET variables, verifymessage is the first requiring POST, and will only accept POST because of the base64 signatures' special characters.

I also wrote up a quick tutorial on what I feel is an often overlooked and powerful feature built in to just about any bitcoin client worth it's salt, message signing and verification.

Check it out here: https://www.reddit.com/r/Bitcoin/comments/3ctrx1/bitcoin_is_wonderful_verifying_a_bitcoin_signed/


I just tried to add the verifymessage of your site to my guide[1]. Since brainwallet is no longer operational and coinig[2] seems to be bugged when trying to verify message that have a linebreak. However your site seems to be affected by the same bug. I tried to verify the following two messages that verify just fine with bitcoin core 0.11. The first however does not verify. I added the return message directly below the message used.

Code:
-----BEGIN BITCOIN SIGNED MESSAGE-----
a line followed by a linebreak
this is shorena from bitcointalk.org, today is 2015.08.09 and this is a test for chainquery.com
-----BEGIN SIGNATURE-----
18uTXyQubfaYrkbQDdaXhzd2ALEY5YN77B
IG5WyElz95PZmiW47KV12iQd5Xnu4SkrkxJTkdaaqa0vav4tdDCTg1kVyqJ58inkDMrdoDCLAkKi4cwTAhGZmQ0=
-----END BITCOIN SIGNED MESSAGE-----
Code:
{
"result": false,
"error": null,
"id": null
}

Code:
-----BEGIN BITCOIN SIGNED MESSAGE-----
this is shorena from bitcointalk.org, today is 2015.08.09 and this is a another test for chainquery.com
-----BEGIN SIGNATURE-----
18uTXyQubfaYrkbQDdaXhzd2ALEY5YN77B
ID1SO2KVw8Tv6XowUkrtdQRhuB+sQVyi7jb549ZfZzpMMJ+9rRGx4ZvYyVgXsGPJe6Ds/3B5yYR70jtpJfLJ/gg=
-----END BITCOIN SIGNED MESSAGE-----
Code:
{
"result": true,
"error": null,
"id": null
}

[1] https://bitcointalksearch.org/topic/how-to-sign-a-message-990345
[2] https://bitcointalksearch.org/topic/m.12097780

Interesting, I'll look into it on Monday, what OS are you running bitcoin core on? I'll have to dig into how core handles hard returns on various OS's and have the app mimic that.
copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.

Just added the verifymessage endpoint at http://chainquery.com/bitcoin-api/verifymessage

Up to this point all the other endpoints only accept HTTP GET variables, verifymessage is the first requiring POST, and will only accept POST because of the base64 signatures' special characters.

I also wrote up a quick tutorial on what I feel is an often overlooked and powerful feature built in to just about any bitcoin client worth it's salt, message signing and verification.

Check it out here: https://www.reddit.com/r/Bitcoin/comments/3ctrx1/bitcoin_is_wonderful_verifying_a_bitcoin_signed/


I just tried to add the verifymessage of your site to my guide[1]. Since brainwallet is no longer operational and coinig[2] seems to be bugged when trying to verify message that have a linebreak. However your site seems to be affected by the same bug. I tried to verify the following two messages that verify just fine with bitcoin core 0.11. The first however does not verify. I added the return message directly below the message used.

Code:
-----BEGIN BITCOIN SIGNED MESSAGE-----
a line followed by a linebreak
this is shorena from bitcointalk.org, today is 2015.08.09 and this is a test for chainquery.com
-----BEGIN SIGNATURE-----
18uTXyQubfaYrkbQDdaXhzd2ALEY5YN77B
IG5WyElz95PZmiW47KV12iQd5Xnu4SkrkxJTkdaaqa0vav4tdDCTg1kVyqJ58inkDMrdoDCLAkKi4cwTAhGZmQ0=
-----END BITCOIN SIGNED MESSAGE-----
Code:
{
"result": false,
"error": null,
"id": null
}

Code:
-----BEGIN BITCOIN SIGNED MESSAGE-----
this is shorena from bitcointalk.org, today is 2015.08.09 and this is a another test for chainquery.com
-----BEGIN SIGNATURE-----
18uTXyQubfaYrkbQDdaXhzd2ALEY5YN77B
ID1SO2KVw8Tv6XowUkrtdQRhuB+sQVyi7jb549ZfZzpMMJ+9rRGx4ZvYyVgXsGPJe6Ds/3B5yYR70jtpJfLJ/gg=
-----END BITCOIN SIGNED MESSAGE-----
Code:
{
"result": true,
"error": null,
"id": null
}

[1] https://bitcointalksearch.org/topic/how-to-sign-a-message-990345
[2] https://bitcointalksearch.org/topic/m.12097780
legendary
Activity: 1258
Merit: 1027

Just added the verifymessage endpoint at http://chainquery.com/bitcoin-api/verifymessage

Up to this point all the other endpoints only accept HTTP GET variables, verifymessage is the first requiring POST, and will only accept POST because of the base64 signatures' special characters.

I also wrote up a quick tutorial on what I feel is an often overlooked and powerful feature built in to just about any bitcoin client worth it's salt, message signing and verification.

Check it out here: https://www.reddit.com/r/Bitcoin/comments/3ctrx1/bitcoin_is_wonderful_verifying_a_bitcoin_signed/
legendary
Activity: 1258
Merit: 1027
New services are always welcome and yours seems a job pretty well done... But what could be the case uses for such a service? I think websites would probably need the wallet component of the Bitcoin Core client and not other API commands as much...

Agreed, actually most of the wallet functions are done and when the test-net version is live you will be able to play with them on the site.

Also, this:
Built for the average Joe to explore Bitcoin's core API and to serve as the foundation for PHP web applications to easily communicate with bitcoin core.

The API does handle sanitizing and validating all inputs, but as far as running the wallet functions on main-net: securing the API is currently not in the scope of the project, and a developer would need to create their own login system and security rules to keep it locked down.

legendary
Activity: 1512
Merit: 1012
New services are always welcome and yours seems a job pretty well done... But what could be the case uses for such a service? I think websites would probably need the wallet component of the Bitcoin Core client and not other API commands as much...
Why pay some developer to write the interactions with your wallet, when you can just grab an open source library that already does it? Smiley

Yes... I guess that's right Smiley
legendary
Activity: 1344
Merit: 1024
Mine at Jonny's Pool
New services are always welcome and yours seems a job pretty well done... But what could be the case uses for such a service? I think websites would probably need the wallet component of the Bitcoin Core client and not other API commands as much...
The use case would be to have a nicely packaged API library that you can just drop into your site without having to write it from scratch.  Why pay some developer to write the interactions with your wallet, when you can just grab an open source library that already does it? Smiley
legendary
Activity: 1512
Merit: 1012
New services are always welcome and yours seems a job pretty well done... But what could be the case uses for such a service? I think websites would probably need the wallet component of the Bitcoin Core client and not other API commands as much...
legendary
Activity: 1344
Merit: 1024
Mine at Jonny's Pool
I expected quite a large set of the initial blocks to be empty - after all, a tiny subset of people even knew what Bitcoin was.  However, the thing that really grates on me is how many empty blocks there are when there are most certainly transactions waiting to be included and confirmed.  For example, we've been having our fun little stress tests recently, yet AntPool has continued to mine empty blocks.  At one point I noticed nearly 20k transactions, but AntPool happily submitted a block with not a single one of them.  Oh well... separate debate for another thread Smiley
legendary
Activity: 1258
Merit: 1027
Nice job windpath!  I actually started my own Java project very similar to this... I wrote some code to do some data mining on empty blocks (see my thread here: https://bitcointalksearch.org/topic/empty-blocks-1085800).  Mostly I wrote the code for fun, but realized that I could expand it to provide a nice object-oriented view into the core APIs.  That expansion has been started, but is nowhere near completed at this point, and I haven't put anything up on github yet.  I know there are a number of available libraries already out there (like BitcoinJ), but being who I am, I wanted to figure things out on my own Smiley.

I'm looking forward to your progress with this project.

Thanks JB!

Getting intimate with the API was certainly a motivation of mine as well Smiley

Edit: That's some great data you have there, did not expect the empty block count to be nearly that high, great work!
legendary
Activity: 1258
Merit: 1027
Thanks folks!

Regarding adding more accurate descriptions, each command links to it's bitcoin.org documentation with the (?) icon, and where a command has available parameters a form is generated and shown with a description of the fields, for example: http://chainquery.com/bitcoin-api/getnetworkhashps

Once the raw JSON API is up I might break down the individual HTML result sets to make them more user friendly, the priority now is to get all the commands done and get it up on GitHub, this way maybe some others will join in and help Smiley

legendary
Activity: 1344
Merit: 1024
Mine at Jonny's Pool
Nice job windpath!  I actually started my own Java project very similar to this... I wrote some code to do some data mining on empty blocks (see my thread here: https://bitcointalksearch.org/topic/empty-blocks-1085800).  Mostly I wrote the code for fun, but realized that I could expand it to provide a nice object-oriented view into the core APIs.  That expansion has been started, but is nowhere near completed at this point, and I haven't put anything up on github yet.  I know there are a number of available libraries already out there (like BitcoinJ), but being who I am, I wanted to figure things out on my own Smiley.

I'm looking forward to your progress with this project.
legendary
Activity: 1401
Merit: 1008
northern exposure
ohh looks pretty cool and seems to work pretty faster, i just try your online version, but i will try to downlod it and try by myselft ( when you release it ofc ).

is a relly good job man, ty for release it, im waiting for the GitHub link Wink
legendary
Activity: 1386
Merit: 1000
English <-> Portuguese translations
I played around your site a bit, and it's pretty nice to test things since I don't have anymore the daemon on my PC.
legendary
Activity: 2424
Merit: 1148
Wow, I like it. Could come in very useful for a service me and a friend are looking at starting in the future. Great work
staff
Activity: 3458
Merit: 6793
Just writing some code
Seems good. I think you should have the outputs in a way to have everything broken down and apart instead of just returning the JSON object.

Also, maybe have each command in a drop down list and the user selects which command. Then the page has a description of the command and some text boxes to enter the parameters and such instead of having to enter the command as if it were the console. This would make it much more user friendly, especially to those who aren't familiar with using Bitcoin's console.

BTW, this belongs in project development.
legendary
Activity: 1258
Merit: 1027
Originally planned on holding off on releasing this until all the API commands were integrated, but with the recent large increase in transaction volume, an Alpha release with what is ready seemed appropriate.

In particular estimatefee and getmempoolinfo are now publicly available through your browser, along with 25 other API commands.

When all the Bitcoin Core 0.10.2 commands are complete the whole thing will be released on GitHub as open source.

So without further ado, http://ChainQuery.com/bitcoin-api

Currently supported commands:


Built for the average Joe to explore Bitcoin's core API and to serve as the foundation for PHP web applications to easily communicate with bitcoin core.

I hope you like it so far,  any questions or feedback are welcome and appreciated.
Jump to: