Truffle: Migration zu ropsten - schlägt stillschweigend fehl

Wenn ich den folgenden Befehl ausführe, erhalte ich keinerlei Ausgabe:

truffle migrate --network ropsten

Dies geschieht unmittelbar nach dem Erstellen eines neuen Projekts mit truffle initeinem einzelnen Vertrag.

Wenn ich truffle developden Migrationsbefehl von der Konsole aus ausführe und ausführe, funktioniert alles einwandfrei.

Dies ist der Inhalt meiner truffle.js-Datei:

var HDWalletProvider = require("truffle-hdwallet-provider");

var mnemonic = "my twelve word mnemonic......";

module.exports = {
  networks: {
    ropsten: {
      provider: function() {
        return new HDWalletProvider(mnemonic, "https://ropsten.infura.io/xxxxxxxxxxxxx")
      },
      network_id: 3
    },
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*" // Match any network id
    }
  }
};

Ich verwende Ubuntu 16.04 und die neueste Version von Truffle 4.1.8.

(und ja, ich habe mein Konto bei Ropsten mit Ether aus dem Wasserhahn finanziert)

Keine Leistung ? Irgendein Exit-Code? Sie können versuchen --verbose-rpc, einige Debug-Traces zu erhalten. Andernfalls, wenn Sie den Build von Grund auf neu zurücksetzen möchten, versuchen Sie es--reset --compile-all
Folgendes bekomme ich: localhost:~/testdapp$ truffle migrate --network ropsten --verbose-rpc > { > "jsonrpc": "2.0", > "id": 1, > "method": "eth_accounts", > "Parameter": [] > }
hast du es versucht --reset --compile-all?
Ist das truffle compile --reset --compile-all?
truffle migrate --network ropsten --reset --compile-all --verbose-rpc
Danke Greg - immer noch dasselbe:{ "jsonrpc": "2.0", "id": 1, "method": "eth_accounts", "params": [] }

Antworten (4)

So mache ich es zum Beispiel für die Bereitstellung auf Kovan, indem ich den Infura-Link ändere, den Sie auf allen Testnetzen bereitstellen können . Funktioniert bei mir total gut:

const HDWalletProvider = require('truffle-hdwallet-provider');
const Web3 = require('web3');
const { interface, bytecode } = require ('./compile'); //That files come from the compile.js you can see it below.

const provider = new HDWalletProvider(
    '12 words mneumonic',
    'https://kovan.infura.io/XXXXXXXXXXXX'
);

const web3 = new Web3(provider);

const deploy = async ()=> { //Create that function to use async & await
    const accounts = await web3.eth.getAccounts();

    console.log('Attempting to deploy from account', accounts[0]);

    const result = await new web3.eth.Contract(JSON.parse(interface))
        .deploy({data: bytecode})
        .send({ gas: '30000000', from: accounts[0]});

        console.log('Contract deployed to', result.options.address);
        console.log(interface);//We pass the ABI through the console to be able to use it to build the javascript object that emulates the contract on our react code.

};
deploy();

Hier überlasse ich Ihnen die compile.js, falls Sie sie brauchen.

    const path = require('path'); // Helps to find the path to the contract across whatever OS you are using form compile.js to xxx.sol files
    const fs = require('fs'); // Load the FileSystem Module.
    const solc = require('solc');

    const contractPath = path.resolve(__dirname, 'contracts', 'Contracts_Remix.sol'); //Creation of cross SO's path.

    const source = fs.readFileSync(contractPath, 'utf8'); 
    //We compile the source code, of 1 single contract and showed the bytecode and the ABI by console to examine it.
    console.log(solc.compile(source),1); 
    module.exports = solc.compile(source).contracts[':Your_contract_name']; 
//We only call the contract we want to deploy.

Ich hoffe es hilft!

Ich hatte das gleiche Problem, aber in meinem Fall hatte ich meine Infura-Endpunkt-Umgebungsvariable fälschlicherweise auf meinen geheimen Schlüssel anstelle meiner Projekt-ID gesetzt. Falls es jemand anderem hilft, dies zu lesen, stellen Sie sicher, dass Ihr infura-Endpunkt korrekt ist!

Das war in meinem Fall der Fehler. Meine RPC-URL war falsch formatiert. Um Variablen in der RPC-URL im Ropsten-Anbieter zu referenzieren, muss sie von „back-ticks“ anstelle von einfachen Anführungszeichen umgeben sein, z /$ {process.env.INFURA_API_KEY}`);

Damit kommt man nicht weiter, scheint die Migration im ersten Teil hängen zu bleiben:

> {
>   "jsonrpc": "2.0",
>   "id": 1,
>   "method": "eth_accounts",
>   "params": []
> }

Es könnte daran liegen, dass ich mich hinter einem Unternehmens-Proxy befinde, aber ich kann es der Ausgabe nicht entnehmen. Verblüfft!

Ich hatte ein ähnliches Problem und das Herabsetzen der Version des HDWallet-Anbieters löste das Problem (Trüffel-HDWallet-Anbieter von 1.0.7 auf 1.0.6.)