0

最近我将blockcypher api用于自定义项目,但我被困在发送交易动作中,这是我的代码

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://api.blockcypher.com/v1/eth/main/txs/new?token=TOKEN');
curl_setopt($ch,CURLOPT_POSTFIELDS,json_encode(array(
"inputs"=>array(array("addresses"=>array("add42af7dd58b27e1e6ca5c4fdc01214b52d382f"))),
"outputs"=>array(array("addresses"=>array("884bae20ee442a1d53a1d44b1067af42f896e541"),
"value" => 111
)),
)));
//curl_setopt($ch, CURLOPT_HTTPHEADER,array("x-api-key:".api_key_crypto,'Content-type:application/json'));

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$crypto_result = curl_exec($ch);
curl_close($ch);
$to_sign = json_decode($crypto_result)->tosign[0];
print_r($to_sign);

它给了我签名值,但是如何签名并将其转换为交易,官方工具在 golang 但如何在 PHP 中使用?

4

0 回答 0