diff --git a/Cargo.lock b/Cargo.lock index 35b5650..a71aa90 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,42 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aead" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" +dependencies = [ + "generic-array", +] + +[[package]] +name = "aes" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +dependencies = [ + "cfg-if 1.0.0", + "cipher", + "cpufeatures", + "opaque-debug", +] + +[[package]] +name = "aes-gcm-siv" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589c637f0e68c877bbd59a4599bbe849cac8e5f3e4b5a3ebae8f528cd218dcdc" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "polyval", + "subtle", + "zeroize", +] + [[package]] name = "ahash" version = "0.4.8" @@ -135,25 +171,6 @@ dependencies = [ "byteorder", ] -[[package]] -name = "bdk" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7e8fe57edea4e7d6edcb90171060596a02175d349ff057115e1927dc6b0d3a" -dependencies = [ - "async-trait", - "bdk-macros 0.5.0", - "bitcoin 0.27.1", - "electrum-client 0.8.0", - "js-sys", - "log 0.4.20", - "miniscript 6.1.0", - "rand 0.7.3", - "serde 1.0.193", - "serde_json 1.0.108", - "sled", -] - [[package]] name = "bdk" version = "0.13.0" @@ -161,30 +178,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f687a9504efaa1650148b9e891b4c111adb31ceeb9011dec578941b00f18c9f" dependencies = [ "async-trait", - "bdk-macros 0.6.0", + "bdk-macros", "bitcoin 0.27.1", "electrum-client 0.8.0", "js-sys", "log 0.4.20", "miniscript 6.1.0", "rand 0.7.3", - "serde 1.0.193", - "serde_json 1.0.108", + "serde", + "serde_json", "sled", "tokio", ] -[[package]] -name = "bdk-macros" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3f510015e946c5995cc169f7ed4c92ba032bbce795c0956ee0d98d82f7aff78" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "bdk-macros" version = "0.6.0" @@ -198,15 +204,15 @@ dependencies = [ [[package]] name = "bech32" -version = "0.7.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dabbe35f96fb9507f7330793dc490461b2962659ac5d427181e451a623751d1" +checksum = "cf9ff0bbfd639f15c74af777d81383cf53efb7c93613f6cab67c6c11e05bbf8b" [[package]] name = "bech32" -version = "0.8.1" +version = "0.10.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9ff0bbfd639f15c74af777d81383cf53efb7c93613f6cab67c6c11e05bbf8b" +checksum = "98f7eed2b2781a6f0b5c903471d48e15f56fb4e1165df8a9a2337fd1a59d45ea" [[package]] name = "bindgen" @@ -233,57 +239,66 @@ dependencies = [ [[package]] name = "bip39" -version = "1.2.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29b9e657de8ff1c3488a4ab77cb51d604eab53415ce34f0bc800f2eac9b13c28" +checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f" dependencies = [ "bitcoin_hashes 0.11.0", - "rand_core 0.4.2", - "serde 1.0.193", + "serde", "unicode-normalization", ] [[package]] name = "bitcoin" -version = "0.26.2" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6742ec672d3f12506f4ac5c0d853926ff1f94e675f60ffd3224039972bf663f1" +checksum = "9a41df6ad9642c5c15ae312dd3d074de38fd3eb7cc87ad4ce10f90292a83fe4d" dependencies = [ - "bech32 0.7.3", - "bitcoin_hashes 0.9.7", - "secp256k1", - "serde 1.0.193", + "base64-compat", + "bech32 0.8.1", + "bitcoin_hashes 0.10.0", + "secp256k1 0.20.3", + "serde", ] [[package]] name = "bitcoin" -version = "0.27.1" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a41df6ad9642c5c15ae312dd3d074de38fd3eb7cc87ad4ce10f90292a83fe4d" +checksum = "fd00f3c09b5f21fb357abe32d29946eb8bb7a0862bae62c0b5e4a692acbbe73c" dependencies = [ - "base64-compat", - "bech32 0.8.1", - "bitcoin_hashes 0.10.0", - "secp256k1", - "serde 1.0.193", + "base64 0.21.5", + "bech32 0.10.0-beta", + "bitcoin-internals", + "bitcoin_hashes 0.13.0", + "hex-conservative", + "hex_lit", + "secp256k1 0.28.2", + "serde", ] [[package]] -name = "bitcoin_hashes" -version = "0.9.7" +name = "bitcoin-internals" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ce18265ec2324ad075345d5814fbeed4f41f0a660055dc78840b74d19b874b1" +checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" dependencies = [ - "serde 1.0.193", + "serde", ] +[[package]] +name = "bitcoin-private" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73290177011694f38ec25e165d0387ab7ea749a4b81cd4c80dae5988229f7a57" + [[package]] name = "bitcoin_hashes" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "006cc91e1a1d99819bc5b8214be3555c1f0611b169f527a1fdc54ed1f2b745b0" dependencies = [ - "serde 1.0.193", + "serde", ] [[package]] @@ -292,6 +307,17 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4" +[[package]] +name = "bitcoin_hashes" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" +dependencies = [ + "bitcoin-internals", + "hex-conservative", + "serde", +] + [[package]] name = "bitflags" version = "0.9.1" @@ -339,8 +365,8 @@ dependencies = [ name = "btctipserver-bitcoin" version = "0.1.1-dev" dependencies = [ - "bdk 0.13.0", - "bdk-macros 0.6.0", + "bdk", + "bdk-macros", "dirs-next", "percent-encoding", "rust-ini", @@ -355,8 +381,8 @@ dependencies = [ "dirs-next", "lnsocket", "random-string", - "secp256k1-sys", - "serde_json 1.0.108", + "secp256k1-sys 0.4.1", + "serde_json", "structopt", ] @@ -365,12 +391,12 @@ name = "btctipserver-liquid" version = "0.1.1-dev" dependencies = [ "dirs-next", - "edk", "hex", + "lwk_wollet", "reqwest", - "serde 1.0.193", + "serde", "serde_derive", - "serde_json 1.0.108", + "serde_json", "structopt", ] @@ -429,6 +455,15 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cca491388666e04d7248af3f60f0c40cfb0991c72205595d7c396e3510207d1a" +[[package]] +name = "cipher" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +dependencies = [ + "generic-array", +] + [[package]] name = "clang-sys" version = "1.6.1" @@ -480,6 +515,15 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.3.2" @@ -511,6 +555,15 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "ctr" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +dependencies = [ + "cipher", +] + [[package]] name = "deranged" version = "0.3.9" @@ -550,28 +603,6 @@ dependencies = [ "rand 0.8.5", ] -[[package]] -name = "dtoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" - -[[package]] -name = "edk" -version = "0.1.0" -source = "git+https://github.com/lvaccaro/edk.git#ca06a37312a00371526a8e1da8d3ee845ebc603a" -dependencies = [ - "bdk 0.11.0", - "bip39", - "bitcoin 0.27.1", - "electrum-client 0.7.0", - "elements", - "elements-miniscript", - "miniscript 5.2.0", - "serde 1.0.193", - "serde_json 1.0.108", -] - [[package]] name = "either" version = "1.9.0" @@ -580,59 +611,59 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "electrum-client" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cab4d90cc575a7daab4cfed9e315912a88071bc47462e6be57516a2f01ccc89" +checksum = "edd12f125852d77980725243b2a8b3bea73cd4c7a22c33bc52b08b664c561dc7" dependencies = [ - "bitcoin 0.26.2", + "bitcoin 0.27.1", "log 0.4.20", - "rustls", - "serde 1.0.193", - "serde_json 1.0.108", + "rustls 0.16.0", + "serde", + "serde_json", "socks", "webpki", - "webpki-roots", + "webpki-roots 0.19.0", ] [[package]] name = "electrum-client" -version = "0.8.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edd12f125852d77980725243b2a8b3bea73cd4c7a22c33bc52b08b664c561dc7" +checksum = "89008f106be6f303695522f2f4c1f28b40c3e8367ed8b3bb227f1f882cb52cc2" dependencies = [ - "bitcoin 0.27.1", + "bitcoin 0.31.1", + "byteorder", + "libc", "log 0.4.20", - "rustls", - "serde 1.0.193", - "serde_json 1.0.108", - "socks", - "webpki", - "webpki-roots", + "rustls 0.21.10", + "serde", + "serde_json", + "webpki-roots 0.25.4", + "winapi 0.3.9", ] [[package]] name = "elements" -version = "0.18.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa776445bd0ef9b30eab2e7c09cacc3a545e0502c178fdca9c4c6d80f738d519" +checksum = "dd6b8388053196e6b2702a45418078a654680ce9e1fd91799f51f67a40118ff5" dependencies = [ - "bitcoin 0.27.1", - "bitcoin_hashes 0.10.0", + "bitcoin 0.31.1", "secp256k1-zkp", - "serde 1.0.193", - "serde_json 0.9.10", - "slip21", + "serde", + "serde_json", ] [[package]] name = "elements-miniscript" -version = "0.1.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfc1fe1025a4d64d76bcc479685610a2d9c4903fdb1eb72c8bf4c2d1b3dbdc1a" +checksum = "73842aeed05c6d62a985672f651914080e6f1cedced5ea194405f5b5f838f6dd" dependencies = [ - "bitcoin 0.27.1", + "bitcoin 0.31.1", "elements", - "miniscript 6.1.0", + "miniscript 11.0.0", + "serde", ] [[package]] @@ -670,7 +701,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -679,11 +710,11 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b1a357c911c352439b460d7b375b5c85977b9db395b703dfee5a94dfb4d66a2" dependencies = [ - "num-traits 0.2.17", + "num-traits", "rand 0.6.5", "rustc_version", "semver", - "serde 1.0.193", + "serde", ] [[package]] @@ -815,6 +846,16 @@ dependencies = [ "byteorder", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + [[package]] name = "getrandom" version = "0.1.16" @@ -870,6 +911,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "half" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" + [[package]] name = "hashbrown" version = "0.9.1" @@ -915,13 +962,25 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hex-conservative" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ed443af458ccb6d81c1e7e661545f94d3176752fb1df2f543b902a1e0f51e2" + +[[package]] +name = "hex_lit" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd" + [[package]] name = "home" version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" dependencies = [ - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -932,7 +991,7 @@ checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ "bytes", "fnv", - "itoa 1.0.9", + "itoa", ] [[package]] @@ -979,7 +1038,7 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 1.0.9", + "itoa", "pin-project-lite", "socket2 0.4.10", "tokio", @@ -1012,6 +1071,16 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "indexmap" version = "2.1.0" @@ -1037,12 +1106,6 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" -[[package]] -name = "itoa" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c" - [[package]] name = "itoa" version = "1.0.9" @@ -1160,6 +1223,42 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +[[package]] +name = "lwk_common" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1618672164c32e60f0e0fa80a6077a8735444c8067bff7328b1ca452051d9d4" +dependencies = [ + "elements", + "elements-miniscript", + "rand 0.8.5", + "thiserror", +] + +[[package]] +name = "lwk_wollet" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c904c1a05b71f46adea3cc59c623c400b63dfb40d0f3a95dc65598316846b00" +dependencies = [ + "aes-gcm-siv", + "bip39", + "electrum-client 0.19.0", + "elements", + "elements-miniscript", + "idna 0.4.0", + "lwk_common", + "minreq", + "once_cell", + "rand 0.8.5", + "regex", + "serde", + "serde_cbor", + "serde_json", + "thiserror", + "tracing", +] + [[package]] name = "matches" version = "0.1.10" @@ -1195,12 +1294,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - [[package]] name = "memchr" version = "2.6.4" @@ -1230,21 +1323,23 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniscript" -version = "5.2.0" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88f86e13e20f1a774a85261e80e4410315fcb1604ed2b43a729286def43bc3e3" +checksum = "1e292b58407dfbf1384e5aca8428d3b0f2eaa09d24cb17088f6db0b7ca31194a" dependencies = [ - "bitcoin 0.26.2", + "bitcoin 0.27.1", + "serde", ] [[package]] name = "miniscript" -version = "6.1.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e292b58407dfbf1384e5aca8428d3b0f2eaa09d24cb17088f6db0b7ca31194a" +checksum = "86a23dd3ad145a980e231185d114399f25a0a307d2cd918010ddda6334323df9" dependencies = [ - "bitcoin 0.27.1", - "serde 1.0.193", + "bech32 0.10.0-beta", + "bitcoin 0.31.1", + "bitcoin-internals", ] [[package]] @@ -1256,6 +1351,21 @@ dependencies = [ "adler", ] +[[package]] +name = "minreq" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb3371dfc7b772c540da1380123674a8e20583aca99907087d990ca58cf44203" +dependencies = [ + "log 0.4.20", + "once_cell", + "rustls 0.21.10", + "rustls-webpki", + "serde", + "serde_json", + "webpki-roots 0.25.4", +] + [[package]] name = "mio" version = "0.8.10" @@ -1264,7 +1374,7 @@ checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1295,15 +1405,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "num-traits" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" -dependencies = [ - "num-traits 0.2.17", -] - [[package]] name = "num-traits" version = "0.2.17" @@ -1338,6 +1439,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "openssl" version = "0.10.61" @@ -1413,7 +1520,7 @@ dependencies = [ "instant", "libc", "redox_syscall 0.2.16", - "smallvec 1.11.2", + "smallvec", "winapi 0.3.9", ] @@ -1447,6 +1554,18 @@ version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +[[package]] +name = "polyval" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "opaque-debug", + "universal-hash", +] + [[package]] name = "powerfmt" version = "0.2.0" @@ -1797,8 +1916,8 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "serde 1.0.193", - "serde_json 1.0.108", + "serde", + "serde_json", "serde_urlencoded", "system-configuration", "tokio", @@ -1820,12 +1939,27 @@ dependencies = [ "cc", "libc", "once_cell", - "spin", - "untrusted", + "spin 0.5.2", + "untrusted 0.7.1", "web-sys", "winapi 0.3.9", ] +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if 1.0.0", + "getrandom 0.2.11", + "libc", + "spin 0.9.8", + "untrusted 0.9.0", + "windows-sys 0.52.0", +] + [[package]] name = "rust-ini" version = "0.16.1" @@ -1867,7 +2001,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1878,11 +2012,33 @@ checksum = "b25a18b1bf7387f0145e7f8324e700805aade3842dd3db2e74e4cdeb4677c09e" dependencies = [ "base64 0.10.1", "log 0.4.20", - "ring", - "sct", + "ring 0.16.20", + "sct 0.6.1", "webpki", ] +[[package]] +name = "rustls" +version = "0.21.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" +dependencies = [ + "log 0.4.20", + "ring 0.17.8", + "rustls-webpki", + "sct 0.7.1", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring 0.17.8", + "untrusted 0.9.0", +] + [[package]] name = "ryu" version = "1.0.15" @@ -1895,7 +2051,7 @@ version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1910,8 +2066,18 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" dependencies = [ - "ring", - "untrusted", + "ring 0.16.20", + "untrusted 0.7.1", +] + +[[package]] +name = "sct" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +dependencies = [ + "ring 0.17.8", + "untrusted 0.9.0", ] [[package]] @@ -1920,10 +2086,20 @@ version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97d03ceae636d0fed5bae6a7f4f664354c5f4fcedf6eef053fef17e49f837d0a" dependencies = [ - "bitcoin_hashes 0.9.7", - "rand 0.6.5", - "secp256k1-sys", - "serde 1.0.193", + "secp256k1-sys 0.4.1", + "serde", +] + +[[package]] +name = "secp256k1" +version = "0.28.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" +dependencies = [ + "bitcoin_hashes 0.13.0", + "rand 0.8.5", + "secp256k1-sys 0.9.2", + "serde", ] [[package]] @@ -1935,27 +2111,36 @@ dependencies = [ "cc", ] +[[package]] +name = "secp256k1-sys" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" +dependencies = [ + "cc", +] + [[package]] name = "secp256k1-zkp" -version = "0.4.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e57b977141f57b224fc579c23dac5978b5f594281450fe8b5e2b6aa816d0fde" +checksum = "c4e48ef9c98bfbcb98bd15693ffa19676cb3e29426b75eda8b73c05cdd7959f8" dependencies = [ - "bitcoin_hashes 0.9.7", - "rand 0.6.5", - "secp256k1", + "bitcoin-private", + "rand 0.8.5", + "secp256k1 0.28.2", "secp256k1-zkp-sys", - "serde 1.0.193", + "serde", ] [[package]] name = "secp256k1-zkp-sys" -version = "0.4.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45a3c4e1291985397df9770f864ed88bd51ee684b13a384f49d2fedb29f86f0" +checksum = "b4ead52f43074bae2ddbd1e0e66e6b170135e76117f5ea9916f33d7bd0b36e29" dependencies = [ "cc", - "secp256k1-sys", + "secp256k1-sys 0.9.2", ] [[package]] @@ -1996,12 +2181,6 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -[[package]] -name = "serde" -version = "0.9.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34b623917345a631dc9608d5194cc206b3fe6c3554cd1c75b937e55e285254af" - [[package]] name = "serde" version = "1.0.193" @@ -2011,6 +2190,16 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde_cbor" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" +dependencies = [ + "half", + "serde", +] + [[package]] name = "serde_derive" version = "1.0.193" @@ -2022,27 +2211,15 @@ dependencies = [ "syn 2.0.39", ] -[[package]] -name = "serde_json" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8bcf487be7d2e15d3d543f04312de991d631cfe1b43ea0ade69e6a8a5b16a1" -dependencies = [ - "dtoa", - "itoa 0.3.4", - "num-traits 0.1.43", - "serde 0.9.15", -] - [[package]] name = "serde_json" version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ - "itoa 1.0.9", + "itoa", "ryu", - "serde 1.0.193", + "serde", ] [[package]] @@ -2052,9 +2229,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 1.0.9", + "itoa", "ryu", - "serde 1.0.193", + "serde", ] [[package]] @@ -2088,24 +2265,6 @@ dependencies = [ "parking_lot", ] -[[package]] -name = "slip21" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516f52f3cec67962a9c414130251b512f2ff47f81980411ae01b6ce540b1ca6b" -dependencies = [ - "bitcoin_hashes 0.11.0", -] - -[[package]] -name = "smallvec" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" -dependencies = [ - "maybe-uninit", -] - [[package]] name = "smallvec" version = "1.11.2" @@ -2129,7 +2288,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -2149,6 +2308,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "strsim" version = "0.8.0" @@ -2179,6 +2344,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + [[package]] name = "syn" version = "1.0.109" @@ -2208,7 +2379,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3133289179676c9f5c5b2845bf5a2e127769f4889fcbada43035ef6bd662605e" dependencies = [ "libc", - "serde 1.0.193", + "serde", "serde_derive", "syntex_pos", "term", @@ -2221,7 +2392,7 @@ version = "0.59.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30ab669fa003d208c681f874bbc76d91cc3d32550d16b5d9d2087cf477316470" dependencies = [ - "serde 1.0.193", + "serde", "serde_derive", ] @@ -2234,9 +2405,9 @@ dependencies = [ "bitflags 0.9.1", "extprim", "log 0.3.9", - "serde 1.0.193", + "serde", "serde_derive", - "serde_json 1.0.108", + "serde_json", "syntex_errors", "syntex_pos", "unicode-xid", @@ -2273,7 +2444,7 @@ dependencies = [ "fastrand 2.0.1", "redox_syscall 0.4.1", "rustix", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -2331,9 +2502,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" dependencies = [ "deranged", - "itoa 1.0.9", + "itoa", "powerfmt", - "serde 1.0.193", + "serde", "time-core", "time-macros", ] @@ -2366,6 +2537,21 @@ dependencies = [ "url", ] +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "tokio" version = "1.34.0" @@ -2379,7 +2565,7 @@ dependencies = [ "num_cpus", "pin-project-lite", "socket2 0.5.5", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -2419,9 +2605,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + [[package]] name = "tracing-core" version = "0.1.32" @@ -2437,6 +2635,12 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + [[package]] name = "unicode-bidi" version = "0.3.13" @@ -2451,11 +2655,11 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.9" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09c8070a9942f5e7cfccd93f490fdebd230ee3c3c9f107cb25bad5351ef671cf" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" dependencies = [ - "smallvec 0.6.14", + "tinyvec", ] [[package]] @@ -2476,12 +2680,28 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +[[package]] +name = "universal-hash" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +dependencies = [ + "generic-array", + "subtle", +] + [[package]] name = "untrusted" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "uriparse" version = "0.6.4" @@ -2499,9 +2719,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22fe195a4f217c25b25cb5058ced57059824a678474874038dc88d211bf508d3" dependencies = [ "form_urlencoded", - "idna", + "idna 0.2.1", "percent-encoding", - "serde 1.0.193", + "serde", ] [[package]] @@ -2625,8 +2845,8 @@ version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" dependencies = [ - "ring", - "untrusted", + "ring 0.16.20", + "untrusted 0.7.1", ] [[package]] @@ -2638,6 +2858,12 @@ dependencies = [ "webpki", ] +[[package]] +name = "webpki-roots" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" + [[package]] name = "which" version = "4.4.2" @@ -2699,7 +2925,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.4", ] [[package]] @@ -2708,13 +2943,28 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +dependencies = [ + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", ] [[package]] @@ -2723,42 +2973,84 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" + [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" + [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" + [[package]] name = "winreg" version = "0.50.0" @@ -2766,5 +3058,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ "cfg-if 1.0.0", - "windows-sys", + "windows-sys 0.48.0", ] + +[[package]] +name = "zeroize" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" diff --git a/README.md b/README.md index 60f4aed..ffc1d4f 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,13 @@ BTCTipServer === BTCTip Server is a self-hosted, open-source bitcoin payment processor. -- :coin: use [bdk](https://github.com/bitcoindevkit/bdk) a modern, lightweight, descriptor-based wallet library +- :coin: use [Bitcoin Development Kit](https://github.com/bitcoindevkit/bdk) a modern, lightweight, descriptor-based wallet library - :zap: lightning support with [lnsocket](https://github.com/jb55/lnsocket), remote commando plugin -- :droplet: liquid and assets support with [edk](https://github.com/lvaccaro/edk) +- :droplet: liquid and assets support with [Liquid Wallet Kit](https://github.com/blockstream/lwk) - :gear: usage wallet descriptors to build complex address rules - :ninja: keep funds safe without privatekey/secret usage - :watch: pay host to usage, no required instance always online -- ::point_up_2: host on heroku with a click, below button +- :point_up_2: host on heroku with a click, below button - :crab: written in rust ![title](assets/preview.png) @@ -28,9 +28,9 @@ btctipserver bitcoin --network bitcoin --server "ssl://blockstream.info:700" --d ``` ### Liquid -For a liquid, pass the descriptor, the master blinding key and network (liquid or elements) +For a liquid, pass the CT descriptor with the master blinding key and network (liquid, liquidtestnet or elements) ``` -btctipserver liquid --network liquid --server "ssl://blockstream.info:995" --descriptor "elwpkh(xpub6F33eZ1QWddkNKw27gdgACBGorYVU4iqJQwMDL85jVeiZKSjFbnKhJr15DtzBuiDLHAEr2aXk2aXahLq8Jpt9KZh1ubHuCc9Nbf65d65kPH/*)#yvsg4jzf" --master_blinding_key "" +btctipserver liquid --network liquidtestnet --server "blockstream.info:465" --descriptor "ct(slip77(ab5824f4477b4ebb00a132adfd8eb0b7935cf24f6ac151add5d1913db374ce92),elwpkh([759db348/84'/1'/0']tpubDCRMaF33e44pcJj534LXVhFbHibPbJ5vuLhSSPFAw57kYURv4tzXFL6LSnd78bkjqdmE3USedkbpXJUPA1tdzKfuYSL7PianceqAhwL2UkA/<0;1>/*))#cch6wrnp" ``` ### Lightning diff --git a/liquid/Cargo.toml b/liquid/Cargo.toml index 4cd9734..b3702ba 100644 --- a/liquid/Cargo.toml +++ b/liquid/Cargo.toml @@ -4,7 +4,6 @@ version = "0.1.1-dev" edition = "2021" [dependencies] -edk = { git = "https://github.com/lvaccaro/edk.git" } dirs-next = "2.0.0" structopt = "0.3" hex = "0.4" @@ -12,6 +11,4 @@ reqwest = { version = "0.11.22", features = ["blocking", "json"] } serde = "1.0.114" serde_json = "1.0" serde_derive = "1.0.114" - -[features] -electrum = ["edk/electrum"] \ No newline at end of file +lwk_wollet = "0.2.0" diff --git a/liquid/config_example.ini b/liquid/config_example.ini index 2e5ef3f..bf556d5 100644 --- a/liquid/config_example.ini +++ b/liquid/config_example.ini @@ -1,8 +1,6 @@ -datadir = .edk-liquid -network = liquid -wallet = main -descriptor = "elwpkh(xpub6F33eZ1QWddkNKw27gdgACBGorYVU4iqJQwMDL85jVeiZKSjFbnKhJr15DtzBuiDLHAEr2aXk2aXahLq8Jpt9KZh1ubHuCc9Nbf65d65kPH/*)#yvsg4jzf" -master_blinding_key = "6c2de18eabeff3f7822bc724ad482bef0557f3e1c1e1c75b7a393a5ced4de616" +datadir = .lwk-liquid +network = liquidtestnet +descriptor = "ct(slip77(ab5824f4477b4ebb00a132adfd8eb0b7935cf24f6ac151add5d1913db374ce92),elwpkh([759db348/84'/1'/0']tpubDCRMaF33e44pcJj534LXVhFbHibPbJ5vuLhSSPFAw57kYURv4tzXFL6LSnd78bkjqdmE3USedkbpXJUPA1tdzKfuYSL7PianceqAhwL2UkA/<0;1>/*))#cch6wrnp" # electrum server URL must support network specified above -electrum = "ssl://blockstream.info:995" +electrum = "blockstream.info:465" diff --git a/liquid/src/config.rs b/liquid/src/config.rs index 9787341..b1ea53c 100644 --- a/liquid/src/config.rs +++ b/liquid/src/config.rs @@ -1,3 +1,4 @@ +use std::str::FromStr; use structopt::StructOpt; // This is a workaround for `structopt` issue #333, #391, #418; see https://github.com/TeXitoi/structopt/issues/333#issuecomment-712265332 @@ -15,9 +16,9 @@ pub struct LiquidOpts { /// Data Dir #[structopt( name = "DATADIR", - env = "EDK_DATADIR", + env = "LWK_DATADIR", long = "datadir", - default_value = ".edk-bitcoin" + default_value = ".lwk" )] pub data_dir: String, /// Liquid network @@ -26,8 +27,8 @@ pub struct LiquidOpts { env = "NETWORK", short = "n", long = "network", - default_value = "elements", - possible_values = &["liquid","elements"] + default_value = "liquidtestnet", + possible_values = &["liquid","liquidtestnet","elements"] )] pub network: String, /// Wallet output descriptor, use public keys only @@ -38,31 +39,21 @@ pub struct LiquidOpts { long = "descriptor" )] pub descriptor: String, - /// Wallet output descriptor, use public keys only - #[structopt( - name = "MASTER_BLINDING_KEY", - env = "MASTER_BLINDING_KEY", - short = "b", - long = "master_blinding_key" - )] - pub master_blinding_key: String, - /// Wallet name - #[structopt( - name = "WALLET", - env = "WALLET", - short = "w", - long = "wallet", - default_value = "btctipserver" - )] - pub wallet: String, #[structopt(flatten)] pub electrum_opts: ElectrumOpts, } impl LiquidOpts { - pub fn network(&self) -> &'static edk::miniscript::elements::AddressParams { + pub fn network(&self) -> lwk_wollet::ElementsNetwork { match self.network.as_str() { - "liquid" => &edk::miniscript::elements::AddressParams::LIQUID, - _ => &edk::miniscript::elements::AddressParams::ELEMENTS, + "liquid" => lwk_wollet::ElementsNetwork::Liquid, + "liquidtestnet" => lwk_wollet::ElementsNetwork::LiquidTestnet, + _ => { + let policy_asset = + "5ac9f65c0efcc4775e0baec4ec03abdde22473cd3cf33c0419ca290e0751b225"; + let policy_asset = + lwk_wollet::elements::AssetId::from_str(policy_asset).expect("static"); + lwk_wollet::ElementsNetwork::ElementsRegtest { policy_asset } + } } } } diff --git a/liquid/src/esplora.rs b/liquid/src/esplora.rs index 52437c6..ee7a265 100644 --- a/liquid/src/esplora.rs +++ b/liquid/src/esplora.rs @@ -1,4 +1,5 @@ -use edk::bdk::Error; +use lwk_wollet::elements::AssetId; +use lwk_wollet::Error; use serde_derive::Deserialize; use std::collections::HashMap; @@ -8,25 +9,25 @@ pub fn gen_err() -> Error { #[derive(Deserialize, Clone, Debug)] pub struct Asset { - pub asset_id: String, + pub asset_id: AssetId, pub precision: u8, pub name: String, pub ticker: String, } pub struct EsploraRepository { - pub assets: HashMap, + pub assets: HashMap, } impl EsploraRepository { - pub fn get(&mut self, asset_id: String) -> Result { + pub fn get(&mut self, asset_id: AssetId) -> Result { match self.assets.get(&asset_id).as_ref() { Some(&asset) => Ok(asset.clone()), None => self.fetch(asset_id), } } - pub fn fetch(&mut self, asset_id: String) -> Result { + pub fn fetch(&mut self, asset_id: AssetId) -> Result { let url = format!("https://blockstream.info/liquid/api/asset/{}", asset_id); let res = reqwest::blocking::get(url).map_err(|_| gen_err())?; let asset: Asset = res.json().map_err(|_| gen_err())?; diff --git a/liquid/src/lib.rs b/liquid/src/lib.rs index 24342c4..784dc6d 100644 --- a/liquid/src/lib.rs +++ b/liquid/src/lib.rs @@ -1,28 +1,26 @@ pub mod config; pub mod esplora; -pub extern crate edk; +pub extern crate lwk_wollet; extern crate reqwest; extern crate structopt; use crate::config::LiquidOpts; -use edk::bdk::electrum_client::Client; -use edk::bdk::Error; -use std::collections::HashMap; -use std::ops::Div; -use std::str::FromStr; +use lwk_wollet::elements::Address; +use lwk_wollet::{ + full_scan_with_electrum_client, ElectrumClient, ElectrumUrl, Error, FsPersister, Wollet, +}; -use edk::bdk::sled::{self, Tree}; -use edk::miniscript::elements::secp256k1_zkp; -use edk::miniscript::elements::slip77::MasterBlindingKey; -use edk::miniscript::elements::Address; -use edk::miniscript::{Descriptor, DescriptorPublicKey}; use esplora::EsploraRepository; +use std::collections::HashMap; use std::fs; use std::path::PathBuf; +use std::str::FromStr; pub struct LiquidWallet { - wallet: edk::Wallet, + network: lwk_wollet::ElementsNetwork, + wollet: Wollet, + electrum: ElectrumClient, esplora: EsploraRepository, } @@ -40,36 +38,33 @@ impl LiquidWallet { //info!("Creating home directory {}", dir.as_path().display()); fs::create_dir(&dir).unwrap(); } - - dir.push("database.sled"); dir } pub fn new(opts: &LiquidOpts) -> Result { // setup database - let database = sled::open(Self::prepare_home_dir(&opts.data_dir).to_str().unwrap())?; - let tree = database.open_tree(&opts.wallet)?; - - // setup electrum blockchain client - let client = Client::new(&opts.electrum_opts.electrum).unwrap(); + let datadir = Self::prepare_home_dir(&opts.data_dir); + //let tree = database.open_tree(&opts.wallet)?; // setup keys variables - let descriptor = Descriptor::::from_str(&opts.descriptor).unwrap(); - let decoded: &[u8] = &hex::decode(&opts.master_blinding_key.as_str()).unwrap(); - let master_blinding_key = - MasterBlindingKey(secp256k1_zkp::SecretKey::from_slice(decoded).unwrap()); - - // create wallet shared by all requests - let wallet = edk::Wallet::new( - descriptor, - master_blinding_key, - tree, - client, + //let descriptor: WolletDescriptor = opts.descriptor.parse()?; + let mut wollet = Wollet::new( opts.network(), + FsPersister::new(&datadir).unwrap(), + opts.descriptor.as_str(), ) .unwrap(); + + // setup electrum blockchain client + let electrum_url = ElectrumUrl::new(&opts.electrum_opts.electrum, true, true); + let mut electrum_client = ElectrumClient::new(&electrum_url)?; + + full_scan_with_electrum_client(&mut wollet, &mut electrum_client)?; + Ok(LiquidWallet { - wallet, + network: opts.network(), + wollet, + electrum: electrum_client, esplora: EsploraRepository { assets: HashMap::new(), }, @@ -79,13 +74,14 @@ impl LiquidWallet { impl LiquidWallet { pub fn last_unused_address(&mut self) -> Result { - let address = self.wallet.get_new_address().map_err(|_| gen_err())?; - Ok(address.to_string()) + let address = self.wollet.address(None).map_err(|_| gen_err())?; + Ok(address.address().to_string()) } pub fn is_my_address(&mut self, addr: &str) -> Result { - let address = Address::from_str(addr).map_err(|_| gen_err())?; - self.wallet.is_mine_address(&address).map_err(|_| gen_err()) + let _address = Address::from_str(addr).map_err(|_| gen_err())?; + //self.wollet.is_mine_address(&address).map_err(|_| gen_err()) + Ok(true) } pub fn balance_address( @@ -93,38 +89,39 @@ impl LiquidWallet { addr: &str, _from_height: Option, ) -> Result, Error> { - let addr = Address::from_str(addr).map_err(|_| gen_err())?; - let mut balances = HashMap::new(); - for unblind in self - .wallet - .balance_addresses(vec![addr]) - .map_err(|_| gen_err())? - .unblinds - { - let tx_out = unblind.1; - *balances.entry(tx_out.asset).or_insert(0) += tx_out.value; - } - - let res = balances + full_scan_with_electrum_client(&mut self.wollet, &mut self.electrum)?; + let script_pubkey = Address::from_str(addr).unwrap().script_pubkey(); + let tx_outs = self + .wollet + .utxos() + .unwrap() .into_iter() - .filter_map(|(key, value)| { - let asset_id = key.to_string(); - match self.esplora.get(asset_id.clone()) { - Ok(asset) => Some(( - format!("{} ({})", asset.name, asset_id), - (value / 10_u64.pow(asset.precision.into())).to_string(), - )), - Err(_) => Some((key.to_string(), value.to_string())), - } - }) - .collect(); + .filter(|x| x.script_pubkey == script_pubkey); + let mut balance = HashMap::new(); + for out in tx_outs { + let asset_id = out.unblinded.asset; + let precision = self.esplora.get(asset_id).map_or(0, |x| x.precision); + let decimal = (10 as f64).powf(precision as f64); + let value = out.unblinded.value as f64 / decimal; + balance + .entry(out.unblinded.asset) + .and_modify(|x| *x += value) + .or_insert(value); + } + let mut res = HashMap::new(); + for b in balance { + let ticker = self.esplora.get(b.0).map_or(b.0.to_string(), |x| x.ticker); + res.insert(ticker, format!("{}", b.1)); + } + println!("balance {:?}", res); Ok(res) } pub fn network(&mut self) -> Result { - match self.wallet.network() { - &edk::miniscript::elements::AddressParams::LIQUID => Ok("liquid".to_string()), - _ => Ok("elements".to_string()), + match self.network { + lwk_wollet::ElementsNetwork::Liquid => Ok("Liquid".to_string()), + lwk_wollet::ElementsNetwork::LiquidTestnet => Ok("Liquid Testnet".to_string()), + _ => Ok("Elements".to_string()), } } }