1

I am building a python app that depends on both monerod, and the JSON-RPC server for access to the (testnet) blockchain. In my testing environment, I had access to more than enough space to hold the testnet blockchain, however now that I am deploying to a VPS, I no longer have that luxury. I am willing to give in to potential security risks.

My question is, what arguments do I have to run monerod with to connect with a public testnet node (like testnet.community.xmr.to) instead of automatically downloading the 2gb+ blockchain?

jtgrassie
  • 19,601
  • 4
  • 17
  • 54
ars
  • 13
  • 2

1 Answers1

2

You seem to misunderstand. monerod doesn't operate on a remote blockchain (other than syncing of course). You can however use the wallet (or another app, such as a python script) with a remote (or local) node via its JSON-RPC interface. This is almost certainly all you need (i.e. it's highly unlikely your python script depends on a local monerod).

A python example using a remote node:

import requests
import json

payload = { 'jsonrpc':'2.0', 'id':'0', 'method':'get_block', 'params': { 'height': 101 } } rpc_url = 'http://testnet.community.xmr.to:28081/json_rpc' req = requests.post(rpc_url, json=payload) result = req.json().get('result') print(result)

An example using the same remote node with either the monero-wallet-rpc or monero-wallet-cli, simply launch the wallet with:

--daemon-address testnet.community.xmr.to:28081

All this said, it is possible to start monerod with the --no-sync flag which will allow you to run the daemon and not sync the blockchain, but note, calling any RPC method which depends on blockchain data will fail in this mode.

jtgrassie
  • 19,601
  • 4
  • 17
  • 54