Bitcoin Forum
October 15, 2018, 08:38:12 PM *
News: Make sure you are not using versions of Bitcoin Core other than 0.17.0 [Torrent], 0.16.3, 0.15.2, or 0.14.3. More info.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: getblock method depreciated in 0.3.19?  (Read 3681 times)
nounderscores
Newbie
*
Offline Offline

Activity: 23
Merit: 0


View Profile
February 22, 2011, 04:51:53 AM
 #1

Hi All,

I've been trying to use the getblockbycount api call to analyse the block chain

https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list

but I'm getting


$ bitcoind getblockbycount 109620
error: {"code":-32601,"message":"Method not found"}


any ideas why?

Cheers
nos
1539635892
Hero Member
*
Offline Offline

Posts: 1539635892

View Profile Personal Message (Offline)

Ignore
1539635892
Reply with quote  #2

1539635892
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
theymos
Administrator
Legendary
*
expert
Offline Offline

Activity: 3178
Merit: 3795


View Profile
February 22, 2011, 05:33:38 AM
 #2

getblockbycount has never existed in the official code. The wiki page is in error.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
nounderscores
Newbie
*
Offline Offline

Activity: 23
Merit: 0


View Profile
February 22, 2011, 07:38:24 AM
 #3

Ah thanks. getblock in 0.3.19 is also coming up with an error.

the -printblock flag seems to work, but I don't have my gui turned on on my server so I can't see the output.


$ bitcoind getblock
error: {"code":-32601,"message":"Method not found"}


$ bitcoin -printblock
Error: Unable to initialize GTK+, is DISPLAY set properly?


$ bitcoin getblock
error: {"code":-32601,"message":"Method not found"}


is there another way to do it?
theymos
Administrator
Legendary
*
expert
Offline Offline

Activity: 3178
Merit: 3795


View Profile
February 22, 2011, 08:00:21 AM
 #4

bitcoind -printblock prints to debug.log.

The getblockbycount patch is here:
http://yyz.us/bitcoin/patch.bitcoin-getblock

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
nounderscores
Newbie
*
Offline Offline

Activity: 23
Merit: 0


View Profile
February 22, 2011, 09:56:21 AM
 #5

Thanks!
nounderscores
Newbie
*
Offline Offline

Activity: 23
Merit: 0


View Profile
February 22, 2011, 10:28:10 AM
 #6

Hi Themyos,

I just cloned a fresh copy of the bitcoin development tree from github, and then tried to patch in the rpc.cpp getblock patch

I got two successful hunk applications and one fail

--- rpc.cpp
+++ rpc.cpp
@@ -1926,6 +2040,8 @@
         if (strMethod == "sendfrom"               && n > 2) ConvertTo<double>(params[2]);
         if (strMethod == "sendfrom"               && n > 3) ConvertTo<boost::int64_t>(params[3]);
         if (strMethod == "listtransactions"       && n > 1) ConvertTo<boost::int64_t>(params[1]);
+       if (strMethod == "getblock"               && n > 0) ConvertTo<boost::int64_t>(params[0]);
+       if (strMethod == "getblockbycount"        && n > 0) ConvertTo<boost::int64_t>(params[0]);

         // Execute
         Object reply = CallRPC(strMethod, params);

I tried patching 0.3.19 and got three fails.

Should I try patching 0.3.20? I'm downloading it now.

Cheers,
Jin
theymos
Administrator
Legendary
*
expert
Offline Offline

Activity: 3178
Merit: 3795


View Profile
February 22, 2011, 01:13:41 PM
 #7

Just find the location in the code and patch it manually. The ordering of lines in that section doesn't matter. Getblock (and other RPC patches) doesn't usually apply correctly, but it works on pretty much any version.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
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!