Skip to content

Commit cac043b

Browse files
committed
Replace libwally with bitcoin core
1 parent 2d22d51 commit cac043b

File tree

192 files changed

+32755
-1384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+32755
-1384
lines changed

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "third_party/libwally-core"]
2-
path = third_party/libwally-core
3-
url = https://github.com/ElementsProject/libwally-core

CMakeLists.txt

+6-22
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,12 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
1010
option(BUILD_TESTING "Build unit tests" OFF)
1111

1212
if (ANDROID)
13-
add_library(wally SHARED IMPORTED)
14-
set_target_properties(wally PROPERTIES IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/third_party/libwally-core/release/lib/${ANDROID_ABI}/libwallycore.so")
15-
set_target_properties(wally PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PROJECT_SOURCE_DIR}/third_party/libwally-core/release/include")
1613

1714
elseif(WIN32)
18-
message(FATAL_ERROR "Not support yet!")
1915
elseif(IOS)
20-
add_library(secp256k1 STATIC IMPORTED)
21-
set_target_properties(secp256k1 PROPERTIES IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/third_party/libwally-core/build/iphoneos/libsecp256k1.a")
2216

23-
add_library(wally STATIC IMPORTED)
24-
set_target_properties(wally PROPERTIES IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/third_party/libwally-core/build/iphoneos/libwallycore.a")
25-
set_target_properties(wally PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PROJECT_SOURCE_DIR}/third_party/libwally-core/include")
26-
target_link_libraries(wally INTERFACE secp256k1)
2717
else()
28-
add_library(secp256k1 STATIC IMPORTED)
29-
set_target_properties(secp256k1 PROPERTIES IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/third_party/libwally-core/src/secp256k1/.libs/libsecp256k1.a")
3018

31-
add_library(wally SHARED IMPORTED)
32-
set_target_properties(wally PROPERTIES IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/third_party/libwally-core/src/.libs/libwallycore.so")
33-
set_target_properties(wally PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PROJECT_SOURCE_DIR}/third_party/libwally-core/include")
34-
target_link_libraries(wally INTERFACE secp256k1)
3519
endif()
3620

3721
add_library(tap-protocol STATIC
@@ -52,21 +36,21 @@ add_library(tap-protocol STATIC
5236
src/hwi_tapsigner.cpp
5337
)
5438

55-
add_subdirectory(third_party/bitcoin-core)
39+
add_subdirectory(contrib/bitcoin-core)
5640

5741
target_link_libraries(tap-protocol
58-
PRIVATE wally bitcoin-core
42+
PRIVATE bitcoin-core
5943
)
6044

6145
target_include_directories(${PROJECT_NAME}
6246
PUBLIC ${PROJECT_SOURCE_DIR}/include
63-
PUBLIC ${PROJECT_SOURCE_DIR}/third_party/include
47+
PUBLIC ${PROJECT_SOURCE_DIR}/contrib/include
6448
)
6549

6650
target_compile_definitions(${PROJECT_NAME} PRIVATE TAPPROTOCOL_LIBRARY)
6751

6852
target_precompile_headers(${PROJECT_NAME}
69-
PRIVATE ${PROJECT_SOURCE_DIR}/third_party/include/nlohmann/json.hpp)
53+
PRIVATE ${PROJECT_SOURCE_DIR}/contrib/include/nlohmann/json.hpp)
7054

7155
#set(CPACK_PROJECT_NAME ${PROJECT_NAME})
7256
#set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
@@ -78,7 +62,7 @@ if (BUILD_TESTING)
7862
add_library(test_main OBJECT tests/unit.cpp)
7963

8064
target_include_directories(test_main
81-
PUBLIC ${PROJECT_SOURCE_DIR}/tests/third_party/doctest
65+
PUBLIC ${PROJECT_SOURCE_DIR}/tests/contrib/doctest
8266
PUBLIC ${Boost_INCLUDE_DIRS}
8367
)
8468
target_link_libraries(test_main ${Boost_LIBRARIES})
@@ -95,7 +79,7 @@ if (BUILD_TESTING)
9579
add_executable(${testcase} ${file} $<TARGET_OBJECTS:test_main>)
9680
target_link_libraries(${testcase} ${PROJECT_NAME})
9781
target_include_directories(${testcase} PUBLIC
98-
"${PROJECT_SOURCE_DIR}/tests/third_party/doctest"
82+
"${PROJECT_SOURCE_DIR}/tests/contrib/doctest"
9983
"${PROJECT_SOURCE_DIR}/include"
10084
)
10185

README.md

+3-14
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,14 @@ add_subdirectory(tap-protocol)
1717
target_link_libraries("${PROJECT_NAME}" PUBLIC tap-protocol)
1818
```
1919

20-
## Build libwally-core ([detail](https://github.com/ElementsProject/libwally-core#building))
20+
## Build secp256k1
2121
```
22-
# For Android
23-
# https://github.com/ElementsProject/libwally-core#android
24-
# you may wanna export ANDROID_NDK=/path/to/android-ndk # r22 is the minimum supported version
25-
$ cd third_party/libwally-core
26-
$ ./tools/build_android_libraries.sh
27-
28-
# For Linux, MacOS, iOS
29-
# https://github.com/ElementsProject/libwally-core#building
30-
$ cd third_party/libwally-core
31-
$ ./tools/autogen.sh
32-
$ ./configure --disable-tests
33-
$ make
22+
cd contrib/bitcoin-core/src/secp256k1
23+
./configure --disable-shared --with-pic --enable-benchmark=no --enable-module-recovery --enable-module-schnorrsig --enable-module-ecdh --enable-experimental
3424
```
3525

3626
# Use with JNI
3727

38-
3928
Android Intent that handle NFC event
4029

4130
```

contrib/bitcoin-core/CMakeLists.txt

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
3+
project(bitcoin-core LANGUAGES CXX)
4+
#set(CMAKE_INCLUDE_CURRENT_DIR ON)
5+
set(CMAKE_CXX_STANDARD 17)
6+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7+
8+
add_library(${PROJECT_NAME} STATIC
9+
src/amount.h
10+
src/streams.h
11+
src/psbt.h
12+
src/psbt.cpp
13+
src/uint256.h
14+
src/uint256.cpp
15+
src/attributes.h
16+
src/compat/endian.h
17+
src/compat/byteswap.h
18+
src/prevector.h
19+
src/span.h
20+
21+
src/support/lockedpool.h
22+
src/support/lockedpool.cpp
23+
src/support/allocators/zeroafterfree.h
24+
src/support/allocators/secure.h
25+
src/support/cleanse.h
26+
src/support/cleanse.cpp
27+
src/util/strencodings.h
28+
src/util/strencodings.cpp
29+
src/util/string.h
30+
src/util/string.cpp
31+
32+
src/tinyformat.h
33+
34+
src/prevector.h
35+
src/serialize.h
36+
37+
src/crypto/common.h
38+
src/crypto/sha256.h
39+
src/crypto/sha256.cpp
40+
src/crypto/sha512.h
41+
src/crypto/sha512.cpp
42+
src/crypto/ripemd160.h
43+
src/crypto/ripemd160.cpp
44+
45+
src/script/keyorigin.h
46+
src/script/script.h
47+
src/script/script.cpp
48+
49+
src/hash.h
50+
src/hash.cpp
51+
52+
src/version.h
53+
src/crypto/hmac_sha512.h
54+
src/crypto/hmac_sha512.cpp
55+
src/crypto/hmac_sha256.h
56+
src/crypto/hmac_sha256.cpp
57+
58+
src/primitives/transaction.h
59+
src/primitives/transaction.cpp
60+
src/pubkey.h
61+
src/pubkey.cpp
62+
src/script/sign.h
63+
src/script/sign.cpp
64+
src/script/standard.h
65+
src/script/standard.cpp
66+
67+
src/script/interpreter.h
68+
src/script/interpreter.cpp
69+
src/script/script_error.h
70+
src/script/script_error.cpp
71+
src/util/hash_type.h
72+
src/crypto/sha1.h
73+
src/crypto/sha1.cpp
74+
src/base58.h
75+
src/base58.cpp
76+
77+
)
78+
79+
80+
add_library(libsecp256k1 STATIC IMPORTED)
81+
set_target_properties(libsecp256k1 PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/src/secp256k1/.libs/libsecp256k1.a)
82+
set_target_properties(libsecp256k1 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${PROJECT_SOURCE_DIR}/src/secp256k1/include)
83+
84+
target_include_directories(${PROJECT_NAME}
85+
PUBLIC src
86+
)
87+
88+
target_link_libraries(${PROJECT_NAME}
89+
PUBLIC libsecp256k1
90+
)
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)