Skip to content

Instantly share code, notes, and snippets.

@walkjivefly
Last active June 9, 2021 15:10
Show Gist options
  • Save walkjivefly/879a5f0cc7801c4091142940c0e350a8 to your computer and use it in GitHub Desktop.
Save walkjivefly/879a5f0cc7801c4091142940c0e350a8 to your computer and use it in GitHub Desktop.
Sample XCloud plugin to return XXX blockchain info including (if available) size_on_disk
#! xxx_blockchaininfo is a plugin to return the XXX coin blockchain info
parameters=
fee=0
clientrequestlimit=1000
help=Return the XXX coin blockchain info
private::type=rpc
private::rpcip=127.0.0.1
private::rpcport=YOUR_XXX_RPCPORT_HERE
private::rpcuser=YOUR_XXX_RPCUSER_HERE
private::rpcpassword=YOUR_XXX_RPCPASSWORD_HERE
private::rpccommand=getblockchaininfo
#!private::rpcjsonversion=2.0
#!private::rpccontenttype=application/json
disabled=0
@walkjivefly
Copy link
Author

It's not as neat as an xrSizeOnDisk service but it doesn't need any fancy setup (eg: Docker) at the servicenode either.

  1. Copy xxx_blockchaininfo.conf to your datadir/plugins directory.
  2. Rename it for your target coin (eg: btc_blockchaininfo) and customise the fee, help and rpcip,rpcport,rpcuser,rpcpassword parms.
  3. Add an entry to your datadir/xrouter.conf like
    plugins=btc_blockchaininfo
    taking care to specify the same name from step 2 but without the .conf extension
  4. Reload the XRouter config by
    blocknet-cli xrReloadConfigs
  5. Tell the world about it!

They can access it by
blocknet-cli xrService btc_blockchaininfo
or find the size on disk by
blocknet-cli xrService btc_blockchaininfo | grep size_on_disk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment