thien k phan

Smart Contract Note (1)

Development Notes
1. Development Server:
I started using Ganache as Ethereum local node, now I moved on using Go Ethereum
2. Run:
geth --http --http.corsdomain="*" --http.api web3,eth,debug,personal,net --vmdebug --datadir $HOME/persist-geth --dev console --allow-insecure-unlock
where persist-geth is the geth persistence folder
Spawns a local EVM node at 8545.
Connect with Metamask with chain ID 1337

Some notes on -allow-insecure-lock:

I was trying to making some transactions with some newly created accounts in geth node, the command to create new account:
geth account new --datadir $HOME/persist-geth
Error will happen when the account is not unlocked.
creation of xxxx errored: Returned error: authentication needed: password or unlock
👀 Reason:
Unlock Account is forbidden via when connecting to node via HTTP.
🏁 Solutions:
Run with web3 API to unlock the account.
web3.personal.accounts.unlockAccount("0x....", "SAFE-PASSWORD-BLAH-BLAH", null)
Duration time null is OK, for development I need the account to be unlocked indefinitely.