Bitcoin Forum
November 08, 2024, 12:11:05 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Chain Query [Alpha] - A web based interface to the Bitcoin API JSON-RPC  (Read 1229 times)
windpath (OP)
Legendary
*
Offline Offline

Activity: 1258
Merit: 1027


View Profile WWW
July 09, 2015, 02:04:13 AM
Last edit: July 10, 2015, 07:06:45 PM by windpath
 #1

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.
achow101
Staff
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
July 09, 2015, 02:12:32 AM
 #2

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.

batesresearch
Legendary
*
Offline Offline

Activity: 2424
Merit: 1148


View Profile WWW
July 09, 2015, 10:49:21 AM
 #3

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

Visit Satoshi's Place, a Bitcoin Hub based in Bury, Manchester, UK.
Website: https://satoshisplace.co.uk
Goals: Educate & Onboard users in to Bitcoin. Lightning network⚡️
DarkHyudrA
Legendary
*
Offline Offline

Activity: 1386
Merit: 1000


English <-> Portuguese translations


View Profile
July 09, 2015, 11:03:34 AM
 #4

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.

English <-> Brazilian Portuguese translations
okae
Legendary
*
Offline Offline

Activity: 1401
Merit: 1008


northern exposure


View Profile WWW
July 09, 2015, 11:11:19 AM
 #5

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

IMHO #1.b of suspects, Hal Finney is/was S.N.
jonnybravo0311
Legendary
*
Offline Offline

Activity: 1344
Merit: 1024


Mine at Jonny's Pool


View Profile WWW
July 09, 2015, 03:19:43 PM
 #6

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://bitcointalk.org/index.php?topic=1085800.0).  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.

Jonny's Pool - Mine with us and help us grow!  Support a pool that supports Bitcoin, not a hardware manufacturer's pockets!  No SPV cheats.  No empty blocks.
windpath (OP)
Legendary
*
Offline Offline

Activity: 1258
Merit: 1027


View Profile WWW
July 09, 2015, 03:22:54 PM
 #7

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

windpath (OP)
Legendary
*
Offline Offline

Activity: 1258
Merit: 1027


View Profile WWW
July 09, 2015, 03:24:10 PM
 #8

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://bitcointalk.org/index.php?topic=1085800.0).  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!
jonnybravo0311
Legendary
*
Offline Offline

Activity: 1344
Merit: 1024


Mine at Jonny's Pool


View Profile WWW
July 09, 2015, 03:38:14 PM
 #9

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

Jonny's Pool - Mine with us and help us grow!  Support a pool that supports Bitcoin, not a hardware manufacturer's pockets!  No SPV cheats.  No empty blocks.
unamis76
Legendary
*
Offline Offline

Activity: 1512
Merit: 1012


View Profile
July 09, 2015, 03:40:10 PM
 #10

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...
jonnybravo0311
Legendary
*
Offline Offline

Activity: 1344
Merit: 1024


Mine at Jonny's Pool


View Profile WWW
July 09, 2015, 03:46:35 PM
 #11

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

Jonny's Pool - Mine with us and help us grow!  Support a pool that supports Bitcoin, not a hardware manufacturer's pockets!  No SPV cheats.  No empty blocks.
unamis76
Legendary
*
Offline Offline

Activity: 1512
Merit: 1012


View Profile
July 09, 2015, 03:50:36 PM
 #12

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
windpath (OP)
Legendary
*
Offline Offline

Activity: 1258
Merit: 1027


View Profile WWW
July 09, 2015, 03:52:58 PM
 #13

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.

windpath (OP)
Legendary
*
Offline Offline

Activity: 1258
Merit: 1027


View Profile WWW
July 10, 2015, 07:11:57 PM
 #14


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/
shorena
Copper Member
Legendary
*
Offline Offline

Activity: 1498
Merit: 1540


No I dont escrow anymore.


View Profile
August 09, 2015, 08:12:42 PM
 #15


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://bitcointalk.org/index.php?topic=990345.0
[2] https://bitcointalk.org/index.php?topic=990345.msg12097780#msg12097780

Im not really here, its just your imagination.
windpath (OP)
Legendary
*
Offline Offline

Activity: 1258
Merit: 1027


View Profile WWW
August 09, 2015, 09:06:49 PM
 #16


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://bitcointalk.org/index.php?topic=990345.0
[2] https://bitcointalk.org/index.php?topic=990345.msg12097780#msg12097780

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.
shorena
Copper Member
Legendary
*
Offline Offline

Activity: 1498
Merit: 1540


No I dont escrow anymore.


View Profile
August 09, 2015, 09:26:31 PM
 #17

-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.


Im not really here, its just your imagination.
windpath (OP)
Legendary
*
Offline Offline

Activity: 1258
Merit: 1027


View Profile WWW
August 09, 2015, 09:29:48 PM
 #18

-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.
windpath (OP)
Legendary
*
Offline Offline

Activity: 1258
Merit: 1027


View Profile WWW
August 11, 2015, 12:49:55 AM
 #19

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.


shorena
Copper Member
Legendary
*
Offline Offline

Activity: 1498
Merit: 1540


No I dont escrow anymore.


View Profile
August 11, 2015, 07:11:53 PM
 #20

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.

Im not really here, its just your imagination.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!