Bitcoin Forum
December 17, 2017, 05:10:30 AM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: adding rpc call for getbalance [account] or listtraanactions [account]  (Read 402 times)
rikkejohn
Hero Member
*****
Offline Offline

Activity: 644


View Profile
November 04, 2015, 02:06:57 AM
 #1

Frustrated by this, I have been trying to make an updated pretty version of block_crawler with the added beauty of "search by address"

I can see where to add code in block_explorer.php

echo "      <div class=\"menu_item\">\n";
      echo "         <span class=\"menu_desc\">Enter a Block Index / Height</span><br>\n";
      echo "         <form action=\"".$_SERVER["PHP_SELF"]."\" method=\"post\">\n";
      echo "            <input type=\"text\" name=\"block_height\" size=\"40\">\n";
      echo "            <input type=\"submit\" name=\"submit\" value=\"Jump To Block\">\n";
      echo "         </form>\n";
      echo "      </div>\n";
      echo "\n";
      echo "      <div class=\"menu_item\">\n";
      echo "         <span class=\"menu_desc\">Enter A Block Hash</span><br>\n";
      echo "         <form action=\"".$_SERVER["PHP_SELF"]."\" method=\"post\">\n";
      echo "            <input type=\"text\" name=\"block_hash\" size=\"40\">\n";
      echo "            <input type=\"submit\" name=\"submit\" value=\"Jump To Block\">\n";
      echo "         </form>\n";
      echo "      </div>\n";
      echo "\n";
      echo "      <div class=\"menu_item\">\n";
      echo "         <span class=\"menu_desc\">Enter A Transaction ID</span><br>\n";
      echo "         <form action=\"".$_SERVER["PHP_SELF"]."\" method=\"post\">\n";
      echo "            <input type=\"text\" name=\"transaction\" size=\"40\">\n";
      echo "               <input type=\"submit\" name=\"submit\" value=\"Jump To TX\">\n";
      echo "         </form>\n";
      echo "      </div>\n";
      echo "\n";
      echo "   </div>\n";
      echo "\n";
   }



It seems simply copy paste one of the 3 above, and alter it to a different rpc call (the rpc call does not work but visually it appears as if you could search by address).

echo "\n";
      echo "      <div class=\"menu_item\">\n";
      echo "         <span class=\"menu_desc\">Enter A Transaction ID Enter an Address</span><br>\n";
      echo "         <form action=\"".$_SERVER["PHP_SELF"]."\" method=\"post\">\n";
      echo "            <input type=\"text\" name=\"transaction\" size=\"40\">\n";
      echo "               <input type=\"submit\" name=\"submit\" value=\"Jump To TX\">\n";
      echo "         </form>\n";
      echo "      </div>\n";



Then of course remove the ban in bc_api.php, either or both of these I guess

//////////////////////////////////////////////////////////////////////////////////////////////////
//   These are security checks to ensure that no one uses the API
//   to request balance data or mess up the wallet.
   if ($request[0] == "getbalance")
   {
      bcapi_error (1, "Method Not Permitted: getbalance");
   }   
   
   if ($request[0] == "listaccounts")
   {
      bcapi_error (2, "Method Not Permitted: listaccounts");
   }   
   
   if ($request[0] == "listtransactions")
   {
      bcapi_error (3, "Method Not Permitted: listtransactions");
   }   

/////////////////////////////////////////////////////////////////////////////////////////////////


Then I am left with making right call on my new add-on in block_crawler.php

echo "\n";
      echo "      <div class=\"menu_item\">\n";
      echo "         <span class=\"menu_desc\">Enter A Transaction ID Enter an Address</span><br>\n";
      echo "         <form action=\"".$_SERVER["PHP_SELF"]."\" method=\"post\">\n";
      echo "            <input type=\"text\" name=\"transaction\" size=\"40\">\n";
      echo "               <input type=\"submit\" name=\"submit\" value=\"Jump To TX\">\n";
      echo "         </form>\n";
      echo "      </div>\n";


I guessed there would be a "getbalance" or "lisittransactions" in there but php is not my forte.

Then I thought maybe I needed a GET or just a REQUEST or something in there.

To some people this is easy, and I have scoured the web.

Anyone know where I am wrong?

Visually it is not tricky to make the old crawler look a bit nicer.

https://github.com/CallMeJake/BlockCrawler

1PkwpyTLo5TfagzCPgjdvQFNVzuEyHViGt
1513487430
Hero Member
*
Offline Offline

Posts: 1513487430

View Profile Personal Message (Offline)

Ignore
1513487430
Reply with quote  #2

1513487430
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1513487430
Hero Member
*
Offline Offline

Posts: 1513487430

View Profile Personal Message (Offline)

Ignore
1513487430
Reply with quote  #2

1513487430
Report to moderator
1513487430
Hero Member
*
Offline Offline

Posts: 1513487430

View Profile Personal Message (Offline)

Ignore
1513487430
Reply with quote  #2

1513487430
Report to moderator
1513487430
Hero Member
*
Offline Offline

Posts: 1513487430

View Profile Personal Message (Offline)

Ignore
1513487430
Reply with quote  #2

1513487430
Report to moderator
achow101
Moderator
Legendary
*
Offline Offline

Activity: 1246


17kKQppUsngUiByDsce4JXoZEjjpvX9bpR


View Profile WWW
November 04, 2015, 03:30:20 AM
 #2

my php isn't all that great, so I can't do everything for you. However, I can tell you what needs to be done.

you don't need to remove the ban in bc_api.php since that is for someone else calling your api, not internal doing it.

Where you have transaction crossed out, replace that with another name. At the top of block_explorer.php, copy the last else if block statement. Change the comment if you want for documentation. Change the string inside the brackets (Keep the quote marks) to the same name as you set earlier down below. Change what you want the header to say and change the next line so that the function has another name. Inside the brackets, change the string to match the name you set earlier.

In bc_layout.php, add another function with the same name that you set the function to. I can't really help you here, but you will need to include a variable to hold the string. Then set that variable to another function name which takes in as a parameter a variable set in the header of the function you are currently in in bc_layout.

In bc_daemon.php, add another function with the same name as the last function you added. Follow what the other functions do and use the comments there to help build your function which will request info from the bitcoind.

Sorry if this is hard to follow. I will try to help as best as I can.

rikkejohn
Hero Member
*****
Offline Offline

Activity: 644


View Profile
November 04, 2015, 02:19:38 PM
 #3

my php isn't all that great, so I can't do everything for you. However, I can tell you what needs to be done.

you don't need to remove the ban in bc_api.php since that is for someone else calling your api, not internal doing it.

Where you have transaction crossed out, replace that with another name. At the top of block_explorer.php, copy the last else if block statement. Change the comment if you want for documentation. Change the string inside the brackets (Keep the quote marks) to the same name as you set earlier down below. Change what you want the header to say and change the next line so that the function has another name. Inside the brackets, change the string to match the name you set earlier.

In bc_layout.php, add another function with the same name that you set the function to. I can't really help you here, but you will need to include a variable to hold the string. Then set that variable to another function name which takes in as a parameter a variable set in the header of the function you are currently in in bc_layout.

In bc_daemon.php, add another function with the same name as the last function you added. Follow what the other functions do and use the comments there to help build your function which will request info from the bitcoind.

Sorry if this is hard to follow. I will try to help as best as I can.

Cheers  for the answer, I will have a go at it. Fingers crossed X

1PkwpyTLo5TfagzCPgjdvQFNVzuEyHViGt
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!