Steven Roose
750da89992
Bump bitcoin-bech32 dependency
...
This makes the Address::Payload::WitnessProgram inner type compatible
with rust-lightning-invoice's Fallback::SegWitProgram's inner type.
This allows specifying fallbacks from addresses.
2019-03-04 21:15:28 +00:00
Andrew Poelstra
d5c1200590
bump version to 0.17.1
2019-03-04 17:51:38 +00:00
Andrew Poelstra
c342bf3731
bump version to 0.17.0
2019-02-28 22:02:45 +00:00
Dr. Maxim Orlovsky
3c21e301aa
Better RawNewtorkMessage deserealization from IO stream ( #231 )
...
Follow-up to https://github.com/rust-bitcoin/rust-bitcoin/pull/229
While working with remote peers over the network it is required to deserealize RawNetworkMessage from `TCPStream` to read the incoming messages. These messages can be partial – or one TCP packet can contain few of them. To make the library usable for such use cases, I have implemented the required functionality and covered it with unit tests.
Sample usage:
```rust
fn run() -> Result<(), Error> {
// Opening stream to the remote bitcoind peer
let mut stream = TcpStream::connect(SocketAddr::from(([37, 187, 0, 47], 8333));
let start = SystemTime::now();
// Constructing and sending `version` message to get some messages back from the remote peer
let since_the_epoch = start.duration_since(UNIX_EPOCH)
.expect("Time went backwards");
let version_msg = message::RawNetworkMessage {
magic: constants::Network::Bitcoin.magic(),
payload: message::NetworkMessage::Version(message_network::VersionMessage::new(
0,
since_the_epoch.as_secs() as i64,
address::Address::new(receiver, 0),
address::Address::new(receiver, 0),
0,
String::from("macx0r"),
0
))
};
stream.write(encode::serialize(&version_msg).as_slice())?;
// Receiving incoming messages
let mut buffer = vec![];
loop {
let result = StreamReader::new(&mut stream, None).read_messages();
if let Err(err) = result {
stream.shutdown(Shutdown::Both)?;
return Err(Error::DataError(err))
}
for msg in result.unwrap() {
println!("Received message: {:?}", msg.payload);
}
}
}
```
Sample output is the following:
```
Received message: Version(VersionMessage { version: 70015, services: 1037, timestamp: 1548637162, receiver: Address {services: 0, address: [0, 0, 0, 0, 0, 65535, 23536, 35968], port: 33716}, sender: Address {services: 1037, address: [0, 0, 0, 0, 0, 0, 0, 0], port: 0}, nonce: 1370726880972892633, user_agent: "/Satoshi:0.17.99/", start_height: 560412, relay: true })
Received message: Verack
Received message: Alert([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 127, 0, 0, 0, 0, 255, 255, 255, 127, 254, 255, 255, 127, 1, 255, 255, 255, 127, 0, 0, 0, 0, 255, 255, 255, 127, 0, 255, 255, 255, 127, 0, 47, 85, 82, 71, 69, 78, 84, 58, 32, 65, 108, 101, 114, 116, 32, 107, 101, 121, 32, 99, 111, 109, 112, 114, 111, 109, 105, 115, 101, 100, 44, 32, 117, 112, 103, 114, 97, 100, 101, 32, 114, 101, 113, 117, 105, 114, 101, 100, 0])
```
Working sample code can be found here: https://github.com/dr-orlovsky/bitcoinbigdata-netlistener
2019-02-27 16:41:28 -05:00
Carl Dong
ca72a04dd4
Remove rust-crypto dependency
...
We no longer need rust-crypto after integrating bitcoin_hashes.
2019-01-24 16:27:52 -05:00
Carl Dong
b88f00c698
Add bitcoin_hashes dependency, rename some features
...
Because features and dependencies share the same namespace, and we want
to pass down the optional dependence on serde to bitcoin_hashes, we need
to rename the feature to something other than serde. Right now only
features can be passed down to dependencies.
Note that we could have also renamed the dependency to something like
serde-dep and kept the same feature name, however, dependency renaming
has only been available since cargo 0.27.0
Features that represent optional dependencies have been prefixed with
'use-'. The travis file has also been modified to conform to this
change.
2019-01-24 11:31:07 -05:00
Andrew Poelstra
21bd59cb17
Merge pull request #214 from apoelstra/2019-01-0.16
...
bump version to 0.16
2019-01-15 21:01:10 +00:00
Andrew Poelstra
b5d5ac5ffb
bump version to 0.16
2019-01-15 19:07:53 +00:00
Matt Corallo
2ed4b1f246
Merge pull request #208 from sgeisler/hex_bytes
...
Use more performant hex_bytes function
2019-01-15 14:06:00 -05:00
Carl Dong
ff5c4a1806
Bump secp to 0.12
2019-01-15 12:58:54 -05:00
Sebastian Geisler
4c29fc0e8d
Add feature gated hex decode benchmark
2019-01-07 17:49:55 -08:00
Tamas Blummer
bc5f78c170
upgrade byteorder to 1.2
2018-12-08 14:53:23 -08:00
Andrew Poelstra
05a00e31e1
update version to 0.15.1
2018-11-08 15:05:13 +00:00
Andrew Poelstra
1a3d3a3eef
bump version to 0.15
2018-11-03 15:42:20 +00:00
Andrew Poelstra
625eac636b
bump version to 0.14.2
2018-09-11 18:04:02 +00:00
Andrew Poelstra
b7c84a6571
increase version to 0.14.1
2018-08-28 17:15:37 +00:00
Andrew Poelstra
6d7a5f02c1
pin hex to 0.3.2 rather than a git commit
2018-08-22 22:11:46 +00:00
Andrew Poelstra
598afd94ca
bump version to 0.14.0
2018-08-22 21:18:39 +00:00
Andrew Poelstra
41ebf5468c
update rust-secp dependency to 0.11
2018-08-22 19:37:32 +00:00
Jean Pierre Dudey
1b4aba1d80
Update serde to 1.0 and strason to 0.4
...
The `serde_struct_impl!` macro has been modified to be compatible
with the serde 1.0 crate, we use this macro and not the `serde_derive`
crate because the latter doesn't support Rust 1.14.0 which is shipped
on Debian stable and we should remain compatible with it.
Two new features were added:
- "serde": enables serialization/deserialization for common types, it pulls
the serde 1.0 dependency.
- "serde-decimal": enables serialization/deserialization for `UDecimal`/`Decimal`,
this pulls the strason 0.4 depdendency and the serde 1.0 dependency.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-20 13:42:34 -04:00
Andrew Poelstra
94f3d4b0f9
update to secp256k1 0.10.0
2018-08-20 15:28:43 +00:00
Jean Pierre Dudey
f918311b8a
Remove unused "bitcoinconsenus" feature.
...
Also I've updated the feature name on the README.md, and fixed a typo in
src/blockdata/script.rs
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-12 16:06:06 -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
Sebastian Geisler
00cca03edd
use bitcoin-bech32 v0.8.0 and adapt internal API usage
2018-07-25 21:09:46 +02:00
Andrew Poelstra
5c753fb517
Bump version to 0.13.2
2018-06-16 22:55:27 +00:00
Andrew Poelstra
2db9aeab2d
bump version to 0.13.1
2018-06-04 19:29:59 +00:00
Andrew Poelstra
fb96ef0d0b
bump version to 0.13
2018-04-16 23:22:47 +00:00
Roman Zeyde
64bc5ede0e
Update documentation URL in Cargo.toml
2018-04-11 22:13:43 +03:00
Andrew Poelstra
85728d16a1
bump to 0.12
2018-03-23 15:27:56 +00:00
Matt Corallo
74cd941c83
Bump secp256k1 dep for older rustc
2018-03-21 18:44:10 -04:00
Matt Corallo
6826d8f35c
Stub out Sha2 calls when fuzzing to mask all but the first byte
2018-03-21 18:44:10 -04:00
Andrew Poelstra
22343fb023
Bump cargo version and travis to compile with 1.14
2018-03-21 20:38:15 +00:00
Andrew Poelstra
65d8df08b8
address: implement Bech32 support
2018-03-13 14:48:01 +00:00
Tamas Blummer
755fb454eb
integration with bitcoinconsenus
2018-03-12 17:17:16 +01:00
Andrew Poelstra
21f2baf58e
remove script interpreter
2018-03-09 20:30:11 +00:00
Andrew Poelstra
3a5773a698
update docs and github links for transfer to rust-bitcoin org
2018-03-05 19:44:44 +00:00
Andrew Poelstra
740d9e6fde
bump version number to 0.11
2018-02-20 16:19:33 +00:00
Andrew Poelstra
066c49305f
update secp256k1 to latest version with minimized dependencies
2018-02-20 16:19:29 +00:00
Andrew Poelstra
23a2c6bc9a
remove `jsonrpc` dependency by copying the macro we need into the source
2018-02-18 15:28:39 +00:00
Andrew Poelstra
e034ae6065
bump version to 0.10.9
2018-02-18 15:04:22 +00:00
Andrew Poelstra
d8babeddba
Bump version
2018-02-16 22:16:59 +00:00
Andrew Poelstra
f233fcac61
util: add `bip143` module to create BIP143 signature hashes
2018-01-15 17:54:32 +00:00
Andrew Poelstra
b3644b7b6d
add constants for OP_CLTV and OP_CSV
2017-12-21 01:10:00 +00:00
Andrew Poelstra
b7ec971541
update README to reflect 0.10, bump version to republish
2017-12-13 21:20:16 +00:00
Andrew Poelstra
406160a386
transaction: add txid() function that does the right thing for segwit/nonsegwit
...
With Segwit transactions `bitcoin_hash()` is no longer sufficient to get a txid.
2017-12-09 19:52:09 +00:00
Andrew Poelstra
c691d0e382
util: add Sha256dEncoder to allow streaming data into a hash
...
This is needed to for a sane BIP143 implementation. Should be exactly equivalent to
serializing data into a vector then hashing that vector for all types.
2017-12-06 16:50:47 +00:00
Andrew Poelstra
e5f109221e
script: add `to_p2wsh()` and `is_p2swsh()` functions to allow easy segwit output computation
2017-12-06 15:39:37 +00:00
Andrew Poelstra
46439710d9
script: add `is_p2pkh()` function
2017-10-06 19:15:30 +00:00
Andrew Poelstra
8f7bd858fb
update byteorder to 1.1 from 0.3
2017-07-28 16:19:44 +00:00
Aleksei Sidorov
2be08ccbae
Bump version
2017-07-28 17:36:43 +03:00
Aleksei Sidorov
bcd0d0480d
Fix vulnerabilities which found by `cargo audit`.
2017-07-28 13:34:07 +03:00
Andrew Poelstra
cdb452f79f
Sanity-check vector length when deserializing
2017-04-17 00:54:38 +00:00
Andrew Poelstra
fd37023312
Increase secp version; transitive version bump
...
Cleans up dependency graph.
2016-10-10 13:22:30 +00:00
Andrew Poelstra
02718be82f
Remove unused `num_cpus` dep
2016-10-10 13:09:40 +00:00
Andrew Poelstra
e3c793f702
uint: bugfix in trailing_zeroes()
2016-08-26 16:20:26 +00:00
Andrew Poelstra
af10b153be
segwit: add transaction/block serialization support for BIP141/BIP144; bump to 0.8
...
Do not yet support new sighash type
2016-08-24 16:24:55 +00:00
Demur Rumed
5dda3e2602
Replace time with std::time
2016-07-17 04:02:57 +00:00
Andrew Poelstra
93f103bdb5
script: fix broken push_int in script::Builder
2016-07-14 15:15:34 +00:00
Andrew Poelstra
14af175a11
Resurrect BIP32 support
2016-06-24 19:15:57 +00:00
Andrew Poelstra
698a23e32d
script: fix Debug impl bugs in Script, PUSHDATA1 not displayed correctly
2016-06-24 00:20:49 +00:00
Andrew Poelstra
1dbd1c28dc
Implement stdlib Error trait for util::Error type
2016-06-20 01:25:54 +00:00
Andrew Poelstra
50b3e90912
Rename Transaction::scripthash to Transaction::signature_hash
...
Yes, this is a major release because I misspelled the name of a function :)
2016-06-13 21:25:47 +00:00
Andrew Poelstra
220775015e
[BREAKING CHANGE] [v0.5 -> v0.6] Move nasty script stuff into a feature-gated module
2016-06-12 00:36:46 +00:00
Andrew Poelstra
46681bbcac
contracthash: expose key tweak in new function
...
Needed for applications where the tweak and the secret key material are on different
devices (and the one with the secret material does not want to know how to compute
the tweak itself).
2016-06-10 18:36:15 +00:00
Andrew Poelstra
6ccd157775
Add `into_vec` method to Script
2016-06-02 23:47:29 +00:00
Andrew Poelstra
35832e3da0
Remove some unused trait imports
2016-05-27 18:36:42 +00:00
Andrew Poelstra
30904b67a7
Derive Eq and friends for script::Instruction
2016-05-04 14:03:58 +00:00
Andrew Poelstra
96b4b050fd
Serialize Sha256Hash without allocations
2016-05-03 20:16:30 +00:00
Andrew Poelstra
f906c2fddd
Add `first_push_as_number` function to contracthash templates
...
This is a bit of a hack to let users of the contracthash API to determine
how many sigs are required when signing a multisig contract.
2016-03-29 17:24:34 +00:00
Andrew Poelstra
dce0cc65d2
Remove openssl dependency which trojanned itself in
2016-03-08 23:25:09 +00:00
Andrew Poelstra
f18157e774
Minor code changes for new rustc/clippy. No effects. Update minor version number
2016-02-18 19:44:29 +00:00
Andrew Poelstra
b88d04f0bc
Add serde impls for all Transaction types
...
Bump version number; introduce rust-jsonrpc dependency
2016-02-10 03:37:24 +00:00
Andrew Poelstra
56b7e7d3f4
Add ntxid support
2015-12-21 11:07:37 -06:00
Andrew Poelstra
16f5878a03
Add a bunch of Ord/PartialOrd impls for stuff
2015-12-20 15:38:02 -06:00
Andrew Poelstra
e05e6d2215
[BREAKING CHANGE] Drop UtxoSet
...
This code was unmaintained, is unlikely to work on the majority of systems
(since it holds the whole utxoset in RAM, and not in a terribly efficient
manner), and has a dependency on `eventual` which has been broken for a
long time.
The library no longer compiles on nightly because of this, and without any
known usecases for `UtxoSet`, nor good ability to test it, I'm simply
removing the code.
I recommend anyone who cares about this extracts the code from the previous
commit and creates a new crate. It should be more featureful anyway, e.g.
support a backing store.
2015-12-19 20:13:59 -06:00
Andrew Poelstra
8a79710be5
Bump version to 0.4.5 for recent changes
2015-12-03 07:14:22 -06:00
Andrew Poelstra
a8ffce4904
Fix Script de/serialization (version -> 0.4.4)
2015-11-30 07:11:24 -06:00
Julius Naperkowski
51f389e0b2
Bump minor version to 0.4.3
2015-11-23 18:31:50 +01:00
Andrew Poelstra
e58f536c31
Add `Decimal` type for de/serializing values
2015-11-22 10:51:19 -06:00
Andrew Poelstra
c3c6983789
Replace serde_json with strason in tests
2015-11-22 09:46:05 -06:00
Andrew Poelstra
fa59c35e9a
Upgrade libsecp
2015-11-15 17:14:36 -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
8daf06cc1d
Update for latest libsecp: normalize signatures and use "lax DER" parsing
2015-10-26 14:39:25 -05:00
Andrew Poelstra
67c0b8fba7
More Error implementations
2015-10-25 12:55:48 -05:00
Andrew Poelstra
a69ae2c7ad
Bump minor version no
2015-10-25 10:17:23 -05:00
Andrew Poelstra
3491c5057e
Make contracthashtool check that the number of keys matches the template's requirement
...
This is easy to satisfy given that the template-to-script code takes a
slice of keys. Just do &keys[..n_keys] if you have too many keys. (If
you have too few you're SOL no matter what.) This way we can catch
likely configuration errors without putting much of a burden on users
who legitimately have more keys than the template requires.
Also add a method required_keys() to Template so that users can check
how many keys they ought to have.
2015-10-25 08:37:32 -05:00
Andrew Poelstra
8defba2fb3
Expose ability to tweak secret keys for contract hash
2015-10-14 22:50:06 -05:00
Andrew Poelstra
fdc854edd9
Remove Script() from LowerHex impl of Script
...
This is easy for downstream to add, not easy for them to remove. Plus scripts
have a pretty recognizable form and are usually obvious from context anyway.
2015-10-14 22:31:12 -05:00
Andrew Poelstra
38d2ef5d73
Add `from_script` method to Address for generating P2SH addresses
2015-10-14 22:24:09 -05:00
Andrew Poelstra
ed34bb30f1
Add support for deserializing a script into a contracthash template
...
This is something Matt's contracthashtool does, so to copy its functionality
I need to support it. And it also seems generally useful.
2015-10-14 22:01:26 -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
Andrew Poelstra
dba71d9253
[BREAKING CHANGE] Minor library updates
...
Breaking changes are:
opcode::All::from_u8 is now From<u8>
script::Builder::from_vec is now From<Vec<u8>>
script::Script::from_vec is now From<Vec<u8>>
2015-10-14 09:14:09 -05:00
Andrew Poelstra
eeb4655886
More updates for RFC 1214
2015-09-20 16:44:05 -05:00
Andrew Poelstra
edb6d7b17b
Bump version to 0.2 for all the changes of the last two days
2015-09-20 16:40:46 -05:00
Andrew Poelstra
00421970a1
Fix for serde changes
2015-09-20 13:10:20 -05:00
Andrew Poelstra
835c8befae
Fix versions in Cargo.toml to try and fix Travis builds
2015-09-20 12:37:47 -05:00
Andrew Poelstra
2320f099c1
Remove broken wallet components
...
This was a fairly small change and gets all unit tests to pass.
2015-09-19 13:39:39 -05:00
Andrew Poelstra
0389eb1c52
Move secp256k1 lib from sipa's (long expired) repo to the bitcoin one
2015-05-20 13:14:21 -05:00
Andrew Poelstra
b21acd440e
Get compiling for secp256k1 changes
2015-04-13 22:40:32 -05:00