Go-Ethereum

松露部署到geth失敗,從geth反復生成“找不到收據”

  • July 26, 2016

我剛剛在 ubuntu 虛擬機上安裝了 truffle,但無法部署到 geth 開發設置。Geth 給了我一個永無止境的receipt not found for transaction 0xf19898c656a7957808d38c881606360c55413d2f1c5b432e0b213379ab794b38資訊

執行 geth:

$ geth --datadir ~/.ethereum/DevChain/ --port 30310 --rpc --networkid 4567890 --dev --lightkdf --nodiscover --maxpeers 0 --verbosity 6 --pprof --gpomin "50" --gpomax "50" --pprofport 6110 console 2> ~/geth.log
instance: Geth/v1.4.0-unstable/linux/go1.5.1
coinbase: 0xc04ee7e3a98cb68fcd2318ef0454377e23ec01c3
at block: 460 (Tue, 05 Apr 2016 21:26:26 PDT)
datadir: /home/michael/.ethereum/DevChain
> personal.unlockAccount("0xc04ee7e3a98cb68fcd2318ef0454377e23ec01c3")
Unlock account 0xc04ee7e3a98cb68fcd2318ef0454377e23ec01c3
Passphrase: 

執行松露部署:

michael@u4:~/truffleProject$ truffle deploy
Using environment development.
Compiling ./contracts/MetaCoin.sol...
Sending MetaCoin.sol to the network...

在 geth 中設置了兩個帳戶。Contract 只是預設的松露合約:

contract MetaCoin {
       mapping (address => uint) balances;

       function MetaCoin() {
               balances[tx.origin] = 10000;
       }

       function sendCoin(address receiver, uint amount) returns(bool sufficient) {
               if (balances[msg.sender] < amount) return false;
               balances[msg.sender] -= amount;
               balances[receiver] += amount;
               return true;
       }

 function getBalance(address addr) returns(uint) {
   return balances[addr];
 }
}

geth的日誌輸出:

I0405 21:33:17.139998 core/tx_pool.go:300] (t) 6330346565376533 => [NEW_CONTRACT] (0x53d230) f19898c656a7957808d38c881606360c55413d2f1c5b432e0b213379ab794b38
I0405 21:33:17.140082 eth/api.go:1071] Tx(0xf19898c656a7957808d38c881606360c55413d2f1c5b432e0b213379ab794b38) created: 0x0d1e8032f72411e130c2d6a5a23c6f8a082bab9e
I0405 21:33:17.140304 core/state/state_object.go:168] c04ee7e3a98cb68fcd2318ef0454377e23ec01c3: #0 2299685840800000000000 (- 314159200000000000)
I0405 21:33:17.140383 core/state/statedb.go:267] (+) 0d1e8032f72411e130c2d6a5a23c6f8a082bab9e
I0405 21:33:17.140402 core/state/state_object.go:168] c04ee7e3a98cb68fcd2318ef0454377e23ec01c3: #1 2299685840800000000000 (- 0)
I0405 21:33:17.140413 core/state/state_object.go:160] 0d1e8032f72411e130c2d6a5a23c6f8a082bab9e: #0 0 (+ 0)
I0405 21:33:17.140425 core/vm/vm.go:157] running byte VM 26d34cde
I0405 21:33:17.140487 core/vm/vm.go:160] byte VM 26d34cde done. time: 56.33µs instrc: 30
I0405 21:33:17.140500 core/state/state_object.go:160] c04ee7e3a98cb68fcd2318ef0454377e23ec01c3: #1 2299991360400000000000 (+ 305519600000000000)
I0405 21:33:17.140509 core/state/state_object.go:160] c04ee7e3a98cb68fcd2318ef0454377e23ec01c3: #1 2299991360400000000000 (+ 0)
I0405 21:33:17.140555 core/state/statedb.go:267] (+) 0000000000000000000000000000000000000000
I0405 21:33:17.140568 core/state/state_object.go:160] 0000000000000000000000000000000000000000: #0 8639600000000000 (+ 8639600000000000)
I0405 21:33:17.140663 core/state_processor.go:92] receipt{med=737a95552f168141e6d4f13cf41f2da4e46e9d00a9a1490ab946138c17d39703 cgas=86396 bloom=00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[]}
I0405 21:33:17.140702 eth/handler.go:731] broadcast tx to 0 peers
I0405 21:33:18.145589 eth/api.go:962] receipt not found for transaction 0xf19898c656a7957808d38c881606360c55413d2f1c5b432e0b213379ab794b38
I0405 21:33:19.149835 eth/api.go:962] receipt not found for transaction 0xf19898c656a7957808d38c881606360c55413d2f1c5b432e0b213379ab794b38
I0405 21:33:20.152780 eth/api.go:962] receipt not found for transaction 0xf19898c656a7957808d38c881606360c55413d2f1c5b432e0b213379ab794b38
I0405 21:33:21.156125 eth/api.go:962] receipt not found for transaction 0xf19898c656a7957808d38c881606360c55413d2f1c5b432e0b213379ab794b38
I0405 21:33:22.158505 eth/api.go:962] receipt not found for transaction 0xf19898c656a7957808d38c881606360c55413d2f1c5b432e0b213379ab794b38
I0405 21:33:23.162283 eth/api.go:962] receipt not found for transaction 0xf19898c656a7957808d38c881606360c55413d2f1c5b432e0b213379ab794b38
I0405 21:33:24.164380 eth/api.go:962] receipt not found for transaction 0xf19898c656a7957808d38c881606360c55413d2f1c5b432e0b213379ab794b38
I0405 21:33:25.166750 eth/api.go:962] receipt not found for transaction 0xf19898c656a7957808d38c881606360c55413d2f1c5b432e0b213379ab794b38
I0405 21:33:26.170280 eth/api.go:962] receipt not found for transaction 0xf19898c656a7957808d38c881606360c55413d2f1c5b432e0b213379ab794b38
...etc...

在我嘗試找到可行的基本設置時,請欣賞提示。只是想在一個快速的開發環境中玩一些基本的合約創建,還沒有讓 truffle 或 testrpc 為我飛行。(我應該只使用solidity實時編譯器和霧嗎?)

如果您還沒有,我強烈建議您看看Mix並遵循本教程

看起來您的區塊沒有被開採,並且您的網路中有 0 個對等方。這是我在舊版本的 geth 中使用的私有鏈引導命令(注意--mine--max_peers 2標誌):

geth --genesis ./private_env/genesis.json --datadir ./private_chain --rpc --rpcport 2060 --networkid 257291 --unlock primary --nodiscover --mine --minerthreads 8 --maxpeers 2 --unlock 0 --password ./private_env/password.txt > ./log.txt 2>&1

創世區塊是按照本指南預先播種的。

但真的……除非你願意,否則這些天沒必要把它弄髒。混音很棒!

引用自:https://ethereum.stackexchange.com/questions/2693