dev模式交易无法打包
发布于 5 个月前 作者 yuni2017 618 次浏览 来自 以太坊

geth版本:1.8.3 使用dev模式启动一个节点

geth --datadir /opt/geth/data --dev console

然后执行一笔交易(合约部署交易)

eth.sendTransaction({from:eth.accounts[0],data:'0x608060405234801561001057600080fd5b5061019a806100206000396000f300608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634ed3885e14610046575b600080fd5b34801561005257600080fd5b506100ad600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506100af565b005b80600090805190602001906100c59291906100c9565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061010a57805160ff1916838001178555610138565b82800160010185558215610138579182015b8281111561013757825182559160200191906001019061011c565b5b5090506101459190610149565b5090565b61016b91905b8082111561016757600081600090555060010161014f565b5090565b905600a165627a7a7230582083446f3a793003d9b4788248595541e11c5327f8fa176b183abfe5fb24fa7f930029'});

只指定了from , data两个参数

执行完之后,交易一直停留在pending队列里面

QQ截图20180531224213.png

问题:

dev模式,不是自动挖矿吗?为啥这里交易迟迟不打包

1 回复

@yuni2017 你目前提供的内容比较少,不大清楚具体的情况,你可以重新运行你的上述两个命令,把相应的输出贴出来看下,可能可以找到问题原因。 我按照你的命令试了下,虽然交易失败了,但是会被打包:

ubuntu@ubuntu-XPS-13-9360:~$ geth --datadir ./testdata --dev console
WARN [06-04|13:41:31] No etherbase set and no accounts found as default 
INFO [06-04|13:41:32] Using developer account                  address=0x0352b835867bFCC75c4b6000Fc1447c47b3A7184
INFO [06-04|13:41:32] Starting peer-to-peer node               instance=Geth/v1.8.0-unstable-e4c9fd29/linux-amd64/go1.8.1
INFO [06-04|13:41:32] Allocated cache and file handles         database=/home/ubuntu/testdata/geth/chaindata cache=128 handles=1024
INFO [06-04|13:41:32] Writing custom genesis block 
INFO [06-04|13:41:32] Initialised chain configuration          config="{ChainID: 1337 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: 0 EIP155: 0 EIP158: 0 Byzantium: 0 Engine: clique}"
INFO [06-04|13:41:32] Initialising Ethereum protocol           versions="[63 62]" network=1
INFO [06-04|13:41:32] Loaded most recent local header          number=0 hash=dc12df…5ef89d td=1
INFO [06-04|13:41:32] Loaded most recent local full block      number=0 hash=dc12df…5ef89d td=1
INFO [06-04|13:41:32] Loaded most recent local fast block      number=0 hash=dc12df…5ef89d td=1
INFO [06-04|13:41:32] Regenerated local transaction journal    transactions=0 accounts=0
INFO [06-04|13:41:32] Starting P2P networking 
INFO [06-04|13:41:32] started whisper v.5.0 
INFO [06-04|13:41:32] RLPx listener up                         self="enode://b58699a3fa2fa8b3264d1a77d9b3087bf0af5cfd9bc44a04ca9c4625fcb1b63083f9f4e61d6fe1eaa8c35d43dbf40d8a0dca81b38539ea9dee627e7c813b9231@[::]:37295?discport=0"
INFO [06-04|13:41:32] IPC endpoint opened: /home/ubuntu/testdata/geth.ipc 
INFO [06-04|13:41:32] Transaction pool price threshold updated price=18000000000
INFO [06-04|13:41:32] Starting mining operation 
INFO [06-04|13:41:32] Commit new mining work                   number=1 txs=0 uncles=0 elapsed=63.977µs
WARN [06-04|13:41:32] Block sealing failed                     err="waiting for transactions"
Welcome to the Geth JavaScript console!

instance: Geth/v1.8.0-unstable-e4c9fd29/linux-amd64/go1.8.1
coinbase: 0x0352b835867bfcc75c4b6000fc1447c47b3a7184
at block: 0 (Thu, 01 Jan 1970 08:00:00 CST)
 datadir: /home/ubuntu/testdata
 modules: admin:1.0 clique:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 shh:1.0 txpool:1.0 web3:1.0

> eth.sendTransaction({from:eth.accounts[0],data:'0x608060405234801561001057600080fd5b5061019a806100206000396000f300608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634ed3885e14610046575b600080fd5b34801561005257600080fd5b506100ad600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506100af565b005b80600090805190602001906100c59291906100c9565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061010a57805160ff1916838001178555610138565b82800160010185558215610138579182015b8281111561013757825182559160200191906001019061011c565b5b5090506101459190610149565b5090565b61016b91905b8082111561016757600081600090555060010161014f565b5090565b905600a165627a7a7230582083446f3a793003d9b4788248595541e11c5327f8fa176b183abfe5fb24fa7f930029'});
INFO [06-04|13:41:44] Submitted contract creation              fullhash=0x52cb5cf255471243d6edc1c981897f75c0d66a33967463b5579d34a6c828ad8b contract=0xC75970eF141B3BDd1910CD7aA1ff2b151a899Ce3
"0x52cb5cf255471243d6edc1c981897f75c0d66a33967463b5579d34a6c828ad8b"
> INFO [06-04|13:41:44] Commit new mining work                   number=1 txs=1 uncles=0 elapsed=1.199ms
INFO [06-04|13:41:44] Successfully sealed new block            number=1 hash=07bfca…c81ff9
INFO [06-04|13:41:44] 🔨 mined potential block                  number=1 hash=07bfca…c81ff9
INFO [06-04|13:41:44] Commit new mining work                   number=2 txs=0 uncles=0 elapsed=1.713ms
WARN [06-04|13:41:44] Block sealing failed                     err="waiting for transactions"
> eth.getTransaction("0x52cb5cf255471243d6edc1c981897f75c0d66a33967463b5579d34a6c828ad8b")
{
  blockHash: "0x07bfcad98c166e7da59bebb4e1472e0520cbf82932b2008da0bb2cfb64c81ff9",
  blockNumber: 1,
  from: "0x0352b835867bfcc75c4b6000fc1447c47b3a7184",
  gas: 90000,
  gasPrice: 1,
  hash: "0x52cb5cf255471243d6edc1c981897f75c0d66a33967463b5579d34a6c828ad8b",
  input: "0x608060405234801561001057600080fd5b5061019a806100206000396000f300608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634ed3885e14610046575b600080fd5b34801561005257600080fd5b506100ad600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506100af565b005b80600090805190602001906100c59291906100c9565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061010a57805160ff1916838001178555610138565b82800160010185558215610138579182015b8281111561013757825182559160200191906001019061011c565b5b5090506101459190610149565b5090565b61016b91905b8082111561016757600081600090555060010161014f565b5090565b905600a165627a7a7230582083446f3a793003d9b4788248595541e11c5327f8fa176b183abfe5fb24fa7f930029",
  nonce: 0,
  r: "0x33c4fd2f250c69161a9e5f0696429b1e427a32b43d2a0ef410fa7c86b14db296",
  s: "0x6e8698fb3030c4bc50b5d751765aaa01ef8e7c0eef78dc2aa8c500611f5302cc",
  to: null,
  transactionIndex: 0,
  v: "0xa95",
  value: 0
}
> eth.getTransactionReceipt("0x52cb5cf255471243d6edc1c981897f75c0d66a33967463b5579d34a6c828ad8b")
{
  blockHash: "0x07bfcad98c166e7da59bebb4e1472e0520cbf82932b2008da0bb2cfb64c81ff9",
  blockNumber: 1,
  contractAddress: "0xc75970ef141b3bdd1910cd7aa1ff2b151a899ce3",
  cumulativeGasUsed: 90000,
  from: "0x0352b835867bfcc75c4b6000fc1447c47b3a7184",
  gasUsed: 90000,
  logs: [],
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  status: "0x0",
  to: null,
  transactionHash: "0x52cb5cf255471243d6edc1c981897f75c0d66a33967463b5579d34a6c828ad8b",
  transactionIndex: 0
}
回到顶部