Bitcoin Forum
December 05, 2016, 06:43:56 PM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: getblock method depreciated in 0.3.19?  (Read 3517 times)
nounderscores
Newbie
*
Offline Offline

Activity: 23


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

If you liked my post, please send me a bitcoin!

BC: 1J4ous6vWH8bJJ9MRRG1k8Fb9JXZeUMqu3
1480963436
Hero Member
*
Offline Offline

Posts: 1480963436

View Profile Personal Message (Offline)

Ignore
1480963436
Reply with quote  #2

1480963436
Report to moderator
1480963436
Hero Member
*
Offline Offline

Posts: 1480963436

View Profile Personal Message (Offline)

Ignore
1480963436
Reply with quote  #2

1480963436
Report to moderator
1480963436
Hero Member
*
Offline Offline

Posts: 1480963436

View Profile Personal Message (Offline)

Ignore
1480963436
Reply with quote  #2

1480963436
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: 2492


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


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?

If you liked my post, please send me a bitcoin!

BC: 1J4ous6vWH8bJJ9MRRG1k8Fb9JXZeUMqu3
theymos
Administrator
Legendary
*
expert
Offline Offline

Activity: 2492


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


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

Thanks!

If you liked my post, please send me a bitcoin!

BC: 1J4ous6vWH8bJJ9MRRG1k8Fb9JXZeUMqu3
nounderscores
Newbie
*
Offline Offline

Activity: 23


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

If you liked my post, please send me a bitcoin!

BC: 1J4ous6vWH8bJJ9MRRG1k8Fb9JXZeUMqu3
theymos
Administrator
Legendary
*
expert
Offline Offline

Activity: 2492


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!