Several places say insecure unlock is poor practice.

Yet this module I am learning implements it.

Where can I find a way to Deploy an account without insecure unlock

Here is repository with files I am working with, i.e. deploy.js, etc, https://github.com/ArtieLadie/no_unlock

Here is screenshot from Pluralsight

By the way, I tried doing sudo geth attach --allow-insecure-unlock (and other variations) for learning sake, but that also doesn't work!

enter image description here


Rather than unlocking an account, signing specific transactions is generally a better and more secure way to handle this. There are multiple ways to do this depending on the library you are using. Below are a few examples:


With web3.js you can create a raw transaction and then sign the raw transaction with the account's private key and send it to the network:

Ether Transaction


Contract Example



Ether Transaction

Create a wallet using a private key and a transaction - by defining the . Send the transaction


Contract Call

With ethers you can create a contract object and connect it with a wallet object. The wallet object contains an address and a private key - so transactions sent from this connected contract object will be signed by that wallet that had been logged into

see 'Calling a Non-Constant Method' here: https://docs.ethers.io/ethers.js/html/api-contract.html#connecting-to-existing-contracts

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.