0

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 http://127.0.0.1:8545 --allow-insecure-unlock (and other variations) for learning sake, but that also doesn't work!

enter image description here

1

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:

web3.js

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

https://web3js.readthedocs.io/en/v1.2.0/web3-eth.html#sendsignedtransaction

Contract Example

https://stackoverflow.com/questions/46611117/how-to-authenticate-and-send-contract-method-using-web3-js-1-0

ethersjs

Ether Transaction

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

https://docs.ethers.io/ethers.js/html/api-wallet.html#signing

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

| improve this answer | |

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.