Bitcoin Forum
May 05, 2024, 01:40:34 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: adding rpc call for getbalance [account] or listtraanactions [account]  (Read 484 times)
rikkejohn (OP)
Hero Member
*****
Offline Offline

Activity: 644
Merit: 500


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
1714916434
Hero Member
*
Offline Offline

Posts: 1714916434

View Profile Personal Message (Offline)

Ignore
1714916434
Reply with quote  #2

1714916434
Report to moderator
1714916434
Hero Member
*
Offline Offline

Posts: 1714916434

View Profile Personal Message (Offline)

Ignore
1714916434
Reply with quote  #2

1714916434
Report to moderator
1714916434
Hero Member
*
Offline Offline

Posts: 1714916434

View Profile Personal Message (Offline)

Ignore
1714916434
Reply with quote  #2

1714916434
Report to moderator
Even in the event that an attacker gains more than 50% of the network's computational power, only transactions sent by the attacker could be reversed or double-spent. The network would not be destroyed.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714916434
Hero Member
*
Offline Offline

Posts: 1714916434

View Profile Personal Message (Offline)

Ignore
1714916434
Reply with quote  #2

1714916434
Report to moderator
1714916434
Hero Member
*
Offline Offline

Posts: 1714916434

View Profile Personal Message (Offline)

Ignore
1714916434
Reply with quote  #2

1714916434
Report to moderator
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3388
Merit: 6581


Just writing some code


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 (OP)
Hero Member
*****
Offline Offline

Activity: 644
Merit: 500


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:  

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