Commit Graph

162 Commits

Author SHA1 Message Date
Andrew Poelstra 7efde3ae47
Merge pull request #419 from elichai/2020-03-description
Deprecate Error::description
2020-05-23 17:26:38 +00:00
Elichai Turkel 654232a3dc
Deprecate Error::description 2020-04-13 02:15:28 +03:00
Elichai Turkel a473d01b17
Made some idiomatic changes 2020-03-29 17:15:15 +03:00
Elichai Turkel c19b736566
Remove the hex dependency 2020-01-20 18:50:02 +02:00
Dr Maxim Orlovsky d20ab1dbc4 Switching to XpubIdentifier 2020-01-01 13:46:44 +01:00
Dr Maxim Orlovsky 5f4f629bb1 Replaced all hash160, sha256 and sha256d with the new hash types throughout the code
Embedding Txid's in the doc exaples
2020-01-01 13:44:34 +01:00
Dr Maxim Orlovsky 5ef39e34fa Implementing (W)Pubkey/ScriptHash and BlockHash 2020-01-01 13:42:22 +01:00
Steven Roose 48f4c1989f
Rename bitcoin_hashes dependency to hashes 2019-08-16 15:52:27 +01:00
Steven Roose 09a65023a2
Add tests for p2shwpkh and p2shwsh 2019-08-15 22:29:09 +01:00
Steven Roose 170abaa82f
Use the new bech32 functions 2019-08-15 22:29:06 +01:00
Steven Roose 3a93f8522c
Format address module 2019-08-15 22:28:46 +01:00
Steven Roose 8de13a3915
Redo the BIP-173 test vectors
Before, non-version-zero segwit addresses were not included.
2019-08-15 22:28:27 +01:00
Steven Roose e469fec839
address: Drop error::Error::description impl 2019-08-15 22:28:25 +01:00
Steven Roose bfdcfee28e
Add Address::from_script constructor 2019-08-15 22:28:20 +01:00
Steven Roose 33e8ba3c7e
Extract roundtrip method from Address tests 2019-08-13 08:47:17 +01:00
Steven Roose 8804a41f1f
Add AddressType enum 2019-08-13 08:47:15 +01:00
Steven Roose 385a657974
Refactor Address
- use AddressError instead of encode::Error
- replace using bech32-bitcoin with Payload::WitnessProgram variant
2019-08-13 08:47:10 +01:00
Steven Roose 3c66418f3a
bip32: Add serde for Extended(Priv|Pub)Key 2019-07-26 15:30:44 +02:00
Andrew Poelstra 3b9a94a178 eliminate type parameter from the `Decodable` trait 2019-07-11 17:23:01 +00:00
Andrew Poelstra 24ebc29005 fix some recent rustc warnings 2019-07-11 15:01:38 +00:00
Andrew Poelstra cded694381
Merge pull request #277 from jonasnick/rand
Remove unused rand dependency
2019-07-03 20:42:44 +00:00
Steven Roose 30201f3924
Remove Decimal and replace strason with serde_json 2019-06-13 18:29:16 +01:00
Jonas Nick 94fba3aa88 Remove unused rand dependency 2019-06-10 13:59:31 +00:00
Carl Dong b3cc3d50ef Integrate newly-added PublicKey with Address
- Switch util::address::Payload::Pubkey variant to wrap
  util:🔑:PublicKey
- Switch util::address::Address::p*k* constructors to use
  util:🔑:PublicKey
- Fix tests for aforementioned switch
- Add convenience methods for util:🔑:PublicKey to
  util:🔑:PrivateKey conversion
- Switch BIP143 tests to use util:🔑:PublicKey
2019-02-11 15:10:13 -05:00
Steven Roose f80e882813
Remove Address::p2pk
There is no address format for p2pk.
2019-02-07 20:02:21 +00:00
ariard 51971dd533 Fix typos and clarify some comment in blockdata, block, address (#230) 2019-02-04 07:30:41 +01:00
Carl Dong 99f63a8ca4 Convert codebase from util::hash to bitcoin_hashes
Also replace unsafe transmute with call to read_u64_into
2019-01-24 16:27:52 -05:00
Dimitris Apostolou 132ca5ea95 Fix typos 2019-01-23 14:17:29 -05:00
Carl Dong ff5c4a1806 Bump secp to 0.12 2019-01-15 12:58:54 -05:00
Kaz Wesley 6b67c8cdff squashme: work around lack of associated constants 2018-11-11 14:58:33 -08:00
Jeff Barg 1c2564fc08 Added example for creating an address from a public key
Added an example to the address rustdoc (addresses https://github.com/rust-bitcoin/rust-bitcoin/issues/160)
2018-09-29 17:43:28 -04:00
Carl Dong 0f42ca69b0 Move relevant names into consensus::encode
- Move network::encodable::* to consensus::encode::*
- Rename Consensus{En,De}codable to {En,De}codable (now under
  consensus::encode)
- Move network::serialize::Error to consensus::encode::Error
- Remove Raw{En,De}coder, implement {En,De}coder for T: {Write,Read}
  instead
- Move network::serialize::Simple{En,De}coder to
  consensus::encode::{En,De}coder
- Rename util::Error::Serialize to util::Error::Encode
- Modify comments to refer to new names
- Modify files to refer to new names
- Expose {En,De}cod{able,er}, {de,}serialize, Params
- Do not return Result for serialize{,_hex} as serializing to a Vec
  should never fail
2018-09-25 21:19:35 +08:00
Steven Roose 8edfbec1cb Implement serde serialiation for Address 2018-09-11 18:37:36 +01:00
Andrew Poelstra a61ad5d382
Merge pull request #137 from dongcarl/2018-8-better-errors
Fix Error type for SimpleDecoder and SimpleEncoder
2018-08-22 00:55:54 +00:00
Andrew Poelstra d16fdd63d3
Merge pull request #141 from jeandudey/2018-08-display
Implement `Display` instead of `ToString` for `Address` and `PrivKey`.
2018-08-21 16:41:58 +00:00
Carl Dong e5b5cbfadb Fix Error type for SimpleDecoder and SimpleEncoder
- Separate serialize::Error and network::Error from util::Error
- Remove unneeded propagate_err and consume_err
- Change fuzzing code to ignore Err type
2018-08-21 01:58:40 -07:00
Jean Pierre Dudey df7f084e96 Implement `Display` instead of `ToString` for `Address` and `PrivKey`.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-20 19:46:56 -04:00
Andrew Poelstra 77e2fe3dda
Merge pull request #144 from jeandudey/2018-08-address-starts-with
trivial: Use `str::starts_with` method to check bech32 address prefixes.
2018-08-20 23:12:03 +00:00
Jean Pierre Dudey b78d7a7428 Use `str::starts_with` method to check bech32 address prefixes.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-20 18:11:14 -04:00
Jean Pierre Dudey 4dfb98bd70 Use `as_`,`to_`,`into_` conventions for array types.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-20 17:20:43 -04:00
Aleksei 356d13e465 Add some useful standard trait implementations 2018-08-20 12:11:17 +03:00
Jean Pierre Dudey b2594087db Use the `?` (try) instead of the `try!` macro.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-12 12:47:31 -04:00
Andrew Poelstra ebe5133d1a
Merge pull request #110 from D4nte/regtest
Regtest bech32 address support
2018-08-11 17:21:12 +00:00
Jean Pierre Dudey 77c185d9ec Fix modules documentation title.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-08 17:38:50 -04:00
Savil Srivastava 933dcaeb82 [code hygiene] remove deprecated rustc-serialize
Addresses #96.

Turns out it was being used for hex encoding/decoding, so replaced that with the `hex` crate.

i chose to import the `decode` method as:
```
use hex::decode as hex_decode
```

so that it is clear to the reader what is being decoded when it is called. "decode" is such a generic sounding function name that it would get confusing otherwise.
2018-07-26 09:49:15 -07:00
Franck Royer f05f831569 Regtest has a longer hrp, need to adjust length safety check 2018-07-26 17:06:35 +10:00
Franck Royer 0f31608796 Add support for bech32 regtest address format 2018-07-26 10:51:37 +10:00
Sebastian Geisler 00cca03edd use bitcoin-bech32 v0.8.0 and adapt internal API usage 2018-07-25 21:09:46 +02:00
Andrew Poelstra dd176b4177
Merge pull request #84 from popzxc/add-regtest
Added regtest network
2018-06-04 18:42:05 +00:00
Matt Corallo e2403a37fa Don't try to do a base58 checksum if an address is excessively long 2018-06-04 10:23:55 -04:00
Igor Aleksanov 34e228c699 Added regtest
Completed regtest integration to the code

Added tests for regtest

Get rid of panics
2018-05-29 12:21:41 +03:00
Matt Corallo 855b377d51 Fix crash in Address::from_str if input isn't long enough 2018-03-21 18:44:10 -04:00
Andrew Poelstra 64987e349c minor nits to get compilation to work on rustc 1.14 (currently shipping Debian version) 2018-03-21 18:49:46 +00:00
Tamas Blummer 1a87244b2b Implement Segwit addresses 2018-03-20 18:26:51 +01:00
Andrew Poelstra 65d8df08b8 address: implement Bech32 support 2018-03-13 14:48:01 +00:00
Andrew Poelstra ee1dfcf4a2 base58: remove Base58 traits, replace with encode/decode functions 2018-03-12 21:27:07 +00:00
Andrew Poelstra 066c49305f update secp256k1 to latest version with minimized dependencies 2018-02-20 16:19:29 +00:00
Andrew Poelstra a7c2dc6bb6 Add some accessors to the `Privkey` structure 2015-12-02 10:58:18 -06:00
Andrew Poelstra 66eb08aab5 [BREAKING CHANGE] Make `script::Builder` implement the actual Builder pattern
Rather than having methods taking &mut self, have them consume self
and return another Builder, so that methods can be chained.

Bump major version number.
2015-11-04 11:04:54 -06:00
Andrew Poelstra 38d2ef5d73 Add `from_script` method to Address for generating P2SH addresses 2015-10-14 22:24:09 -05:00
Andrew Poelstra c1f81ea3c3 Add support for WIF private keys as well as addresses 2015-10-14 19:25:43 -05:00
Andrew Poelstra 16e2a3519b Implement basic contract-hash support
Does not do stuff like validating the form of contracts, since this seems like
more of an application thing. Does not even distinguish a "nonce", just assumes
the contract has whatever uniqueness is needed baked in.
2015-10-14 15:29:19 -05:00