Php 使用Electrum JSON-RPC发送比特币
我试图使用electrum jsonrpc发送比特币,但它一直显示“无效参数”错误 这就是我称之为payto方法的方式Php 使用Electrum JSON-RPC发送比特币,php,bitcoin,json-rpc,Php,Bitcoin,Json Rpc,我试图使用electrum jsonrpc发送比特币,但它一直显示“无效参数”错误 这就是我称之为payto方法的方式 public function payTo($dest, $amount, $source, $fee) { return $this->sendRequest('payto', ['destination' => $dest, 'amount' => $amount, 'fee' => $fee, 'from_addr' => $s
public function payTo($dest, $amount, $source, $fee)
{
return $this->sendRequest('payto', ['destination' => $dest, 'amount' => $amount, 'fee' => $fee, 'from_addr' => $source]);
}
public function sendRequest($method, $params = [])
{
$request = $this->client->request('POST', '/', [
'json' => [
'jsonrpc' => '2.0',
'method' => $method,
'params' => $params,
'id' => 'curltext'
],
'auth' => ['user', ''],
]);
$response = json_decode($request->getBody()->getContents());
if (isset($response->error)) {
throw new Exception($response->error->message);
} else {
return $response->result;
}
}
jsonrpc要求
id
是一个递增的数字,而不是curltext
更改为time()
,但它仍然不起作用。导致错误的参数是“from_addr”。