Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rust-bitcoin/rust-wallet
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: LightningPeach/rust-wallet
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.

Commits on Nov 24, 2018

  1. implement synchronization with blockchain via bitcoind's rpcclient (#4)

    * implement synchronization with blockchain via bitcoind's rpcclient
    
    * implement transaction creation, signing and broadcasting
    
    * added grpc server, cli, rocksdb, block synchronization via bitcoind's ZMQ
    
    * enhance API, enable CI, follow some rust's guidelines
    
    * refactored communications with database
    
    * temporary disable grpc, move bitcoind communication in separate module, cut-off dependencies
    
    * created workspace, moved bitcoin core communication in separate crate
    
    * created separate crate rust-wallet-grpc
    evgeniy-scherbina authored and tamasblummer committed Nov 24, 2018
    Copy the full SHA
    246e0fa View commit details
  2. Copy the full SHA
    ff156fa View commit details

Commits on Dec 7, 2018

  1. cleanup server code (#5)

    * cleanup server code
    
    * added simple cli
    
    * Improved help for cli
    evgeniy-scherbina authored and tamasblummer committed Dec 7, 2018
    Copy the full SHA
    a4484bd View commit details

Commits on Dec 15, 2018

  1. initial efforts for electrumx client integration (#6)

    * initial efforts for electrumx client integration
    
    * made code more flexible; avoided code duplication in tests
    
    * avoided boilerplate code in tests with test's macro
    
    * now GrpcServer aggregates Wallet interface instead of certain implementation; added Electrumx + Grpc mode functional tests
    
    * added electrumx param to cli
    evgeniy-scherbina authored and tamasblummer committed Dec 15, 2018
    Copy the full SHA
    0ef5f38 View commit details

Commits on Mar 6, 2019

  1. implement bip39

    evgeniy.scherbina authored and Vladislav Melnik committed Mar 6, 2019
    Copy the full SHA
    b2ec846 View commit details

Commits on Mar 14, 2019

  1. add error case for wallet decrypt if no wallet exist

    Vladislav Melnik committed Mar 14, 2019
    Copy the full SHA
    9b2317f View commit details
  2. minor fix

    Vladislav Melnik committed Mar 14, 2019
    Copy the full SHA
    c469633 View commit details

Commits on Mar 21, 2019

  1. rename client to walletcli, update README.md

    Vladislav Melnik committed Mar 21, 2019
    Copy the full SHA
    c2c498b View commit details
  2. one more rename

    Vladislav Melnik committed Mar 21, 2019
    Copy the full SHA
    c777a2c View commit details
  3. update README.md

    Vladislav Melnik committed Mar 21, 2019
    Copy the full SHA
    e5866ed View commit details

Commits on Mar 26, 2019

  1. format all

    Vladislav Melnik committed Mar 26, 2019
    Copy the full SHA
    0c7cd40 View commit details
  2. Copy the full SHA
    df2e717 View commit details
  3. Copy the full SHA
    7c5577d View commit details
  4. added explicit dyn to Box type declaration

    Vladislav Melnik committed Mar 26, 2019
    Copy the full SHA
    53c0889 View commit details
  5. updated electrumx remote

    Vladislav Melnik committed Mar 26, 2019
    Copy the full SHA
    d134dc6 View commit details

Commits on Mar 29, 2019

  1. updated readme

    Vladislav Melnik committed Mar 29, 2019
    Copy the full SHA
    b7c4de6 View commit details
  2. refactor db randomness

    Vladislav Melnik committed Mar 29, 2019
    Copy the full SHA
    70e75e9 View commit details

Commits on Apr 1, 2019

  1. make error handling more verbose

    Vladislav Melnik committed Apr 1, 2019
    Copy the full SHA
    ccaa79f View commit details
  2. add proper blockchain io error handling

    Vladislav Melnik committed Apr 1, 2019
    Copy the full SHA
    6644fdb View commit details

Commits on Apr 8, 2019

  1. improve error message, fix LNP-1200

    Vladislav Melnik committed Apr 8, 2019
    Copy the full SHA
    e80bd96 View commit details

Commits on Apr 9, 2019

  1. refactor lib

    Vladislav Melnik committed Apr 9, 2019
    Copy the full SHA
    f4ec299 View commit details

Commits on Apr 15, 2019

  1. refactor, simplify, specify error type

    Vladislav Melnik committed Apr 15, 2019
    Copy the full SHA
    1edae61 View commit details
  2. minor fix

    Vladislav Melnik committed Apr 15, 2019
    Copy the full SHA
    a1f2a6f View commit details

Commits on Aug 7, 2019

  1. remove bitcoin_core_io; fix tests; change dependencies; update bitcoi…

    …n_rpc_client; fix warnings
    Vladislav Melnik committed Aug 7, 2019
    Copy the full SHA
    1af5d0c View commit details

Commits on Aug 8, 2019

  1. add wasm32 dummy storage

    Vladislav Melnik committed Aug 8, 2019
    Copy the full SHA
    e31ff32 View commit details
  2. increased delay to pass tests, TODO: rewrite tests

    Vladislav Melnik committed Aug 8, 2019
    Copy the full SHA
    43c4728 View commit details

Commits on Aug 12, 2019

  1. try to change dep access

    Vladislav Melnik committed Aug 12, 2019
    Copy the full SHA
    69c5620 View commit details

Commits on Aug 19, 2019

  1. implement store and get address

    Vladislav Melnik committed Aug 19, 2019
    Copy the full SHA
    1eda1b4 View commit details

Commits on Aug 26, 2019

  1. refactored tests

    Vladislav Melnik committed Aug 26, 2019
    Copy the full SHA
    0b842cd View commit details

Commits on Sep 24, 2019

  1. add coinbase test, currently it fails

    Vladislav Melnik committed Sep 24, 2019
    Copy the full SHA
    422e097 View commit details

Commits on Sep 25, 2019

  1. fix context for run on clear database

    Vladislav Melnik committed Sep 25, 2019
    Copy the full SHA
    77dd759 View commit details

Commits on Sep 26, 2019

  1. make electrs address configurable

    Vladislav Melnik committed Sep 26, 2019
    Copy the full SHA
    7b36e40 View commit details
  2. easy port configuring

    Vladislav Melnik committed Sep 26, 2019
    Copy the full SHA
    f7a348c View commit details
  3. update proto generated code

    Vladislav Melnik committed Sep 26, 2019
    Copy the full SHA
    c7b018a View commit details
  4. refactor context

    Vladislav Melnik committed Sep 26, 2019
    Copy the full SHA
    a7a3f60 View commit details
  5. add method to extract wallet from context

    Vladislav Melnik committed Sep 26, 2019
    Copy the full SHA
    4f78a2d View commit details
  6. rewrite wallet binary with structopt and new environment

    Vladislav Melnik committed Sep 26, 2019
    Copy the full SHA
    298699c View commit details

Commits on Sep 27, 2019

  1. stop processes

    Vladislav Melnik committed Sep 27, 2019
    Copy the full SHA
    f57660d View commit details
  2. fix tests

    Vladislav Melnik committed Sep 27, 2019
    Copy the full SHA
    24eaddb View commit details
  3. try to fix ci, remove obsolete dependencies

    Vladislav Melnik committed Sep 27, 2019
    Copy the full SHA
    f0982cd View commit details
  4. try to fix ci

    Vladislav Melnik committed Sep 27, 2019
    Copy the full SHA
    b9885ac View commit details
  5. try to fix ci

    Vladislav Melnik committed Sep 27, 2019
    Copy the full SHA
    6014ff0 View commit details
  6. freeze protobuf

    Vladislav Melnik committed Sep 27, 2019
    Copy the full SHA
    0a4ae9e View commit details
  7. freeze protobuf

    Vladislav Melnik committed Sep 27, 2019
    Copy the full SHA
    9b2642c View commit details
  8. fix build

    Vladislav Melnik committed Sep 27, 2019
    Copy the full SHA
    26e4f6d View commit details
  9. remove obsolete instruction

    Vladislav Melnik committed Sep 27, 2019
    Copy the full SHA
    34d584f View commit details

Commits on Sep 28, 2019

  1. add protoc to travis script

    Vladislav Melnik committed Sep 28, 2019
    Copy the full SHA
    192f11d View commit details
  2. use proper protoc in travis

    Vladislav Melnik committed Sep 28, 2019
    Copy the full SHA
    fdbef98 View commit details
38 changes: 38 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: 2

jobs:
build:
docker:
- image: circleci/rust
environment:
- ROCKSDB_LIB_DIR: /usr/lib

steps:
- checkout

- run:
name: debug
command: gcc --version

- run:
name: Install ZMQ
command: sudo apt-get update && sudo apt-get install -y libzmq3-dev libclang-4.0-dev

- run:
name: Install RocksDB
command: |
sudo ln -sf /usr/lib/gcc/x86_64-linux-gnu/6/include/stdarg.h /usr/include/stdarg.h
sudo ln -sf /usr/lib/gcc/x86_64-linux-gnu/6/include/stddef.h /usr/include/stddef.h
git clone https://github.com/facebook/rocksdb
cd rocksdb
git checkout v5.17.2
make shared_lib
sudo cp librocksdb.so* $ROCKSDB_LIB_DIR
- run:
name: Stable Build
command: RUST_BACKTRACE=1 cargo build

# - run:
# name: Test
# command: cargo test -- --test-threads=1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -2,3 +2,4 @@
/target
*.iml
Cargo.lock
rocks.db
39 changes: 39 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
sudo: required

language: rust
rust:
- 1.38.0

addons:
apt:
packages:
- libzmq3-dev
- build-essential

before_install:
- sudo apt-add-repository ppa:bitcoin/bitcoin -y
- sudo apt-get update -qq
- sudo apt-get install bitcoind -y
- CURRENT_DIR=$(pwd) &&
cd /tmp &&
curl -OL https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip &&
unzip protoc-3.3.0-linux-x86_64.zip -d protoc3 &&
sudo mv protoc3/bin/* /usr/local/bin/ &&
sudo mv protoc3/include/* /usr/local/include/ &&
cd $CURRENT_DIR
- CURRENT_DIR=$(pwd) &&
cd /tmp &&
git clone https://github.com/romanz/electrs &&
cd electrs &&
git checkout a61e1b3b7a150c52188fc7c412233068c156c56b &&
cargo install --debug --path . &&
cd $CURRENT_DIR
- ls $HOME/.cargo/bin

install:
- RUST_BACKTRACE=1 cargo build --no-default-features --verbose

script:
- RUST_BACKTRACE=1 cargo test --package rust-wallet-grpc --all-features -- --test-threads=1
- RUST_BACKTRACE=1 cargo run --package wallet --bin environment &
- RUST_BACKTRACE=1 cargo test --package wallet --all-features -- --test-threads=1 --nocapture
27 changes: 5 additions & 22 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
[package]
name = "wallet"
version = "0.1.0"
authors = ["Tamas Blummer <tamas.blummer@gmail.com>"]
license = "Apache-2.0"
homepage = "https://github.com/rust-bitcoin/rust-wallet/"
repository = "https://github.com/rust-bitcoin/rust-wallet/"
documentation = "https://github.com/rust-bitcoin/rust-wallet/"
description = "Wallet library for Bitcoin"
keywords = [ "crypto", "bitcoin" ]
readme = "README.md"
[workspace]

[dependencies]
bitcoin = "0.13"
secp256k1 = "0.9"
rust-crypto = "0.2"
log = "0.4"
simple_logger = "0.5"
rand = "0.5"

[dev-dependencies]
rustc-serialize = "0.3"
hex = "0.3"
members = [
"wallet",
"rust-wallet-grpc",
]
6 changes: 6 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
rust-wallet - Bitcoin wallet library
Copyright 2018 rust-wallet developers
This product includes software developed by
Tamas Blummer
Marc Kronberg
LightningPeach team, BitfuryGroup
71 changes: 70 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -12,7 +12,76 @@ I plan to add TREZOR and Ledger support.
This is work in progess, far from production quality.
It aims to serve parallel development of an SPV client and a Lightning Node.

## Basic Usage
Install `docker`, `docker-compose` and `rustup`.

Optionally install `electrumx`. Run in some `tmp` directory:
```
git clone https://github.com/romanz/electrs
cd electrs
git checkout a61e1b3b7a150c52188fc7c412233068c156c56b
cargo install --debug --path .
```

Launch `electrumx`:

```
electrs --network=regtest --jsonrpc-import --cookie=user:password --daemon-rpc-addr=127.0.0.1:18332
```

Install the wallet:
```
git clone https://github.com/LightningPeach/rust-wallet.git
cd rust-wallet/rust-wallet-grpc
cargo install --debug --path .
```

If the wallet already installed the last command should be:

```
cargo install --debug --force --path .
```

in order to rewrite the binary.

Launch the wallet:
```
docker-compose up
wallet
```

It is possible to run `wallet` with `electrumx`:
```
wallet --electrumx
```

See `wallet --help` for more information.

Generate some money to bitcoind and send to the wallet

```
docker exec -ti rust-wallet_bitcoind_1 sh
bitcoin-cli -regtest -rpcuser=user -rpcpassword=password generate 110
wallet-cli newaddress
bcrt1q3fnf5dll9cjuqxgw6l2nkez4mu6ktmn83ahd3q
bitcoin-cli -regtest -rpcuser=user -rpcpassword=password sendtoaddress bcrt1q3fnf5dll9cjuqxgw6l2nkez4mu6ktmn83ahd3q 1
bitcoin-cli -regtest -rpcuser=user -rpcpassword=password generate 1
wallet-cli sync_with_tip
wallet-cli walletbalance
100000000
```
Send money back to the bitcoind
```
bitcoin-cli -regtest -rpcuser=user -rpcpassword=password getnewaddress --address_type bech32
bcrt1qku9u0rtxy5t9uxnyp2nqt9z33ffxy6qhjlcz49
wallet-cli send_coins --dest_addr bcrt1qku9u0rtxy5t9uxnyp2nqt9z33ffxy6qhjlcz49 --amt 50000000 --submit
bitcoin-cli -regtest -rpcuser=user -rpcpassword=password generate 1
wallet-cli sync_with_tip
wallet-cli walletbalance
49990000
```

## Contributions and Vision
The goal is a library for key derivation, storage, serialization and account management.

Send in your PRs if aligned with above vision.
Send in your PRs if aligned with above vision.
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3.5'
services:
bitcoind:
image: lightningnetwork/bitcoind-alpine:0.16.1-r2
ports:
- "18332:18443"
- "18501:18501"
command: -regtest -printtoconsole -txindex -rpcallowip=0.0.0.0/0 -rpcuser=user -rpcpassword=password -zmqpubrawblock=tcp://0.0.0.0:18501 -zmqpubrawtx=tcp://0.0.0.0:18501
6 changes: 6 additions & 0 deletions run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -e

rm -r /tmp/test_* || true; cargo test $@ -- --test-threads=1
# rm -r /tmp/test_*; cargo test test_lock_coins_flag -- --ignored
37 changes: 37 additions & 0 deletions rust-wallet-grpc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[package]
name = "rust-wallet-grpc"
version = "0.1.0"
authors = ["evgeniy.scherbina <evgeniy.scherbina@bitfury.com>"]
edition = "2018"

[[bin]]
name = "wallet"
path = "src/main.rs"

[[bin]]
name = "wallet-cli"
path = "src/bin/client.rs"

[dependencies.bitcoin]
git = "https://github.com/LightningPeach/rust-bitcoin.git"
features = ["use-serde"]

[dependencies.bitcoin_hashes]
version = "0.7"
features = ["serde"]

[dependencies]
wallet = { path = "../wallet" }

grpc = "0.6.1"
protobuf = "2.8.1"
tls-api = "0.1"
tls-api-native-tls = "0.1"
bitcoin_rpc_client = { git = "https://github.com/LightningPeach/bitcoinrpc-rust-client.git", package = "bitcoincore-rpc" }
log = "0.4"
hex = "0.3"
structopt = "0.3"
simple_logger = "1.0"

[build-dependencies]
protoc-rust-grpc = "0.6.1"
27 changes: 27 additions & 0 deletions rust-wallet-grpc/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// Copyright 2018 rust-wallet developers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

extern crate protoc_rust_grpc;

fn main() {
protoc_rust_grpc::run(protoc_rust_grpc::Args {
out_dir: "src",
includes: &[],
input: &["src/walletrpc.proto"],
rust_protobuf: true, // also generate protobuf messages, not just services
..Default::default()
})
.expect("protoc-rust-grpc");
}
Loading