我想通过API而不是从web3.js进行交易(发送以太币或令牌)
我尝试过etherscan,密码块
这是一个我想要发送交易代码的获取余额API代码
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.etherscan.io/api?module=account&action=balance&address=0xC1A71f1eFC01D77aA102A9CE248c5360C347Abc8&tag=latest&apikey=YourApiKeyToken",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_TIMEOUT => 30000,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
// Set Here Your Requesred Headers
'Content-Type: application/json',
),
));
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
答案 0 :(得分:0)
您需要做的是对以太坊节点进行RPC调用。基本上,web3库是围绕此的包装。
可以在这里找到文档:https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction