How Does Truffle Migrate Sign the Transaction That It's Dealing With?
Fleeting- External reference: https://ethereum.stackexchange.com/questions/63358/how-does-truffle-migrate-sign-the-transaction-that-its-dealing-with
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.
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