Portal
Search…
eth_sendSignedTransaction
Sends signed transaction, returning its hash
1
web3.eth.sendSignedTransaction(signedTransactionData [, callback])
Copied!

Parameters

    1.
    Signed transaction data in HEX format
    2.
    (optional) Optional callback, returns an error object as first parameter and the result as second

Returns

The callback will return the 32 bytes transaction hash.

Example

1
> web3.eth.accounts.signTransaction({
2
from : "0x063eBCD1dB02320814Acc0721e65f14b8755Ff41",
3
to : "0x69d8fa34508C43C8533a32ab278aDDDE2820556b",
4
value : web3.utils.toWei('0.1', 'ether'),
5
gas : web3.utils.toHex(21000),
6
gasPrice : web3.utils.toWei("1", "gwei"),
7
nonce : 19
8
},"e0855c1ec13690c826ee767be03937fa5bce1d621ca780d2ac487574bf8d74d2",function(err,raw){
9
if(!err){
10
web3.eth.sendSignedTransaction(raw.rawTransaction, function(error, result){
11
if(!error){
12
console.log(result)
13
}else{
14
console.log(error)
15
}
16
})
17
}else{
18
console.log(err)
19
}
20
});
21
> 0x52e5f6347bdbf6fe1d8acb07bb460ce31d82bb36e80acfdc8aca798e28415334
Copied!
Last modified 9mo ago
Copy link