2

It looks like you deployed to the development network but are running truffle console with the default network, so assume that these are different. You should deploy and use the console on the same network. truffle migrate --network development truffle console --network development As an aside, you shouldn't have to use sudo. You may want to consider ...


1

in your HelloWorld migration file from migrate folder you should open it and by the tutorial add this: var HelloWorld = artifacts.require('HelloWorld'); module.exports = function(deployer) { // Use deployer to state migration tasks. deployer.deploy(HelloWorld); }; you should read the truffle document for more detail: https://www.trufflesuite.com/docs/...


1

For those wondering on a solution, here's the one hinted at in the comments above: First, truffle-config.js looks something like this: module.exports = { networks: { rinkeby: { host: "localhost", // Connect to geth on the specified port: 8545, from: "0x8f03ca885434522d695735a28d6a8a93b4390da9", // default address to use for any ...


1

Yes, the migration has failed. This error means you have insufficient Ethers to deploy your contract, you should therefore redeploy with the correct amount of ETH.


1

yes it is in solidity version 0.4.8 the constructor function's name is the contract's name itself. The attacker contract constructor function has a param and it is the address of the victim contract. So first he deploy Victim contract then after that he deploy Attacker contract with Victim contract address as the param for constructor function. You can ...


1

You are passing 1 argument in an attempt to deploy an instance of contract KJToken: deployer.deploy(KJToken, KJToken.address) But the constructor of this contract takes 0 arguments: constructor() public ...


1

The format to add constructor arguments for a Truffle migration script is described here: https://www.trufflesuite.com/docs/truffle/getting-started/running-migrations#deployer-deploy-contract-args-options- So you need to use: deployer.deploy(SimpleStorage, VALUE)


1

In your ABI, you indicate to web3 that function totalVotesFor returns a uint8: { "constant" : true, "inputs" : [{"name":"candidate","type":"bytes32"}], "name" : "totalVotesFor", "outputs" : [{"name":"","type":"uint8"}], "payable" : false, "stateMutability" : "view", "type" : "...


1

Using below code you can deploy your contract using truffle-contract. const contract = require('truffle-contract'); const DeployJson = fs.readFileSync("E:/Deploy/build/contracts/Deploy.json"); const DeployContract = contract(DeployJson); DeployContract.setNetwork('network_id'); // Unlock the account from which you want to deploy the contract await web3.eth....


1

There's no deploy method in the API provided by require('truffle-contract'). Given truffleContract = require('truffle-contract'), you need to do something like this: const myContract = truffleContract({abi: ..., unlinked_binary: ...}); const block = await web3.eth.getBlock('latest'); myContract.setProvider(web3.currentProvider); myContract.defaults({from: ...


1

Assuming that you have already compiled the contract, and that its abi and bytecode are in files <ContractName>.abi and <ContractName>.bin respectively, you can use this script (web3 v1.2.1): const fs = require("fs"); const Web3 = require("web3"); const NODE_ADDRESS = "..."; const PRIVATE_KEY = "..."; const CONTRACT_NAME = "..."; const ...


1

I found this solution working. I didnt change any line of code apart from the below Previous token = EMPToken(_empTokenAdr); token.approve(msg.sender,2); Changed: EMPToken(_empTokenAdr).approve(msg.sender,2); I have no clue about the reasons.


1

This error means that Truffle cannot find a network entry for the current network ID in the build artifact file. Whenever a truffle migration is done, the build artifact JSON (typically under build) is updated to include a mapping of network ID to contract address. Thus whenever you reset your test blockchain, e.g. restart ganache-cli, you need to re-...


1

In the migrations directory you have to reference the deployments for any new contracts. In this case that is the file 2_deploy_contracts.js: var ProofOfExistence1 = artifacts.require('./ProofOfExistence1.sol'); var ProofOfExistence2 = artifacts.require('./ProofOfExistence2.sol'); module.exports = function(deployer) { deployer.deploy(ProofOfExistence1)...


1

Finally I solved the error. The error wasn't for any port or any network-artifact mismatch.Instead the contract json file wasn't loaded by the time we are trying to deploy it. const todoList =await $.getJSON('TodoList.json'); //I added the await keyword and it worked fine. I learnt an important lesson that everything in the blockchain is asynchronous. So ...


Only top voted, non community-wiki answers of a minimum length are eligible