我创建了一个事务,使用以下代码:
var Tx = require('ethereumjs-tx')
var rawTx = {
nonce: '0x100004',
gasPrice: '0x4a817c800', //0.00000002
gasLimit: '0x15f90', //90000
from: '0x1911c081b0a2359d77d1f858bf5b5b04a080f2bb',
to: '0x5f56bba9ee673d0c7bccf4be1a78b9db3a51114d',
value: '0x2386f26fc10000', // 0.01
data: '0x'
}
var tx = new Tx(rawTx)
tx.sign(privateKey)
var serializedTx = tx.serialize()
var signData = serializedTx.toString('hex');
console.log(signData)
输出tx数据
f86f831000048504a817c80083015f90945f56bba9ee673d0c7bccf4be1a78b9db3a51114d872386f26fc10000801ba08aacd5525b240df3149ead81c2fd4bf3d2c01cc81506a5442f727f92850c4935a07807e5a74e1994a4fce6727fa9422e34d5da83411a8065c14249e9b5845cac3e
然后在http://testnet.etherscan.io/pushTx
上广播原始交易显示以下消息
{ "jsonrpc": "2.0", "id": 1, "result": "0x15b9ff6eca21cfe48e853458908abf53ccae131a9aeb4eb03d553281c77c1f89" }
```
但是,我打开http://testnet.etherscan.io/tx/0x15b9ff6eca21cfe48e853458908abf53ccae131a9aeb4eb03d553281c77c1f89,它可以找到,为什么?
另外,我尝试使用--testnet
在geth控制台中调用sendRawTransactioneth.getTransaction(eth.sendRawTransaction('f86f831000048504a817c80083015f90945f56bba9ee673d0c7bccf4be1a78b9db3a51114d872386f26fc10000801ba08aacd5525b240df3149ead81c2fd4bf3d2c01cc81506a5442f727f92850c4935a07807e5a74e1994a4fce6727fa9422e34d5da83411a8065c14249e9b5845cac3e'))
返回
后的信息{
blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000
",
blockNumber: null,
from: "0x1911c081b0a2359d77d1f858bf5b5b04a080f2bb",
gas: 90000,
gasPrice: 20000000000,
hash: "0x15b9ff6eca21cfe48e853458908abf53ccae131a9aeb4eb03d553281c77c1f89",
input: "0x",
nonce: 1048580,
to: "0x5f56bba9ee673d0c7bccf4be1a78b9db3a51114d",
transactionIndex: null,
value: 10000000000000000
}
测试网络中的所有操作,数据似乎都是正确的,但没有效果,我错过了什么?