Skip to content

Latest commit

 

History

History
63 lines (49 loc) · 2.33 KB

File metadata and controls

63 lines (49 loc) · 2.33 KB

Using TOR

First start a TOR node and get its local proxy URI (outside the scope of monero-java).

Using TOR with monerod

Option 1

// create client connected to monerod with tor config
MoneroRpcConnection monerodConnection = new MoneroRpcConnection("http://kyaklhqp4yyza4fmtbvs6z4lrzr5cljxwa7o2d42sfelfhczsmbwzfad.onion:18081")
        .setCredentials("superuser", "abctesting123")
        .setProxyUri("<tor proxy uri>");
MoneroDaemonRpc monerod = new MoneroDaemonRpc(monerodConnection);

Option 2

// create client connected to monerod with tor address
MoneroDaemonRpc monerod = new MoneroDaemonRpc("http://kyaklhqp4yyza4fmtbvs6z4lrzr5cljxwa7o2d42sfelfhczsmbwzfad.onion:18081"); // can add username and password

// set tor's proxy uri
monerod.setProxyUri("<tor proxy uri>");

Using TOR with monero-wallet-rpc

// create client connected to your monero-wallet-rpc instance
MoneroWallet walletRpc = new MoneroWalletRpc("http://localhost:38084"); // can add username and password

// open or create a wallet
// ...

// set connection to monerod with tor config
MoneroRpcConnection monerodConnection = new MoneroRpcConnection("http://kyaklhqp4yyza4fmtbvs6z4lrzr5cljxwa7o2d42sfelfhczsmbwzfad.onion:18081")
        .setCredentials("superuser", "abctesting123")
        .setProxyUri("<tor proxy uri>");
walletRpc.setDaemonConnection(monerodConnection);

Using TOR with client-side wallet

// option 1: get or create full wallet with tor config
MoneroWallet walletFull = MoneroWalletFull.createWallet(new MoneroWalletConfig()
        .setPath("sample_wallet_full")
        .setPassword("supersecretpassword123")
        .setNetworkType(MoneroNetworkType.MAINNET)
        .setSeed("hefty value scenic...")
        .setRestoreHeight(573936l)
        .setServerUri("http://kyaklhqp4yyza4fmtbvs6z4lrzr5cljxwa7o2d42sfelfhczsmbwzfad.onion:18081")
        .setServerUsername("superuser")
        .setServerPassword("abctesting123")
        .setServerProxyUri("<tor proxy uri>"));

// option 2: set connection to monerod with tor config
MoneroRpcConnection monerodConnection = new MoneroRpcConnection("http://kyaklhqp4yyza4fmtbvs6z4lrzr5cljxwa7o2d42sfelfhczsmbwzfad.onion:18081")
        .setCredentials("superuser", "abctesting123")
        .setProxyUri("<tor proxy uri>");
walletFull.setDaemonConnection(monerodConnection);