As a newbie in this space, I'm just wondering how Truffle handles migrating contracts with the Truffle Migrate command—what does it use to sign those transactions? Does it use some wallet implementation? In my development environment, truffle.js is configured to connect to Ganache.

Hopefully, this question makes sense.

4 Answers 4


Quick answer

It does not (need to) sign these transactions.

Long answer

Under the hood, Truffle uses Ganache to run a local Ethereum Blockchain. Ganache also generate 10 pre-funded addresses. Truffle uses the first of these addresses to migrate contracts. These addresses are "unlocked" by Ganache, which means we DON'T NEED to sign transactions from them. As a result, Truffle just specify the from field of the deployment transactions, but does not sign them.

  • This is incorrect. Truffle includes ganachi-cli that may or may not skip that step, but it also deploys to private networks, public testnets and mainnet using geth or parity nodes. It does have to sign transactions to do so. Unlocking and signing are not the same thing. Outside of ganache it is necessary to unlock accounts for everything to work precisely because truffle will be signing transactions from the accounts it finds in the node. Feb 22, 2019 at 0:12
  • 1
    Rob, your comment missed the point. Please re-read carefully the question: "...in my development environment, truffle.js is configured to connect to Ganache." We are talking of Truffle with Ganache here, not Geth or Parity. Feb 23, 2019 at 8:51

It uses the first account, or the account described in truffle.js for a given network, or the account described in the actual deployer.deploy(... {from: account});

Hope it helps.

  • And it signs the transaction using the accounts private key like any other transaction? Dec 1, 2018 at 18:59
  • Right. Setting aside ganache-cli, the node could be plain old geth and it would know the difference. The "client" (truffle) signs the transaction. Dec 1, 2018 at 19:25
  • oops ... "would not know the difference ;-)" - welcome. Dec 1, 2018 at 19:45

As said by Julien, if truffle is connected to Ganache then it uses first account to perform transaction which is already unlocked , which means no need to sign.

If truffle is connected to main-net or test net, truffles uses truffle-hdwallet-provider to store private key in local machine.

Found below article useful, it explain how truffle interacts with Rinkeby and send signed transaction.



It uses the first unlocked account found in the node. This being either Ganache or any private network. If there is not unlocked account, it will fail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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