Need that way which can give me new address and also it inserted in "Requested payments history
New address created with getnewaddress
RPC command will be visible in 'receiving addresses'. I have created 2 addresses from CLI with getnewaddress
.
Address created using 'Create new receiving address' button can have more information associated with it (date, message, amount etc.) which is saved in 'Requested payments history'. bcrt1qe4ryqy8lv59na0wkm6y96p8tu9njjlkme32szz
in 'receiving addresses' was created using this option.
Is it possible with PHP?
Yes you can create new address with PHP:
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'http://localhost:18333/wallet/P1',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{"jsonrpc": "1.0", "id": "curltest", "method": "getnewaddress", "params": []}',
CURLOPT_HTTPHEADER => array(
'Authorization: Basic dXNlcjpwYXNz',
'Content-Type: text/plain'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
RPC credentials used in above code:
regtest.rpcport=18333
rpcuser=user
rpcpassword=pass