Commit Graph

48 Commits

Author SHA1 Message Date
zsfelfoldi 3a97280ae8 eth: separate common and full node-specific API and backend service 2016-06-16 17:36:38 +02:00
Bas van Kervel 64a6c2c1b6 eth: add new RPC method (personal.) SignAndSendTransaction 2016-05-20 15:54:18 +02:00
Ales Katona 572da73d4d eth: add personal_importRawKey for runtime private key import 2016-04-28 09:11:40 -06:00
Felix Lange 6498df7b02 accounts: ensure TimedUnlock does not override indefinite unlock timeout 2016-04-12 15:59:18 +02:00
Felix Lange 46df50be18 accounts: improve API and add documentation
- Sign takes common.Address, not Account
- Import/Export methods work with encrypted JSON keys
2016-04-12 15:59:18 +02:00
Felix Lange 6f1ca0bc91 accounts: add ErrDecrypt 2016-04-12 15:58:07 +02:00
Felix Lange a9f26dcd0d accounts: cache key addresses
In order to avoid disk thrashing for Accounts and HasAccount,
address->key file mappings are now cached in memory. This makes it no
longer necessary to keep the key address in the file name. The address
of each key is derived from file content instead.

There are minor user-visible changes:

- "geth account list" now reports key file paths alongside the address.
- If multiple keys are present for an address, unlocking by address is
  not possible. Users are directed to remove the duplicate files
  instead. Unlocking by index is still possible.
- Key files are overwritten written in place when updating the password.
2016-04-12 15:58:07 +02:00
Felix Lange 46e8940b19 accounts: streamline API
- Manager.Accounts no longer returns an error.
- Manager methods take Account instead of common.Address.
- All uses of Account with unkeyed fields are converted.
2016-04-12 15:58:01 +02:00
Felix Lange 85e6c40c00 accounts, crypto: move keystore to package accounts
The account management API was originally implemented as a thin layer
around crypto.KeyStore, on the grounds that several kinds of key stores
would be implemented later on. It turns out that this won't happen so
KeyStore is a superflous abstraction.

In this commit crypto.KeyStore and everything related to it moves to
package accounts and is unexported.
2016-04-12 15:56:49 +02:00
Bas van Kervel 19b2640e89 rpc: migrated the RPC insterface to a new reflection based RPC layer 2016-01-26 13:51:50 +01:00
Bas van Kervel eae81465c1 rpc: new RPC implementation with pub/sub support 2015-12-14 16:34:05 +01:00
Felix Lange bfbcfbe4a9 all: fix license headers one more time
I forgot to update one instance of "go-ethereum" in commit 3f047be5a.
2015-07-23 18:35:11 +02:00
Felix Lange 3f047be5aa all: update license headers to distiguish GPL/LGPL
All code outside of cmd/ is licensed as LGPL. The headers
now reflect this by calling the whole work "the go-ethereum library".
2015-07-22 18:51:45 +02:00
Felix Lange 7662dd9bbb accounts: fix data race when key is locked after the unlock timeout
While here, also improve the docs and speed up the tests.
The tests used the scrypt keystore with ridiculous settins and took 20s
each.
2015-07-20 18:04:23 +02:00
zelig c3f5403b64 fix wallet key duplicate write - how did it get there? mystery. fixes #1411 2015-07-09 14:07:35 +01:00
Felix Lange bdae4fd573 all: add some godoc synopsis comments 2015-07-07 14:12:45 +02:00
Felix Lange e813626ee1 all: remove @author comments 2015-07-07 14:12:44 +02:00
Felix Lange ea54283b30 all: update license information 2015-07-07 14:12:44 +02:00
zelig 1959346793 account update: migrate or change password
* account.Update
* KeyStore.Cleanup
* fix dir rm for old format deleteKey
2015-07-03 07:52:37 +01:00
zelig fc17a527bc fix account ordering
* chronological order of creation
* new naming scheme keystore/UTC--<created_at UTC ISO8601>-<address hex>
* KeyStore2 -> KeyStore
* backward compatibility
* refactor keyStore methods
2015-07-03 03:19:32 +01:00
zelig fc2e33c594 unlock multiple passes and obsolete primary
* multiple passwords allowed in password file
* split on "\n", sideeffect: chop trailing slashes. fixes common mistake <(echo 'pass')
* remove accounts.Primary method
* do not fall back to primary account for mining
2015-07-02 23:28:11 +01:00
zelig 1d72aaa0cd simplify account unlocking 2015-07-02 23:28:11 +01:00
Bas van Kervel 1fa48bc5e7 Introduced default unlock duration when an account is unlocked from the console 2015-05-14 14:25:48 +02:00
Gustav Simonsson da9fe951da Use common.Address type for accounts.Address 2015-05-12 17:19:39 +02:00
zelig b375bbee5f settable etherbase
- etherbase flag for block reward destination
- coinbase => etherbase
- CLI- eth Config -> eth, xeth -> RPC / Miner
- use primary instead of coinbase as the unlock magic wildcard
- accounts: firstAddr/Coinbase -> Primary
2015-03-26 21:52:22 +00:00
zelig 7577d12614 max paranoia mode to UNsupport unencrypted keys entirely
- remove account export functionality from CLI
- remove accountExport method,
- remove unencrypted-keys flag from everywhere
- improve documentation
2015-03-26 19:00:18 +00:00
zelig 11d2ebc06f unlocking coinbase without knowing address
- accounts: remove Manager.getKey
- cli: for -unlock coinbase, use account manager Coinbase()
2015-03-26 19:00:18 +00:00
zelig d1b52efdb5 cli: implement ethereum presale wallet import via cli 2015-03-26 19:00:18 +00:00
zelig fd8d18ec28 unlocking coinbase
- extract accounts.getKey method - if given empty address it retrieves coinbase (first account)
- cli -unlock coinbase will unlock coinbase
2015-03-26 19:00:18 +00:00
zelig c4ea921876 import/export accounts
- cli: add passwordfile flag
- cli: change unlock flag only takes account
- cli: with unlock you are prompted for password or use passfile with password flag
- cli: unlockAccount used in normal client start (run) and accountExport
- cli: getPassword used in accountCreate and accountImport
- accounts: Manager.Import, Manager.Export
- crypto: SaveECDSA (to complement LoadECDSA) to save to file
- crypto: NewKeyFromECDSA added (used in accountImport and New = generated constructor)
2015-03-26 19:00:18 +00:00
Felix Lange 4ba7871374 accounts: return ErrNoKeys if key directory does not exist 2015-03-10 15:41:08 +01:00
Felix Lange 487f68ec48 accounts: add {Timed,}Unlock, remove SignLocked 2015-03-10 00:19:01 +01:00
Felix Lange c2e5dacf55 accounts: add Manager.HasAccount, delete Manager.Default 2015-03-09 23:08:46 +01:00
Felix Lange 6684ef201a accounts: don't store address in unlocked and add commentary
This was suggested during review.
2015-03-08 02:47:05 +01:00
Felix Lange fb53a9362e accounts: AccountManager -> Manager 2015-03-08 01:58:35 +01:00
Felix Lange 3750ec7b7d accounts: prevent early drops and zero keys in memory when dropping
Private keys would be locked early if SignLocked was called more than
once because the unlockLater was still running. Terminate it properly.
2015-03-08 01:44:15 +01:00
Felix Lange d6a7332993 accounts: fix uses of sync.RWMutex
RWMutexes must be write-locked when writing in order
to actually protect the writes.
2015-03-08 00:36:06 +01:00
Felix Lange afc530ea41 accounts: use time.Duration correctly
There is no point to using time.Duration if the value is interpreted as
milliseconds. Callers should use the standard multiplication idiom to
choose the unit. In fact, the only caller outside of the tests already
does so.
2015-03-08 00:35:23 +01:00
Felix Lange fda7b4c79d accounts: use pointers consistently
Account is now always a non-pointer. This will be important once
the manager starts remembering accounts.

AccountManager is now always a pointer because it contains locks
and locks cannot be copied.
2015-03-08 00:18:13 +01:00
Felix Lange d66f93cecd accounts, core, eth, xeth: use account manager for everything
The account manager is now responsible for picking the
default account and the coinbase.
2015-03-07 12:38:33 +01:00
obscuren 49ded3aa77 Merge branch 'develop' of github.com-obscure:ethereum/go-ethereum into develop
Conflicts:
	accounts/account_manager.go
2015-02-26 12:06:01 +01:00
obscuren 5ab0eaa06d wip 2015-02-26 11:14:54 +01:00
Gustav Simonsson 23f2658091 Remove unneeded initialisation of mutex 2015-02-25 19:30:57 +01:00
Gustav Simonsson d1311c53ee Address pull request comments
* Use RWMutex instead of Mutex
* Use time.Duration instead of int for unlock time
* Use time.After with select instead of time.Sleep
2015-02-25 18:40:59 +01:00
Gustav Simonsson b296b36d2b Add automatic locking / unlocking of accounts
* Change account signing API to two sign functions;
  Sign without passphrase - works if account is unlocked
  Sign with passphrase - always works and unlocks the account
* Account stays unlocked for X ms and is then automatically locked
2015-02-25 17:37:12 +01:00
Gustav Simonsson 923950ccaa Fix key store address hex decoding and accounts test
Thanks to https://github.com/jaekwon for original fix!
2015-02-24 18:05:10 +01:00
Gustav Simonsson 8d9752a557 Address pull request comments
* Use crypto.Sign instead of directly calling secp256k1 lib
* Rename UserAccount to Account and Addr to Address (for consistency)
* Change AccountManager.Sign to take ptr to Account instead of
  address byte array
* Simplify copying of Accounts in Accounts()
* PubkeyToAddress and GetEntropyCSPRNG now exported
2015-01-28 05:12:57 +01:00
Gustav Simonsson 512ffa2bf4 Add accounts package and refactor key stores
* Add initial UserAccount and AccountManager structs
* Add NewAccount, Sign and Accounts functions
* Refactor key stores to use key address as main identifier
  while keeping the UUID.
* Use key address as file/dir names instead of UUID
2015-01-26 04:30:17 +01:00