doc: add instructions for generating RPC docs #20987

pull ben-kaufman wants to merge 1 commits into bitcoin:master from ben-kaufman:rpc-docs-gen-rp changing 1 files +12 −0
  1. ben-kaufman commented at 10:38 AM on January 22, 2021: contributor

    Added instructions on how to generate the up to date RPC docs for the bitcoincore.org website in the relevant release-process subsection.

  2. fanquake added the label Docs on Jan 22, 2021
  3. ben-kaufman force-pushed on Jan 22, 2021
  4. ben-kaufman force-pushed on Jan 22, 2021
  5. laanwj commented at 4:03 PM on January 22, 2021: member

    Thanks for adding this, untested ACK!

  6. theStack commented at 4:20 PM on January 22, 2021: member

    Concept ACK, will test that later; nit: is there a minimum go version needed that is worth mentioning?

  7. in doc/release-process.md:333 in 1b77a9d09d outdated
     325 | @@ -326,6 +326,18 @@ bitcoin.org (see below for bitcoin.org update instructions).
     326 |  
     327 |    - bitcoincore.org RPC documentation update
     328 |  
     329 | +      - Install [golang](https://golang.org/doc/install)
     330 | +
     331 | +      - Install the new Bitcoin Core release
     332 | +
     333 | +      - Run bitcoind on regtest
    


    theStack commented at 4:46 PM on January 22, 2021:

    If I start bitcoind on regtest via bitcoind -regtest -daemon and start the generation script as described, I get:

    $ go run generate.go 
    2021/01/22 17:38:37 Cannot run bitcoin-cli: exit status 1, is bitcoind running?
    exit status 1
    

    Looking at the script, it doesn't seem to invoke bitcoin-cli with a specified network, therefore assuming mainnet.

    Therefore either the script should be changed to really connect to regtest, or changing this to mainnet here :)

          - Run bitcoind on mainnet
    

    ben-kaufman commented at 5:02 PM on January 22, 2021:

    I just tried and it seems to work with both mainnet and regtest, but the script itself says regtest should be specified: https://github.com/bitcoin-core/bitcoincore.org/blob/06666b83558cdd795f08969c553e722b20867cf0/contrib/doc-gen/generate.go#L5

    Also, @harding said that should be regtest too, maybe he could say if that's actually needed?


    ben-kaufman commented at 5:12 PM on January 22, 2021:

    Looking through the script I don't see a reason why the network should matter, although I might be missing something. But if you think I don't I could just remove this part of specifying network.


    laanwj commented at 5:35 PM on January 22, 2021:

    Tested on a fresh Ubuntu Focal (20.04) VM:

    This worked:

    sudo install git golang wget
    wget https://bitcoincore.org/bin/bitcoin-core-0.21.0/bitcoin-0.21.0-x86_64-linux-gnu.tar.gz
    tar -zxf bitcoin-0.21.0-x86_64-linux-gnu.tar.gz
    export PATH="$PWD/bitcoin-0.21.0/bin:$PATH"
    bitcoind  -noconnect -nolisten -daemon
    git clone https://github.com/bitcoin-core/bitcoincore.org.git
    cd bitcoincore.org/contrib/doc-gen
    go run generate.go
    

    Note:

    • It will look for bitcoin-cli in the PATH, so the bin/ directory from the release needs to be added to that.
    • It does not pass -regtest, so it will connect to the mainnet RPC. There seems to be no way to override this without patching the script.

    ben-kaufman commented at 5:55 PM on January 22, 2021:

    Ok, so for now I have changed it to say mainnet as suggested. In the script itself, do you think it would make more sense to update the comment, or make the script use regtest? https://github.com/bitcoin-core/bitcoincore.org/blob/06666b83558cdd795f08969c553e722b20867cf0/contrib/doc-gen/generate.go#L5


    MarcoFalke commented at 6:00 PM on January 22, 2021:

    I believe for the script you can specify the network in the ~/.bitcoin/bitcoin.conf file if you really need to. Only default file location works, obviously.


    harding commented at 6:01 PM on January 22, 2021:

    When I use the script, I do:

    vi ~/.bitcoin/bitcoin.conf
    dG  # delete everything in the file
    regtest=1  # default to regtest
    :w   # write the file
    ^Z  # suspend the editor
    bitcoind -daemon
    go run generate.go
    bitcoin-cli stop
    fg  # bring the editor back
    uu  # undo edits
    :wq  # write file and exit

    (Yikes, writing all that out makes it sound harder than it is.) Obviously it'd be better to hardcode regtest in the generate.go script. I actually tried that once but, not knowing any go, failed at the way that seemed obvious to me and gave up immediately.

    I think the reason to use regtest is that it and testnet used to have some (non-hidden) RPCs that mainnet didn't (e.g., I seem to recall that generate was removed from mainnet prior to the introduction of generatetoaddress). That's currently not the case AFAICT.


    theStack commented at 6:13 PM on January 22, 2021:

    If the generated docs are really the same, I'd prefer regtest, to not waste bandwidth and hd space due to IBD starting (especially if one forgets to exit bitcoind after generation). A docker container could also be helpful here, to avoid potential conflict with another bitcoind that is already running. This way we also wouldn't need to install go or change the host machine's state in any other way. That's outside of this PR's scope though.


    ben-kaufman commented at 6:13 PM on January 22, 2021:

    Thanks. So I think now it should be fine to just have it say mainnet instead as was suggested here?


    laanwj commented at 9:36 PM on January 22, 2021:

    f the generated docs are really the same, I'd prefer regtest, to not waste bandwidth and hd space due to IBD starting

    I agree. This is why I pass -noconnect -nolisten above, I think this prevents any IBD from starting.

    Thanks. So I think now it should be fine to just have it say mainnet instead as was suggested here?

    Yes, would say so. Unless the script is changed to use -regtest before this is merged, I guess. I don't personally know enough about golang to do that.


    ben-kaufman commented at 7:59 AM on January 23, 2021:

    Ok, I think this PR can wait for https://github.com/bitcoin-core/bitcoincore.org/pull/751 to be merged first, then change back here to mention it should run on regtest.


    ben-kaufman commented at 5:21 PM on January 25, 2021:

    I think now with https://github.com/bitcoin-core/bitcoincore.org/pull/751 merged this comment can be resolved. I've returned it to the original text here of specifying regtest.

  8. theStack changes_requested
  9. laanwj commented at 4:48 PM on January 22, 2021: member

    It would be kinda nice if someone ported this script to Python so that we don't have to install go to do the release process. But that's obviously not a requirement in this PR :slightly_smiling_face:

  10. MarcoFalke commented at 4:53 PM on January 22, 2021: member

    I am reworking how the static docs are generated (some time after #20012), so that might be a good excuse to also rewrite the translator script from go to python or maybe even remove the need for it completely.

  11. ben-kaufman force-pushed on Jan 22, 2021
  12. harding commented at 6:06 PM on January 22, 2021: contributor

    @MarcoFalke FYI, the website generator (Jekyll) natively supports reading data files written in JSON or YAML, so if the RPC docs can be output in either of those formats, it would make integrating with the website easy.

  13. doc: add instructions for generating RPC docs
    Added instructions on how to generate the up to date RPC docs for the bitcoincore.org website in the relevant release-process subsection.
    e147af7624
  14. ben-kaufman force-pushed on Jan 24, 2021
  15. laanwj referenced this in commit d209bcbd05 on Jan 25, 2021
  16. theStack approved
  17. theStack commented at 6:59 PM on January 25, 2021: member

    ACK e147af762404b1f9b26c1ef3e709fd101517fa2c ⚙️ (now that https://github.com/bitcoin-core/bitcoincore.org/pull/751 is merged)

  18. laanwj merged this on Jan 25, 2021
  19. laanwj closed this on Jan 25, 2021

  20. ben-kaufman deleted the branch on Jan 25, 2021
  21. sidhujag referenced this in commit aea229d44a on Jan 25, 2021
  22. DrahtBot locked this on Aug 16, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-22 15:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me