1

I'm trying to deploy a truffle project to testnet. When I run truffle migrate --reset --network rinkeby --verbose-rpc, this is output:

You can improve web3's peformance when running Node.js versions older than 10.5.0 by installing the (deprecated) scrypt package in your project
You can improve web3's peformance when running Node.js versions older than 10.5.0 by installing the (deprecated) scrypt package in your project

Compiling your contracts...
===========================
> Compiling ./contracts/Migrations.sol
> Compiling ./contracts/StarNotary.sol
...
> Artifacts written to /home/how/projects/_mooc/blockchain/starNotary_3/build/contracts
> Compiled successfully using:
   - solc: 0.5.8+commit.23d335f2.Emscripten.clang

It doesn't create any contract neither in testnet nor locally, and it doesn't mention what goes wrong.

Here is relevant content of truffle.js file:

const HDWalletProvider = require('truffle-hdwallet-provider');
const fs = require('fs');
require('dotenv').config()

module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",
      port: 9545,
      network_id: "*"
    },
    rinkeby: {
      provider: () => new HDWalletProvider(process.env.MNENOMIC, "https://rinkeby.infura.io/v3/" + process.env.INFURA_API_KEY),
      network_id: 4,
      gas: 3000000,
      gasPrice: 10000000000
    }
  }
}

I tried pinging rinkeby.infura.io and it doesn't seem to respond. Can it be that I just can't reach the network?


edit #01

Scripts in migrations folder

// 1_initial_migration.js
const Migrations = artifacts.require("Migrations");

module.exports = function(deployer) {
  deployer.deploy(Migrations);
};

// 2_deploy_contracts.js
const StarNotary = artifacts.require("StarNotary");

module.exports = function(deployer) {
  deployer.deploy(StarNotary, "Udacity Star Token", "UST");
};

Link to project

https://github.com/SteveRedka/Star_Notary

3
  • What version of truffle are you using? Are your mnemonic and infura key valid? Try deleting build/ then compile and migrate. Whats scripts do you have in the migration folder?
    – Ismael
    Aug 30, 2019 at 1:37
  • Truffle 5.0.32. Yes, both keys are valid, and if they weren't, valid why wouldn't it raise an error? After deleting build nothing changes: it still deploys locally and fails to deploy to network. Aug 30, 2019 at 6:47
  • Added scripts into question, as well as link to project Aug 30, 2019 at 6:51

2 Answers 2

2

I've just cloned your repo, entered my mnemonic and infura_api_key to .env and everything was ok, I ran truffle migrate --network rinkeby and the contract deployed successfully.

Try re-installing dependencies and truffle. May be you do not use '' when adding mnemonic and api key to the .env. Also, my settings in Infura are all the default, you may have restricted access to your api key. My truffle version is v5.0.33.

0

try to connect to an other blockchain provider like your local node if it works then it's a problem related to infura .. also you can hardcode the project id in the url just to be sure that it's the right one

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.