Infura の API を使用して署名済みトランザクションをブロードキャスト (JavaScript)
Infura の API を使用して、Ethereum のトランザクションをブロードキャストする方法です。 code:example.js
const request = require('request')
// 署名済みトランザクション
let signedTx = '0xf86b068504a817c800825208942890228d4478e2c3b0ebf5a38479e3396c1d6074872386f26fc100008029a081877ef6923286da161b99208035b7d86ff6f7b96279cf42fd98c63a6bd3be44a0552b534b423c172479f77d65593f633e5170d4626207e451ed5fe0a34a811945'
var headers = {
'Content-Type':'application/json'
}
var body = {
"jsonrpc":"2.0",
"method":"eth_sendRawTransaction",
"id":1
}
var options = {
method: 'POST',
headers: headers,
json: true,
body: body
}
request(options, function (error, response, body) {
console.log('tx hash:', body.result)
})