Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用Electrum JSON-RPC发送比特币_Php_Bitcoin_Json Rpc - Fatal编程技术网

Php 使用Electrum JSON-RPC发送比特币

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

我试图使用electrum jsonrpc发送比特币,但它一直显示“无效参数”错误

这就是我称之为payto方法的方式

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”。