I am developing a Dapp, which has a smart contract in solidity and uses truffle framework. My smart contract has a constructor that takes a value as an argument I want to initialize this smart contract from truffle framework in node.js But the value that I need to pass to initialize has to be fetched from a database(mongoDB). How can this be done? Can we write fetching this code logic in 2_deploy_contracts.js? Thank you in advance

1 Answer 1


Yes. If you can do it with JavaScript, you integrate into your migration process.

Hope it helps.

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.