'127.0.0.1', 'port' => 28081]) // Passing parameters in as array; parameters can be in any order and all are optional. $getblockcount = $daemonRPC->getblockcount(); $on_getblockhash = $daemonRPC->on_getblockhash(42069); // $getblocktemplate = $daemonRPC->getblocktemplate('9sZABNdyWspcpsCPma1eUD5yM3efTHfsiCx3qB8RDYH9UFST4aj34s5Ygz69zxh8vEBCCqgxEZxBAEC4pyGkN4JEPmUWrxn', 60); // $submitblock = $daemonRPC->submitblock($block_blob); $getlastblockheader = $daemonRPC->getlastblockheader(); // $getblockheaderbyhash = $daemonRPC->getblockheaderbyhash('fc7ba2a76071f609e39517dc0388a77f3e27cc2f98c8e933918121b729ee6f27'); // $getblockheaderbyheight = $daemonRPC->getblockheaderbyheight(696969); // $getblock_by_hash = $daemonRPC->getblock_by_hash('fc7ba2a76071f609e39517dc0388a77f3e27cc2f98c8e933918121b729ee6f27'); // $getblock_by_height = $daemonRPC->getblock_by_height(696969); /*$get_connections = $daemonRPC->get_connections();*/ $get_info = $daemonRPC->get_info(); // $hardfork_info = $daemonRPC->hardfork_info(); // $setbans = $daemonRPC->setbans('8.8.8.8'); // $getbans = $daemonRPC->getbans(); require_once('src/walletRPC.php'); $walletRPC = new walletRPC('127.0.0.1', 18083, false); // Change to match your wallet (monero-wallet-rpc) IP address and port; 18083 is the customary port for mainnet, 28083 for testnet, 38083 for stagenet // $daemonRPC = new walletRPC(['host' => '127.0.0.1', 'port' => 28081]) // Passing parameters in as array; parameters can be in any order and all are optional. /*$create_wallet = $walletRPC->create_wallet('monero_wallet', ''); // Creates a new wallet named monero_wallet with no passphrase. Comment this line and edit the next line to use your own wallet*/ /*$open_wallet = $walletRPC->open_wallet('monero_wallet', '');*/ /*$get_address = $walletRPC->get_address();*/ /*$get_accounts = $walletRPC->get_accounts();*/ /*$get_balance = $walletRPC->get_balance();*/ // $create_address = $walletRPC->create_address(0, 'This is an example subaddress label'); // Create a subaddress on account 0 // $tag_accounts = $walletRPC->tag_accounts([0], 'This is an example account tag'); // $get_height = $walletRPC->get_height(); // $transfer = $walletRPC->transfer(1, '9sZABNdyWspcpsCPma1eUD5yM3efTHfsiCx3qB8RDYH9UFST4aj34s5Ygz69zxh8vEBCCqgxEZxBAEC4pyGkN4JEPmUWrxn'); // First account generated from mnemonic 'gang dying lipstick wonders howls begun uptight humid thirsty irony adept umpire dusted update grunt water iceberg timber aloof fudge rift clue umpire venomous thirsty' // $transfer = $walletRPC->transfer(['address' => '9sZABNdyWspcpsCPma1eUD5yM3efTHfsiCx3qB8RDYH9UFST4aj34s5Ygz69zxh8vEBCCqgxEZxBAEC4pyGkN4JEPmUWrxn', 'amount' => 1, 'priority' => 1]); // Passing parameters in as array // $transfer = $walletRPC->transfer(['destinations' => ['amount' => 1, 'address' => '9sZABNdyWspcpsCPma1eUD5yM3efTHfsiCx3qB8RDYH9UFST4aj34s5Ygz69zxh8vEBCCqgxEZxBAEC4pyGkN4JEPmUWrxn', 'amount' => 2, 'address' => 'BhASuWq4HcBL1KAwt4wMBDhkpwseFe6pNaq5DWQnMwjBaFL8isMZzcEfcF7x6Vqgz9EBY66g5UBrueRFLCESojoaHaTPsjh'], 'priority' => 1]); // Multiple payments in one transaction // $sweep_all = $walletRPC->sweep_all('9sZABNdyWspcpsCPma1eUD5yM3efTHfsiCx3qB8RDYH9UFST4aj34s5Ygz69zxh8vEBCCqgxEZxBAEC4pyGkN4JEPmUWrxn'); // $sweep_all = $walletRPC->sweep_all(['address' => '9sZABNdyWspcpsCPma1eUD5yM3efTHfsiCx3qB8RDYH9UFST4aj34s5Ygz69zxh8vEBCCqgxEZxBAEC4pyGkN4JEPmUWrxn', 'priority' => 1]); // $get_transfers = $walletRPC->get_transfers('in', true); // $incoming_transfers = $walletRPC->incoming_transfers('all'); // $mnemonic = $walletRPC->mnemonic(); ?>

MoneroPHP

MoneroPHP was developed by SerHack and the Monero-Integrations team! Please report any issues or request additional features at github.com/monero-integrations/monerophp.

daemonRPC.php example

Note: not all methods shown, nor all results from each method.

getblockcount()

Status:

Height:

on_getblockhash(42069)

Block hash:

getlastblockheader()

Current block hash:

Previous block hash:

get_connections()

Connections:

' . $peer['address'] . ' (' . ( $peer['height'] == $getblockcount['count'] ? 'synced' : ( $peer['height'] > $getblockcount['count'] ? 'ahead; syncing' : 'behind; syncing') ). ')

'; } ?>
get_info()

Difficulty:

Cumulative difficulty:

walletRPC.php example

Note: not all methods shown, nor all results from each method.

get_accounts()

Accounts:

Account ' . $account['account_index'] . ': ' . $account['base_address'] . '
'; echo 'Balance: ' . $account['balance'] / pow(10, 12) . ' (' . $account['unlocked_balance'] / pow(10, 12) . ' unlocked)
'; echo ( $account['label'] ) ? 'Label: ' . $account['label'] . '
' : ''; echo ( $account['tag'] ) ? 'Tag: ' . $account['tag'] . '
' : ''; echo '

'; } ?>
get_balance()

Balance:

Unlocked balance: