39 votes

What caused this error: Attempting to run transaction which calls a contract function, but recipient address is not a contract address

i´ve just used migrate --reset (without deleting /build) , and worked
IveltonQueiroz's user avatar
32 votes
Accepted

Steps to deploy a contract using MetaMask and Truffle

Solution 1: With you own node You can easily deploy on the ropsten network if you own a full node running on your machine. i. Run geth $ geth --fast --cache=1048 --testnet --unlock "0xmyaddress" --...
Greg Jeanmart's user avatar
31 votes
Accepted

truffle migrate: How to deploy a contract whose constructor takes a parameter

You can add the constructor parameters as extra arguments to the deploy() call const BaconMaker = artifacts.require('./BaconMaker.sol') module.exports = (deployer, network, accounts) => { const ...
Ismael's user avatar
  • 31k
31 votes
Accepted

What caused this error: Attempting to run transaction which calls a contract function, but recipient address is not a contract address

As provided in comments by Mavlarn and ivicaa above, the answer is to delete the .json files under build/contracts/. Then the next run of truffle migrate no longer fails.
Alex Altair's user avatar
28 votes
Accepted

Truffle migrate fails

This seems to occur if you're trying to deploy contract A that depends on contract B before contract B has actually finished deploying. You probably have something like this: module.exports = ...
Mike Shultz's user avatar
  • 1,212
24 votes
Accepted

Truffle migrate vs Truffle deploy

truffle deploy is an alias for truffle migrate. They both do the same thing.
Edmund Edgar's user avatar
  • 16.8k
23 votes

Truffle: Error: Could not find a compiler version matching 0.5.0

It's solved by running with elevated permissions once: sudo truffle compile - that will download the compiler and then you can continue using non-elevated command truffle compile. That is most ...
Andrey's user avatar
  • 1,117
19 votes
Accepted

what does `deploy.link` exactly do in `truffle`

EDIT: As stated in the comment by @feihcsim autolink has been deprecated Let's say ecosystem of your dapp has a library and a contract that calls functions from that library. So you have: library ...
KwahuNashoba's user avatar
16 votes
Accepted

Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead

This is because of a deprecated standard. In the file, Migrations.sol, replace the line: function Migrations() public { with: constructor() public { The line of code shown just above is a ...
Vignesh Karthikeyan's user avatar
13 votes
Accepted

Truffle Deployment Error: Invalid number of parameters for "undefined". Got 1 expected 0!

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() ...
goodvibration's user avatar
12 votes
Accepted

Return Token Contract address on truffle deploy

The address of the contract is just the variable name of the deployed contract. Try this: deployer.deploy(CrowdTestToken).then(function(){ return deployer.deploy(CrowdSale, CrowdTestToken.address)...
David Young's user avatar
12 votes
Accepted

truffle migrate specific file

Use the flag --f for the first migration and --to for the last migration like this: truffle migrate --f 2 --to 2 Source: https://github.com/trufflesuite/truffle-migrate/issues/23#issuecomment-...
Juuso's user avatar
  • 345
11 votes
Accepted

Truffle migrate: store deployed contract address in variable

One way to achieve this through the Truffle Migration files would be to modify contract Two such that its constructor takes an address as input and stores it as oneAdd, then deploy the contracts with ...
TC8's user avatar
  • 1,240
11 votes
Accepted

what is the role of Migrations.sol contract in truffle project?

The Migrations contract keeps track of which migrations were done on the current network. Inside the migrations folder, you'll see a file called 1_initial_migration.js The 1 in the filename is the ...
Henk's user avatar
  • 4,256
10 votes
Accepted

Truffle migration: Error: authentication needed: password or unlock

Ok, finally I added some code to unlock account on the fly. I do not want to store password in truffle.js (but it is possible), so doing next things: Changed 1_initial_migration.js this way: const ...
Alex G.P.'s user avatar
  • 1,274
9 votes

Truffle post-deployment actions

With help of Karthikeyan Thangavel and Truffle docs I finally made it works: module.exports = async function(deployer) { let aInst, bInst; await Promise.all([ deployer.deploy(A), ...
Alex G.P.'s user avatar
  • 1,274
9 votes

Prevent 'truffle test' from invoking 'truffle deploy (migrate)'

I ran into this issue as well, and it is indeed the intended behavior of truffle test: cleanroom behavior. Each run of truffle test redeploys the contracts. If it didn't, then saved state from a prior ...
Yaoshiang's user avatar
  • 301
8 votes

Truffle Flattener creates empty flat file

Try to use output parameter: truffle-flattener .\contracts\WetherCrowdsale.sol --output WetherCrowdsale_flat.sol
Aquila's user avatar
  • 1,802
8 votes
Accepted

Truffle v5 runs out of gas but Truffle v4 deploys the contract

Check @goodvibration answer. It should work in most instances. I don't recommend the answer that I will share below, it will ignore the EIP-170, hopefully there is a better answer I was only able to ...
Dziugas's user avatar
  • 141
8 votes
Accepted

Solidity. Truffle. Call contract function in migration file

You can get a instance of deployed contract with await Ownable.deployed() after deployment. You can achieve what you are looking for with a much simpler looking script. module.exports = async (...
Iftifar Taz's user avatar
8 votes

Timeout error on deploying to Rinkeby from truffle migrate

I have fixed this problem by setting networkCheckTimeout as 10000 before setting provider in truffle-config.js. networks: { bsctest: { networkCheckTimeout: 10000, provider: () => new ...
David Yu's user avatar
  • 111
7 votes

Truffle migrate fails

I prefer this syntax: module.exports = function(deployer, network, accounts) { deployer.then(async () => { await deployer.deploy(A); await deployer.deploy(B, A.address); ...
Aaron Digulla's user avatar
7 votes
Accepted

Deploying contracts in Ropsten with Truffle

When I was deploying my contract through truffle in rinkeby network I too got the same error after adding from address and gas it got deployed. Try this networks: { ropsten: { network_id: 3, ...
Jazz's user avatar
  • 216
7 votes

what is the role of Migrations.sol contract in truffle project?

Good Answer from here: The Migrations contract stores (in last_completed_migration) a number that corresponds to the last applied "migration" script, found in the migrations folder. Deploying this ...
n1cK's user avatar
  • 3,378
6 votes

How does Truffle know the address of contracts published via truffle migrate?

Good qus. As far as I know. Truffle will store your contract address in build/contacts/[CONTRACT.json] file Truffle will map contract address under network json object with index. "networks": { ...
Jitendra Kumar. Balla's user avatar
6 votes

Prevent 'truffle test' from invoking 'truffle deploy (migrate)'

It is really embarrassing, how narrow minded the truffle authors think. My tests run their own deployment that is used in the tests. In my case, the truffle migration includes the steps that data is ...
Marc Wäckerlin's user avatar
6 votes

How to fix "No events were emitted"

If you arrived here looking for a way to print the events emitted during your tests, you can do this with the --show-events flag: truffle test --show-events
Paul Razvan Berg's user avatar
6 votes
Accepted

I got this error during migration in truffle. : ParserError: Expected '(' but got identifier

Prior to Solidity v0.4.21: contract ContractName { function ContractName(...) public { ... } ... } Solidity v0.4.21 onward: contract ContractName { constructor(...) public { ...
goodvibration's user avatar
5 votes
Accepted

Issue in truffle migration with Quorum

inside module.exports, add Gas and gasPrice. network_id: "*", // Match any network id gasPrice: 0, gas: 4500000
Luiz Soares's user avatar
  • 1,064
5 votes

Truffle deploying without linking

Calling library functions declared as internal, such as those in SafeMath and Math above do not require the calling contract to be linked to the library contract as they will be copied into the ...
willjgriff's user avatar
  • 1,658

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