0

I tried the following commands, but none of them worked.

-getblocktemplate "segwit"
-Error: Error parsing JSON: segwit

-getblocktemplate ("segwit")
-Error: Error parsing JSON: segwit

-getblocktemplate "rules": ["segwit"]
-Error: Error parsing JSON: rules:

-getblocktemplate {"rules": ["segwit"]}
-Error: Error parsing JSON: {rules:

-getblocktemplate
-getblocktemplate must be called with the segwit rule set (call with {"rules": ["segwit"]}) (code -8)

-getblocktemplate {"rules": ["segwit"]}
-Error: Error parsing JSON: {rules:

How can I use this command correctly?

1 Answer 1

1

The GUI's debug console operates similarly to a shell. It needs quotes around the entire JSON string so that it is first interpreted as a string before the JSON is parsed. Then, if you used double quotes, you need to escape the quotes that are part of the JSON so that they aren't misinterpreted.

A valid way of writing this command is

getblocktemplate "{\"rules\":[\"segwit\"]}"

Alternatively, to avoid additional escaping, you can use single quotes on the outside:

getblocktemplate '{"rules":["segwit"]}'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.