Netzwerkstatus unbekannt, Bereitstellung auf Testnet

Folgen Sie diesem Blogpost: https://medium.com/@guccimanepunk/how-to-deploy-a-truffle-contract-to-ropsten-e2fb817870c1

Ich habe ein Konto mit erstelltgeth --testnet account new

Ich habe Ether auf dieses Konto angefordert, aber wenn ich nachschaue

geth attach http://127.0.0.1:8545
personal.unlockAccount(eth.accounts[0])
Unlock account 0x78ca93e2a0621a1b5e198e85fd8e1d2db78d17ba
eth.getBalance(eth.accounts[0])
0

Also vielleicht ist das das Problem? (Der Wasserhahn hat bei mir mit meiner Metamask-Adresse gut funktioniert. Ich vermute, dass mein Geth-Konto nicht synchronisiert wird.)

Ich starte Testnest damit:

~/geth --testnet --fast --rpc --rpcapi eth,net,web3,personal

Wie verbinde ich mich mit dem Ropsten-Testnetzwerk und stelle meinen Vertrag mit Truffle bereit?

truffle migrate --network ropsten

Verwenden des Netzwerks 'ropsten'.

Running migration: 1_initial_migration.js Deploying Migrations... ... undefined Error encountered, bailing. Network state unknown. Review successful transactions manually. Error: insufficient funds for gas * price + value at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:41484:16) at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:329530:36 at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:176186:11 at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:325200:9 at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:328229:7) at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176415:18) at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176705:12) at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176860:12) at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176820:24) at emitNone (events.js:111:20)

truffle.js:

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  networks: {
    development: {
      host: "127.0.0.1",
      port: 8545,
      network_id: "*" // Match any network id
    },
    ropsten: {
      network_id: 3,
      host: "127.0.0.1",
      port: 8545,
      gas: 9900000
    }
  }
};

Antworten (3)

Ich stand vor diesem Problem, als mein Vertrag so lautete:


contract A {     
  function abc(unit a) public{    
     //doSomeAction     
  }
}    
Calling the contract in another contract like    
contract B {     
  contract A {    
     function abc(unit a) public;     
  }
....    
}    

Then I changed the contract B like: 
contract B{ 
import './A.sol'  
}   

Danach bekam ich diesen Fehler nicht mehr. Überprüfen Sie also, wie Sie die Verträge aufrufen, um miteinander zu interagieren, und wie viel Gas bei jedem Anruf verbraucht wird.

Versuchen Sie, den Benzinpreis zu senken,

    module.exports = {
      // See <http://truffleframework.com/docs/advanced/configuration>
      networks: {
        development: {
          host: "127.0.0.1",
          port: 8545,
          network_id: "*" // Match any network id
        },
        ropsten: {
          network_id: 3,
          host: "127.0.0.1",
          port: 8545,
          from:  "" //<-- missing 
          gas: 4000000
        }
      }
Hallo, das habe ich versucht, es sieht so aus, als wäre mein Geth gesperrt. Wie gebe ich ein Passwort zum Entschlüsseln an?

Dieser Schritt:

personal.unlockAccount(eth.accounts[0])

Das Schloss bleibt nicht sehr lange offen, also werden Sie denken, dass Sie es getan haben, und das Ergebnis wird Sie tendenziell in die Irre führen, weil es sich wieder verriegelt.

Versuchen:

personal.unlockAccount(eth.accounts[0], "<password>", 15000)

Das heißt entsperren und 15.000 Sekunden lang entsperrt bleiben (genügend Zeit).

Es hat für andere funktioniert: truffle deploy: Netzwerkstatus unbekannt, wenn geth synchronisiert ist

Ich hoffe es hilft.