Commit graph

13 commits

Author SHA1 Message Date
Olaoluwa Osuntokun cb225e2add waddrmgr: add support for nested+regular witness key hash addresses
This commit introduces two new address types to the waddrmgr. The first
address type is the native p2wkh (pay-to-witness-key-hash) output type
introduced as part of BIP0141 and the segwit soft-fork. The second
address type is a p2wkh output nested *within* a regular p2sh output.
This second address allows older wallets which are not yet aware of the
new segwit output types to transparently pay to a wallet which does
support them. Additionally, using this nested p2wkh output the wallet
gains both the space+transaction fee savings, as well as the
malleability fixes.

Both address types have been implemented as special cases of the
ManagedPubKeyAddress since they share several traits, only
differentiating in the signing mechanism needed, and the concrete
implementation of btcutil.Address returned by the address.

Two new `addressType` constants have been added to waddrmgr’s db in
order to properly serialize and deserialize the new address types.
2018-05-23 19:38:56 -07:00
Josh Rickmar 5140086f6e Use LICENSE file and short license headers. 2016-02-28 22:22:34 -05:00
Dave Collins c820c8a015 Relicense to the btcsuite developers. 2015-05-01 12:20:05 -05:00
Javed Khan 74208f90c1 CurrentAddress: subsequently return new address 2015-04-16 06:34:25 +05:30
Javed Khan 85fe722e99 Mark used addresses as such 2015-03-11 01:23:46 +05:30
Josh Rickmar 4d9c43593d Consolidate and optimize zero functions.
This introduce a new internal package to deal with the explicit
clearing of data (such as private keys) in byte slices, byte arrays
(32 and 64-bytes long), and multi-precision "big" integers.

Benchmarks from a xeon e3 (Xor is the zeroing funcion which Bytes
replaces):

BenchmarkXor32  30000000                52.1 ns/op
BenchmarkXor64  20000000                91.5 ns/op
BenchmarkRange32        50000000                31.8 ns/op
BenchmarkRange64        30000000                49.5 ns/op
BenchmarkBytes32        200000000               10.1 ns/op
BenchmarkBytes64        100000000               15.4 ns/op
BenchmarkBytea32        1000000000               2.24 ns/op
BenchmarkBytea64        300000000                4.46 ns/op

Removes an XXX from the votingpool package.
2015-03-05 21:32:33 -05:00
Dave Collins b2ebd20d75 Update btcec path import paths to new location. 2015-02-06 11:06:45 -06:00
Dave Collins 4a1067b6f1 Update btcnet path import paths to new location. 2015-02-05 23:58:46 -06:00
Dave Collins 7db8ff3f9a Update btcec import paths to new location. 2015-01-16 18:08:45 -06:00
Dave Collins afeb509c45 Update btcutil import paths to new location. 2015-01-15 10:48:58 -06:00
Guilherme Salgado 24dcd206d2 Implement the deposit side of Voting Pools
This contains the APIs to create and retrieve Voting Pools and Series (with
public/private keys) from a walletdb namespace, plus the generation of deposit
addresses (using m-of-n multi-sig P2SH scripts according to the series
configuration).
2014-11-12 11:41:44 -06:00
Guilherme Salgado 85f4856230 Allow injection of crypto keys into the manager.
Useful to test error conditions.

Also provide a new function that wraps snacl.GenerateCryptoKey(),
defined as a variable so that it can be replaced in tests.
2014-10-13 16:19:11 -05:00
Dave Collins d0938d817f Provide new wallet address manager package.
This commit implements a new secure, scalable, hierarchical deterministic
wallet address manager package.

The following is an overview of features:

- BIP0032 hierarchical deterministic keys
- BIP0043/BIP0044 multi-account hierarchy
- Strong focus on security:
  - Fully encrypted database including public information such as
    addresses as well as private information such as private keys and
    scripts needed to redeem pay-to-script-hash transactions
  - Hardened against memory scraping through the use of actively clearing
    private material from memory when locked
  - Different crypto keys used for public, private, and script data
  - Ability for different passphrases for public and private data
  - Scrypt-based key derivation
  - NaCl-based secretbox cryptography (XSalsa20 and Poly1305)
  - Multi-tier scalable key design to allow instant password changes
    regardless of the number of addresses stored
- Import WIF keys
- Import pay-to-script-hash scripts for things such as multi-signature
  transactions
- Ability to export a watching-only version which does not contain any
  private key material
- Programmatically detectable errors, including encapsulation of errors
  from packages it relies on
- Address synchronization capabilities

This commit only provides the implementation package.  It does not
include integration into to the existing wallet code base or conversion of
existing addresses.  That functionality will be provided by future
commits.
2014-10-13 16:19:09 -05:00