Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetBlockTemplate no longer works #117

Closed
idt-byte opened this issue Jul 30, 2020 · 4 comments
Closed

GetBlockTemplate no longer works #117

idt-byte opened this issue Jul 30, 2020 · 4 comments

Comments

@idt-byte
Copy link

Hi there,
Since Bitcoin 0.13.1 (segwit), the getblocktemplate() method no longer returns anything.

I think this is due to the fact that you now need to specify a rule when calling getblocktemplate. For example, if you call:

bitcoin-cli getblocktemplate
You get this error:

error code: -8
error message:
Support for 'segwit' rule requires explicit client support

To get it working, you have to pass a rule like this as an extra argument, like so:

bitcoin-cli getblocktemplate '{"rules":["segwit"]}'

I'm trying with this:
CoinService.GetBlockTemplate("'{\"rules\":[\"segwit\"]}'")
but the result is:
"{\"result\":null,\"error\":{\"code\":-1,\"message\":\"JSON value is not an object as expected\"},\"id\":1}\n"
Is there any way to pass this argument to the CoinService.GetBlockTemplate() method to get it working again?

@moodmosaic
Copy link
Contributor

@idt-byte, thank you for reporting this 👍 I apologize for the delay, I hope @Sword-Smith can look into this (as per #116). Let’s give @Sword-Smith 3 days to respond.

@Sword-Smith
Copy link
Collaborator

Looking into it

@Sword-Smith
Copy link
Collaborator

Sword-Smith commented Aug 2, 2020

Hi there,
Since Bitcoin 0.13.1 (segwit), the getblocktemplate() method no longer returns anything.

I think this is due to the fact that you now need to specify a rule when calling getblocktemplate. For example, if you call:

bitcoin-cli getblocktemplate
You get this error:

error code: -8
error message:
Support for 'segwit' rule requires explicit client support

To get it working, you have to pass a rule like this as an extra argument, like so:

bitcoin-cli getblocktemplate '{"rules":["segwit"]}'

I'm trying with this:
CoinService.GetBlockTemplate("'{\"rules\":[\"segwit\"]}'")
but the result is:
"{\"result\":null,\"error\":{\"code\":-1,\"message\":\"JSON value is not an object as expected\"},\"id\":1}\n"
Is there any way to pass this argument to the CoinService.GetBlockTemplate() method to get it working again?

@idt-byte

Against my 0.19.1 Bitcoin Core node, this call works:

var blockTemplate = CoinService.GetBlockTemplate( new { rules=new List<string> { "segwit" } });

So by supplying the parameters as an anonymous type you should be able to get the call to work. If you think the interface should work differentely, let me know.

@Sword-Smith
Copy link
Collaborator

Closing this as it works and the interface in my opinion is OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants