web3dart icon indicating copy to clipboard operation
web3dart copied to clipboard

Using a privateKey

Open gkd720 opened this issue 7 years ago • 0 comments

I had previously been developing a simple app to record data into the Ethereum blockchain, and had used the web3.js package because I was in a javascript/Angular/browser world. I've now switched over to flutter/dart native device application and will be trying to use this package. Scanning the code and examples, it seems like a transaction's credentials are usually made starting from a privateKey. From documentation for web3.js, it was thought to be dangerous to be explicitly handling privateKeys. So I had used the 'geth' ethereum client to make an account ('geth account new'), providing a passphrase when creating it, with accounts ending up in an Ethereum keystore file. To use an account's address as a transaction's 'from' address, I had to unlock the account first ('web3.personal.unlockAccount' and provide the passphrase). For web3dart, do things work similarly? I see references to 'wallet' files, (String content = new File("wallet.json").readAsStringSync(); Wallet wallet = Wallet.fromJson(content, "testpassword");), but I don't know if my keystore file is the same, or even usable. Looks like 'testpassword' is what selects the account(?), so if I have 2 accounts with the same password/passphrase, would this work? Or would I have to make new accounts using web3dart functions? Thanks for any help or guidance.

gkd720 avatar Aug 12 '18 18:08 gkd720