I'm trying to run an external script in truffle. Basically I deploy the contracts with 'migrate' then want to run this script to set the variables. I just can't seem to get it to call correctly with:

truffle develop
exec file.js

and my code:

var Factory = artifacts.require("Factory");

module.exports = async function(callback) {
    var factory = await Factory.deployed();
    await factory.setVariables(1000000000000000,1000000000000000,7,1);

The console logs the correct address, but then it just hangs on the last part. Any help is much appreciated!

1 Answer 1


So it works fine...just not with the truffle develop

So it has to be:

truffle compile
truffle migrate
truffle exec file.js

Also, no need to put the await on the sendTransaction unless you're running something else right after

Your Answer

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

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