Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BDK wallet integration #110

Merged
merged 48 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
0c14162
chore: update gitignore to exclude Cargo files
evanlinjin Jan 9, 2024
681fd7e
bdkwallet: initial work on BDK wallet
evanlinjin Jan 9, 2024
b6c8493
main: enfore rust toolchain version
evanlinjin Jan 25, 2024
bf84ba8
bdkwallet: workaround for golang uniffi bug
evanlinjin Jan 25, 2024
e6462ab
main: add install cmd to rust build script
evanlinjin Jan 25, 2024
4d9198f
main: Add signet folder to .gitignore
evanlinjin Jan 26, 2024
c641c3f
bdkwallet: apply mempool, list txs & utxos
evanlinjin Jan 26, 2024
69e9dfb
bdkwallet: add docs for wallet.go
evanlinjin Jan 27, 2024
d5efac7
bdkwallet: improve logging
evanlinjin Jan 27, 2024
30f41ca
main,bdkwallet: implement safe startup logic for BDK wallet
evanlinjin Jan 27, 2024
74a1ee4
bdkwallet: implement conditional building
evanlinjin Jan 29, 2024
aeb2485
bdkwallet: fix confirmations logic + docs
evanlinjin Jan 29, 2024
a5f0b10
main: add Makefile
evanlinjin Jan 29, 2024
5e90099
main: don't run linter on generated files
kcalvinalvin Jan 29, 2024
675027c
bdkwallet: export Wallet and add comments
kcalvinalvin Jan 30, 2024
4e6fc6f
main: clarify that we do handle wallet commands, just not btcwallet
kcalvinalvin Jan 30, 2024
ccfca83
main: add bdkwallet to the rpcserver
kcalvinalvin Jan 30, 2024
8ae10ac
btcjson: add support for unusedaddress command
kcalvinalvin Jan 30, 2024
6fea917
btcjson: add bdkaddressresult
kcalvinalvin Jan 30, 2024
4c8dad1
main: add unusedaddress support to rpcserver
kcalvinalvin Jan 30, 2024
0f7709b
btcjson: add support for freshaddress command
kcalvinalvin Jan 30, 2024
b8852fb
main: add freshaddress support to rpcserver
kcalvinalvin Jan 30, 2024
caccd7d
btcjson: add peekaddress command
kcalvinalvin Jan 30, 2024
6bbf5dc
main: add peekaddress command support to rpcserver
kcalvinalvin Jan 30, 2024
9d2b740
btcjson: add support for balance command
kcalvinalvin Jan 30, 2024
545bba0
main: add balance command support to the rpcserver
kcalvinalvin Jan 30, 2024
1662863
main: add bdkwallet tag on the tests
kcalvinalvin Jan 30, 2024
d99cdcb
btcjson: add support for createtransactionfrombdkwallet command
kcalvinalvin Jan 30, 2024
140dd4b
btcjson: add support for createtransactionfrombdkwalletresult
kcalvinalvin Jan 31, 2024
9256bb1
main: add createtransactionfrombdkwallet support to rpcserver
kcalvinalvin Jan 30, 2024
e5711d6
bdkwallet: pass in human-readable address to rust
evanlinjin Jan 30, 2024
ffd9a72
btcjson: add getmnemonicwords command
kcalvinalvin Jan 31, 2024
69f00b6
main: add getmnemonicwords command to rpcserver
kcalvinalvin Jan 31, 2024
48a5385
btcjson: add listbdktransactions command
kcalvinalvin Jan 31, 2024
46788c9
btcjson: add support for listbdktransactions result
kcalvinalvin Jan 31, 2024
18369f1
main: add support for listbdktransactions command in rpcserver
kcalvinalvin Jan 31, 2024
65f5618
main: notify bdkwallet and watchonly wallet for rpcserver
kcalvinalvin Jan 31, 2024
c2836bd
bdkwallet: general fixup
kcalvinalvin Jan 31, 2024
964d572
main: fix Makefile
evanlinjin Jan 31, 2024
9398196
bdkwallet: update BDK
evanlinjin Jan 31, 2024
66df88b
btcjson: add support for rebroadcastunconfirmedbdktxs
kcalvinalvin Jan 31, 2024
848b261
main: add support for rebroadcastunconfirmedbdktxs command
kcalvinalvin Jan 31, 2024
ba14596
main: change handleCreateTransactionFromBDKWallet to send txs to
kcalvinalvin Feb 1, 2024
23ec5ad
btcjson: add support for listbdkutxos
kcalvinalvin Feb 1, 2024
779ca92
main: add listbdkutxos support to rpc
kcalvinalvin Feb 1, 2024
3a96310
bdkwallet: reverse hashes
kcalvinalvin Feb 1, 2024
5103c9e
main: enable bdkwallet if the wallet exists
kcalvinalvin Feb 1, 2024
8bdc980
main: make bdk wallet enabled by default
kcalvinalvin Feb 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ jobs:
strategy:
matrix:
go: ["1.20", "1.21"]
rust:
- version: stable
clippy: true
- version: 1.72.0 # As specified in rust-toolchain
steps:
- uses: actions/checkout@v3

Expand All @@ -21,11 +25,18 @@ jobs:
with:
go-version: ${{ matrix.go }}

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust.version }}
override: true
profile: minimal

- name: Build
run: go build -v ./...
run: make all

- name: Install Linters
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2

- name: Test
run: sh ./goclean.sh
run: make test
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,10 @@ profile.tmp
profile.cov

utreexod

# Cargo
target/
Cargo.lock

# Running stuff
/signet
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[workspace]

members = [
"bdkwallet/bdkgo_crate",
]

resolver = "2"
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
help: ## Display help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

install-rust: ## Install rust if not installed
if ! type cargo; then curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ; fi

install-uniffi-bindgen-go: install-rust ## Install uniffi-bindgen-go if not installed
if ! type uniffi-bindgen-go; then cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.0+v0.25.0 ; fi

build-bdk: install-uniffi-bindgen-go ## Build BDK static library
uniffi-bindgen-go -o bdkwallet bdkwallet/bdkgo_crate/src/bdkgo.udl
cargo build --release

build-utreexod: build-bdk ## Build utreexod with all features
go build --tags=bdkwallet -o . ./...

build-utreexod-without-bdk: ## Build utreexod without BDK wallet
go build -o . ./...

test: build-bdk ## Run all test
cargo test
sh ./goclean.sh

all: build-bdk build-utreexod ## Build all

clean: ## Clean all
rm utreexod
go clean
cargo clean
8 changes: 8 additions & 0 deletions bdkwallet/bdkgo/bdkgo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <bdkgo.h>

// This file exists beacause of
// https://github.com/golang/go/issues/11263

void cgo_rust_task_callback_bridge_bdkgo(RustTaskCallback cb, const void * taskData, int8_t status) {
cb(taskData, status);
}
Loading
Loading