使用Electrum JSON-RPC发送比特币

问题描述 投票:0回答:1

我正在尝试使用电子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;
     }
 }
php bitcoin json-rpc
1个回答
0
投票

jsonrpc要求id是一个递增数字,而不是curltext

© www.soinside.com 2019 - 2024. All rights reserved.