Commit graph

173 commits

Author SHA1 Message Date
Simon B
30a9c3db1e Improve errors that confuse new users (#467)
* Make Get coinbase via wallet API error more self-help friendly. Also show the wallet API URL that failed to respond.
* spelling and rustfmt nit
* more informational output from `grin server stop`
* newcomer friendly error when wallet.seed isn't found
* grin wallet (info|outputs): better error message
2017-12-12 04:56:48 +00:00
AntiochP
8e6f54779e
not sure how this ever worked... (#465) 2017-12-11 12:54:26 -05:00
AntiochP
001fd3789c
specify serde_json as "=1.0.7" to pin the version (#451) 2017-12-09 11:59:54 -05:00
Ignotus Peverell
68bb49dd61
Comment out unused for now 2017-12-07 19:12:27 +00:00
AntiochP
2f09d2e630
rollback the change output in the wallet on tx failure (#345) 2017-11-20 14:12:52 -05:00
Yeastplume
4b3a374d98
Wallet Restore feature (#338)
* beginning to add wallet restore... api endpoints and basic restore

* basic restore working, still missing features

* rustfmt

* large speed up to output search, should be more or less working

* properly mark coinbase status
2017-11-20 00:50:09 +00:00
AntiochP
2645b9ffba Eliminate gap between generating next key in wallet and saving output for this key (#302) 2017-11-18 02:31:02 -05:00
Yeastplume
45ee34d113 Wallet doesn't update local status until getting a 200 from receiver (#299) 2017-11-17 18:33:16 -05:00
AntiochP
f663340628
pass in max_transactions to wallet send/burn from grin.rs (#272) 2017-11-15 13:56:35 -05:00
AntiochP
9f7e047aeb
first block is 1 confirmation (#270) 2017-11-15 08:46:32 -05:00
Ignotus Peverell
6ac2fe2a8c
Major fee bump to come to more reasonable values
Starting on the higher side for testnet to see how it goes in
practice. Introduced constants for each smaller unit.
2017-11-14 20:14:07 -05:00
AntiochP
8269bdd873 Rework wallet coin selection to select a max of 500 outputs (#265) 2017-11-14 18:54:28 -05:00
Yeastplume
855602e98a
add flag to show spent outputs in wallet output command (#263) 2017-11-14 16:13:58 +00:00
AntiochP
04eb400422
add "smallest first" strategy for coin selection (#256) 2017-11-10 14:33:36 -05:00
AntiochP
8f33c7e0fe
cache key_id->derivation in the keychain (#253) 2017-11-10 10:12:15 -05:00
Yeastplume
b831192335
added wallet info/outputs commands with pretty printing (#254)
* added wallet info/outputs commands with pretty printing

* added confirmed but locked to display output
2017-11-10 14:03:31 +00:00
AntiochP
2238495d23
rename JSONPartialTx -> PartialTx (#252) 2017-11-09 15:42:19 -05:00
AntiochP
c1656f7660
use the static secp instance everywhere (except the wallet) (#250) 2017-11-09 14:26:45 -05:00
Yeastplume
5b47da907f
fixing issue where wallet outputs become spent when api server doesn't exist (#242) 2017-11-08 00:44:20 +00:00
Yeastplume
1eeb1fae22
Wallet amounts (#241)
* allow selecting a commit while providing a key index

* misnamed variable

* added static reference to libsecp that can be called throughout

* don't serialise rangeproof to json if it's not desired

* forgotten new file

* amounts input and displayed in wallet are now in full grins, with optional decimal place

* rustfmt

* merge branch

* better acknowledgement of transaction being sent
2017-11-07 21:20:36 +00:00
Yeastplume
48a60858ba Wallet output selection performance (#238)
* allow selecting a commit while providing a key index
* added static reference to libsecp that can be called throughout
* don't serialise rangeproof to json if it's not desired
2017-11-07 11:48:37 -05:00
AntiochP
17bf3c2702 default wallet receive to listen on 127.0.0.1 (#229)
* default wallet receive to listen on 127.0.0.1, optional flag on wallet command to listen on 0.0.0.0
* fix simulnet for new wallet port/interface config
2017-11-02 16:19:22 -04:00
AntiochP
9e36b820f6
fix the wallet receiver api (#222) 2017-11-01 14:32:34 -04:00
Ignotus Peverell
e4ebb7c7cb
Cleanup HTTP APIs, update ports to avoid gap, rustfmt
Moved the HTTP APIs away from the REST endpoint abstraction and
to simpler Hyper handlers. Re-established all routes as v1.
Changed wallet receiver port to 13415 to avoid a gap in port
numbers.

Finally, rustfmt seems to have ignored specific files arguments,
running on everything.
2017-10-31 19:42:56 -04:00
Yeastplume
05d22cb632
changing secp import to tag, and consolidating Cargo.toml import (#220) 2017-10-31 23:20:55 +00:00
Ignotus Peverell
283b846243
Small fix to chain tip check for send 2017-10-30 21:35:43 -04:00
AntiochP
8b324f7429 add retry logic to miner when hitting wallet coinbase API (#213)
* mount v2 router for flexibility, wallet checker now refreshes multiple outputs via single api call
* fix the api router
* wallet api handlers, miner uses wallet_client
* retry logic via tokio_retry, miner creates new coinbase output via wallet API (retries several times)
* move wallet client into wallet crateand rework the lock acquisition logic to use tokio_retry
2017-10-27 17:36:03 +00:00
AntiochP
68bcd79da5 height 0 means we have 0 confirmations (cut-through output?) (#211) 2017-10-26 17:41:08 +00:00
AntiochP
d7b94a12f5 only hold wallet write lock for write operations on the wallet (#210)
* mount v2 router for flexibility, wallet checker now refreshes multiple outputs via single api call
* add read_wallet so we can read without acquiring the lock
* fix the api router
* read wallet without acquiring or holding lock, only acquire the write lock for wallet when updating or adding outputs
2017-10-25 21:09:34 +00:00
AntiochP
7178b400b8 refresh multiple wallet outputs in single api call (#205)
* mount v2 router for flexibility - wallet checker now refreshes multiple outputs via single api call
* fix the api router
2017-10-25 17:57:48 +00:00
AntiochP
68cfbbecad "grin wallet init" to create the initial wallet.seed file (#198)
* "wallet init" to create the initial wallet.seed file
* cleanup and better error msgs
* add some basic wallet docs
* cleanup and make passphrase optional
2017-10-24 17:34:34 +00:00
Yeastplume
9c0411ac5e Bind to services to all interfaces rather than loopback (#197)
* changing default ip
2017-10-23 16:34:43 +00:00
AntiochP
4d7b46b0b9 wallet can now optionally spend zero-confirmation txs (#188)
* wallet can now optionally spend zero-confirmation txs
* add rule to get_mineable_transactions based on total pool size
2017-10-18 20:47:37 +00:00
AntiochP
c84a136e48 refactor burn key into key_overrides on keychain (#178)
* refactor burn key into key_overrides on keychain
* introduce UnconfirmedChange output status, we can potentially spend these with zero confirmations
* pass in burn_key_id for the burn enabled keychain, spend *all* coins when spending from a wallet, spend UnconfirmedChange coins also
* add comment about simplifying wallet_data.select logic
* replace UnconfirmedChange output status with a more flexible zero_ok, flag on the output data
2017-10-16 17:11:01 +00:00
Yeastplume
49797853d9 tweaks to logging configuration (#176)
* tweaks to logging configuration
* doc port update
2017-10-13 16:42:04 +00:00
AntiochP
86420d4bca Shorter identifiers and call them key_id (not pubkey) (#175)
* rename pubkey -> key_id, these are key identifiers, not public keys
* reduce identifier seize to 10 bytes, get rid of fingerprints (identifiers are now small enough to use as-is)
* IDENTIFIER_SIZE const
* add FeeDispute error for when sender and recipient disagre on fee calculation (should never happen)
* does not need to be mut
* cleaned up some warnings
2017-10-13 04:45:07 +00:00
Yeastplume
8e382a7593 slog-rs logging (#171)
* added global slog instance, changed all logging macro formats to include logger instance
* adding configuration to logging, allowing for multiple log outputs
* updates to test, changes to build docs
* rustfmt
* moving logging functions into util crate
2017-10-12 16:56:44 +00:00
Ignotus Peverell
b85006ebe5 Wallet operation to burn some coins (#172)
* Burn transaction for testing
* Burn bug fixes, embed burn key in keychain
* Better error logging in API, wallet fee calc fix
2017-10-12 03:35:40 +00:00
AntiochP
bf7c1fb44f add lock_height to Transaction and TxKernel (#167)
* add lock_height to Transaction and TxKernel, sign msg including both fee and lock_height in kernel
* make the order of the fields in tx and kernel more consistent
* rename to kernel_sig_msg
* add test to cover adding timelocked tx to pool, where tx is invalid based on current height of the blockchain
* add tests for adding timelocked txs to blocks (valid and otherwise)
2017-10-11 18:12:01 +00:00
AntiochP
dc0dbc62be Set approximate wallet fee to avoid LowFeeTransaction (#163)
Set approximate wallet fee when building a transaction so we avoid getting a LowFeeTransaction error from the pool

* rustfmt
2017-10-10 17:30:34 +00:00
AntiochP
62954f1549 Generate wallet key identifier from public key (#162) 2017-10-09 17:19:26 +00:00
AntiochP
3dd1dde00b Pass pubkey for coinbase (#159)
* store wallet output data in hashmap
* cleanup up commented out code
* pass pubkey/identifier and not derivation around to miner etc.
* fix failing tests
2017-10-07 17:38:41 +00:00
AntiochP
4e41365fe8 Fix duplicate wallet coinbase (#158)
* store wallet output data in hashmap
* cleanup up commented out and debug code
2017-10-06 20:10:30 +00:00
Ignotus Peverell
7012d37f5f
Half of fees get rewarded, half burnt. Minor cleanups
Update coinbase building and block summation to account for half of
the fees going to the coinbase. Forcing fees to be even as a
consequence. Now that we can't build the coinbase independently
from the block (because fees), had to update the miner to keep the
key derivation so a new derivation isn't made any time a new block
gets worked on.

Minor doc and warning cleanups.
2017-10-05 07:30:10 +00:00
AntiochP
677d0a3a95 keychain crate (no more secretkeys in core) (#146)
* introduce grin_keychain, encapsulate derivation of secret_keys
* core compiles against keychain, tests don't run yet
* core tests are now passing against keychain
* wip - getting wallet working with keychain
* add util and keychain to travis test matrix
* basic test around key derivation
2017-10-03 00:02:31 +00:00
AntiochP
2210e706f9 Add fee amount to wallet receive_transaction (mainly for testing purposes) (#150) 2017-10-01 21:56:19 +00:00
Ignotus Peverell
8504efb796
Cargo fmt all the things 2017-09-29 18:44:25 +00:00
AntiochP
8800d1339d Wallet: key fingerprint as string (#142)
* wallet key fingerprint as hex string
* use lowercase hex in util::to_hex for consistency with various crypto libs, add some tests for util::to_hex and util::from_hex
* filter wallet info based on ext_key fingerprint
* cleanup format for fingerprints and output status
2017-09-27 23:03:59 +00:00
AntiochP
0b26a57ca6 Remove rust-crypto dependency (#141)
Use blake2b in wallet for key derivation and key identifiers
2017-09-26 22:51:45 +00:00
AntiochP
7d48e1da49 Use util::from_hex and get rid of dependency on rust-serialize in wallet (#136) 2017-09-24 04:41:35 +00:00
AntiochP
670aa11e5a expose "wallet info" on CLI (#132)
* expose "wallet info" on CLI
* add sleep and retry logic when obtaining wallet.lock
* fix pool test for immature coinbase
2017-09-24 04:40:31 +00:00
AntiochP
a5b2c7d3f2 Introduce Identifier and Fingerprint to ExtendedKeys (#129) 2017-09-22 16:45:06 +00:00
AntiochP
dbc4e10cec Wallet now supports coinbase maturity (#130) 2017-09-22 16:44:12 +00:00
AntiochP
139af79509 wallet listens by default on 13416 (#128)
wallet should default to checking against node on port 13413
2017-09-21 21:12:07 +00:00
AntiochP
7c5b7d23e7 Replace secp256k1 directory with repository dependency (#126)
* workaround the "commitment is not a public key" problem by using to_two_keys() from rust-secp256k1-zkp
* remove secp256k1zkp, update the various Cargo.toml to use rust-secp256k1-zkp from external git repo, update code to not rely on to_pubkey (and use verify_from_commit)
* secp256k1zkp from git
* cleanup secp256k1 dependencies
* gitignore node1 and node2 dirs
2017-09-21 00:07:40 +00:00
AntiochP
fa339f3c0b fix up wallet tests (#101)
fix wallet tests
add test to verify input commitment == output commitment on spend
2017-08-22 23:05:56 +00:00
Yeastplume
b61c0607c2 Fix inconsistent wallet receiver port
Fixes #96
2017-08-18 23:01:19 +00:00
AntiochP
3b4a48b2fd Cleanup build warnings (#87)
* minor cleanup - unused imports
* cleanup build warnings - unused vars
* make structs pub to get rid of the private_in_public lint warning
* missing docs on RangeProof
* add missing docs to store delete function
* cleaned up deprecation warning -
tokio_core -> tokio_io
complete() -> send()
2017-08-10 00:54:10 +00:00
Yeastplume
1ede61d2a2 Addition of configuration file (#79)
* addition of configuration file to grin executable, instructions on how it's picked up are in grin.toml
* Starting to add a configuration file, and change some elements of configuration structures to make them more consistent
2017-07-13 17:30:33 +00:00
Yeastplume
5f8a0d9f1c Wallet HTTP posting, fixes and additions to port address configurability. (#66)
* Starting to refactor test, adding http post to wallet sender
* Implemented ability to run servers on different ports (mostly for testing), and implemented ability to post http requests directly to receiving wallets
* Adding detailed instructions on running multiple servers on the same machine
* Changes to build.doc to outline server running process
* Removed unwanted debug statements
* WIP Local server testing framework evolution
* More refactoring of server pool, checked in because there's a problem
* Added server reference structure, and ability to return server references from tests cleanly
* Added simulate_parallel_mining test, which puts some artificial slowdown into test mining loops, and the difficulty can currently be watched in the log
* Removing the ServerRef structure placed in earlier and replaced with a ServerStats structure, that just returns relevant info about the Server state without exposing it to the world
2017-06-27 04:09:01 +02:00
Yeastplume
a82f9ce415 Testing Framework [WIP] and new command line options to configure wallet ports and directories (#65)
* Beginning to refactor server tests
* Extended test framework to include running wallet servers and miners. Also some changes to the wallet reciever api to include a wallet config and set the data directly for the wallet file explicitly rather than assuming it's always in the working dir.
* Adding wallet config to main executable
* Adding ability to select wallet server while mining
* Configurable wallet receiver url
2017-06-16 18:47:29 +02:00
Ignotus Peverell
fbbd703e99
Protect wallet data file with a file lock
Operations on the wallet data file are now fenced by a lock to
avoid potentially messy concurrent modifications by multiple
processes (i.e. the wallet receiver and a send command). The lock
is done using a create-only lock file, which is an atomic
operation.
2017-06-14 21:42:58 -07:00
Ignotus Peverell
6523966f9e
Bug fixes in wallet and related API
Fixes a few loose ends in the full cycle of sending coins,
accepting them, pushing that transaction to the pool and having it
mined. More specifically:

* The API output endpoint needs to be a UTXO endpoint, as the
server can't make any guarantee about having a spent output.
* Bubbling up HTTP not found errors.
* Wallet output status checker now handles spent outputs.
* Transaction pool validates the transaction before accepting it.
* Fixed the operation API routes.
* Fixed too greedy wallet coin selection loop.
2017-06-12 16:41:27 -07:00
Ignotus Peverell
eb9cc7ef13
Integrate transaction pool with rest of the system
* Transactions coming from the network are now pushed to the pool
through the net adapter.
* New blocks accepted by the chain are sent to the pool for
eviction.
* The miner requests transactions from the pool to build its
blocks.
* The push API adds to the pool, removing the mock.
* Implementation of the adapter to the chain required by the pool
to get consistent UTXOs. Grossly unoptimized until we have the UTXO
MMR ready.
2017-06-10 12:51:33 -07:00
Ignotus Peverell
dd1339a9c3
Sending of transaction to push to mocked up API
Once the wallet transaction is fully built, serializing it and
sending the push request to a node. Implemented the push node
API, mocked up for now (until the tx pool is integrated).
2017-06-08 16:34:27 -07:00
Ignotus Peverell
d26a659a97
Command-line receiving end of wallet
Parse the partial transaction encoded in JSON, adding a new output
and finalizing. Should push the final tx to a grin node for
broadcast once that's fleshed out. Should also add an endpoint for
the http receiver.
2017-06-07 18:12:15 -07:00
Ignotus Peverell
aeb3dfc0dd
Minor cleanup and fixes for wallet send 2017-06-06 13:18:16 -07:00
Ignotus Peverell
92a2beedef
Missing file in #f79fb8ef 2017-05-31 15:52:43 -07:00
Ignotus Peverell
996eab72ae
Formatting. 2017-05-31 14:44:44 -07:00
Ignotus Peverell
f79fb8ef95
Sending end of the wallet
Most of the logic to build a transaction that sends coin to
another party. Still requires more debugging and clean up.
Main changes and additions are:

* Update to serde 1.0
* API endpoint to retrieve an Output
* Output is now Serialize and Deserialize
* Wallet configuration
* Command line for the send operation
* Wallet data checker to update created outputs into confirmed
* Wallet-specific configuration
2017-05-28 20:21:29 -07:00
Ignotus Peverell
791d2355ee
Miner querying wallet receiver for coinbase output
With the coinbase receiver daemon in place, when starting a Grin
server in mining mode, the miner will now ask the receiver for a
coinbase output. The output is then used to insert in a block when
successfully mined.
2017-05-25 17:22:21 -07:00
Ignotus Peverell
ac553493f1
WIP: Wallet functionality to receive and send coins
Beginning of a first pass at simple wallet functionalities so
Grin can be used to author transactions. We introduce a
receiving server, to be at least able to build coinbase outputs
that can be used by the mining daemon.

Present:

* Coinbase receiving API.
* Command to start the receiving server.
* Beginning of a transaction sending command.
* Improvements to the REST API abstractions to support the above.

Still to do:

* Change to the miner daemon to use the receiving server.
* A command line sender.
* API to receive any transaction (not just coinbase).
* A command line receiver.

Beyond that, HD derivation and seed generation are very simple
so far and almost certainly insecure. Just for testing for now.
2017-05-24 16:09:39 -07:00
Laurent Meunier
24b107bdf7 Create the beginning of the wallet library. (#36)
The wallet library will be used to manage the keys of the user. Currenty it only contains a minimal implementation of the extended keys. The format of the extended keys is subject to change
2017-04-29 13:58:26 -07:00