1

Subtitle: travis-ci fails to run generate JSON-RPC method on regtest

I'm trying to setup CI process on https://travis-ci.org platform to install bitcoind and start new blockchain using regtest mode.
I want to do this to run unit tests of my applications which uses wallet data. Methods against bitcoind are working fine except the generate method which is needed to mine some bitcoins in regtest private chain.

It looks like some bitcoind/travis-ci related issue.

  1. generate method is working fine in my local CI process (non-travis).
  2. Travis-CI is working fine if I comment the generate method call in CI tests.

generate method call when using travis-ci fails with the following error:

{"code":-32601,"message":"Method not found"}

bitcoin.conf:

server=1
regtest=1
gen=1
rpcuser=someuser
rpcpassword=somepass

.travis.yml:

language: r
sudo: required

before_script:
  - sudo apt-add-repository ppa:bitcoin/bitcoin -y
  - sudo apt-get update -qq
  - sudo apt-get install bitcoind -y

r_github_packages:
 - jangorecki/rbitcoind

after_script:
 - cat $(find . -maxdepth 1 -name "*.Rcheck" -type d)/tests/tests.Rout

Is there any trick in setup I should use to make travis-ci capable to run CI on regtest chain, including generate method?

Leaving the build links just for reference:
- generate method commented - CI passed: https://travis-ci.org/jangorecki/rpc.generate/builds/77207297
- use generate - CI failed: https://travis-ci.org/jangorecki/rpc.generate/builds/77208666

1 Answer 1

3

v0.11.0 and after:

Check and make sure that your daemon version is v0.11.0 or greater. If it is, the generate method should work.

Pre v0.11.0:

The setgenerate true method should be used.

In a standard network (such as testnet or main), setgenerate true will turn mining on indefinitely. In regtest, it just mines one block. You can also do

setgenerate(TRUE, 10)

To mine 10 regtest blocks. The second parameter is called the generation limit.

7
  • according to the generate method reference the method should be used especially in regtest mode to mine blocks instantly without the computing cost, and that feature is a must for a platform like travis-ci. If you are asking for generate() body see this. It just works on two CI environments: ubuntu and vm ubuntu.
    – jangorecki
    Aug 25, 2015 at 20:47
  • @jangorecki That must have been added in v0.11.0, I'm currently running v0.10.2. The release notes don't say that a generate method was added, though. What version of bitcoind are you running?
    – morsecoder
    Aug 25, 2015 at 20:57
  • OK, I see I have 0.10.2 on travis, this is the reason of no method found. I'm using same ppa so it should get the latest version of bitcoind, isn't it? you can put info about version to your answer so I will accept it. Thanks
    – jangorecki
    Aug 25, 2015 at 21:03
  • 1
    @jangorecki I guess the ppa is out of date. It's only one version out of date, at least. I have updated my answer to include version info.
    – morsecoder
    Aug 25, 2015 at 21:09
  • launchpad.net/~bitcoin/+archive/ubuntu/bitcoin did they stop builds for ubuntu 12.04?
    – jangorecki
    Aug 25, 2015 at 22:54

Your Answer

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

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