Bitcoin Forum
April 24, 2024, 03:40:55 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: getblock method depreciated in 0.3.19?  (Read 3794 times)
nounderscores (OP)
Newbie
*
Offline Offline

Activity: 25
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
1713930055
Hero Member
*
Offline Offline

Posts: 1713930055

View Profile Personal Message (Offline)

Ignore
1713930055
Reply with quote  #2

1713930055
Report to moderator
1713930055
Hero Member
*
Offline Offline

Posts: 1713930055

View Profile Personal Message (Offline)

Ignore
1713930055
Reply with quote  #2

1713930055
Report to moderator
1713930055
Hero Member
*
Offline Offline

Posts: 1713930055

View Profile Personal Message (Offline)

Ignore
1713930055
Reply with quote  #2

1713930055
Report to moderator
The forum was founded in 2009 by Satoshi and Sirius. It replaced a SourceForge forum.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713930055
Hero Member
*
Offline Offline

Posts: 1713930055

View Profile Personal Message (Offline)

Ignore
1713930055
Reply with quote  #2

1713930055
Report to moderator
1713930055
Hero Member
*
Offline Offline

Posts: 1713930055

View Profile Personal Message (Offline)

Ignore
1713930055
Reply with quote  #2

1713930055
Report to moderator
theymos
Administrator
Legendary
*
Offline Offline

Activity: 5180
Merit: 12880


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

Activity: 25
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
*
Offline Offline

Activity: 5180
Merit: 12880


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

Activity: 25
Merit: 0


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

Thanks!
nounderscores (OP)
Newbie
*
Offline Offline

Activity: 25
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
*
Offline Offline

Activity: 5180
Merit: 12880


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:  

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