Okay, thanks for your help!
Hello @thecil
I’m having problems with truffle migrate
truffle migrate
Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.
> Something went wrong while attempting to connect to the network at http://127.0.0.1:7545. Check your network configuration.
ProviderError:
Could not connect to your Ethereum client with the following parameters:
- host > 127.0.0.1
- port > 7545
- network_id > *
Please check that your Ethereum client:
- is running
- is accepting RPC connections (i.e., "--rpc" or "--http" option is used in geth)
- is accessible over the network
- is properly configured in your Truffle configuration file (truffle-config.js)
Thanks in advance
Mildo
Hello @thecil I was able to run it by running migrate from the truffle develop but in the video @filip did it outside of the development console
Glad to know you solve it @Mildo
By the time the video was made, there has been a lot of changes on truffle, some times the old method works, but its easier to follow the new process, all you need is to run your own local blockchain while testing your contract.
The command truffle develop
will start a local blockchain and then inside this one, you can call the usual commands from the video, like migrate
or compile
, you also can deploy
your contracts or migrate.
So the process is quite simple:
- Start a truffle local blockchain
truffle develop
-
compile
your contracts. -
migrate
ordeploy
.
Carlos Z
hey can someone hepl me figure out the proble i have tried all solutions already given in the frum cant seem to figure out the issue.
these are just warning messages you can disregard these. errors come up in red
this is fine this is showing its installed all those messages are just showing the different commands you can execute with truffle via the command line. keep following the videos and message me back if you run into any problems when actually using truffle in a smart contract project
its not showing migration.sol or the js file
you can just create these files yourself. the only thing that needs to be generated with the truffle project is package.json and truffle0config. also im not sure what issue you are facing. the output when your execute the truffle command is the correct output. you can run truffle develop
if you want to enter the command line version of truffle
I’m trying to migrate 1_initial_migrations.js, but this error keeps showing up, and because of this I am unable to compile 2_hello_migrations.js too because the cmd keeps trying to migrate 1_initial_migrations.js first.
migration file
`const Migrations = artifacts.required("Migrations");
module.exports = function(deployer) {
deployer.deploy(Migrations);
};`
migrations.sol file
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Migrations{
address public owner = msg.sender;
uint public last_completed_migration;
modifier restricted() {
require(
msg.sender == owner,
"This function is restricted to the contract's owner"
);
_;
}
function setCompleted(uint completed) public restricted{
last_completed_migration = completed;
}
}
ok problem here is the file should be called 1_initial_migration.js
and not 1_initial_migrations.js
. try chaning the name
Your Migrations
contract apparently does not have a solidity version.
It should look like this:
Migrations.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
contract Migrations {
address public owner = msg.sender;
uint public last_completed_migration;
modifier restricted() {
require(
msg.sender == owner,
"This function is restricted to the contract's owner"
);
_;
}
function setCompleted(uint completed) public restricted {
last_completed_migration = completed;
}
}
Then, the 1_initial_migration.js
should just looks like this:
const Migrations = artifacts.require("Migrations");
module.exports = function (deployer) {
deployer.deploy(Migrations);
};
Carlos Z
Thanks Carloz , it’s working now.