repo_id
stringlengths
0
42
file_path
stringlengths
15
97
content
stringlengths
2
2.41M
__index_level_0__
int64
0
0
bitcoin
bitcoin/build_msvc/common.qt.init.vcxproj
<?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup Label="QtGlobals"> <QtBaseDir Condition="'$(QTBASEDIR)' == ''">C:\Qt_static</QtBaseDir> <QtPluginsLibraryDir>$(QtBaseDir)\plugins</QtPluginsLibraryDir> <QtLibraryDir>$(QtBaseDir)\lib</QtLibraryDir> <QtIncludeDir>$(QtBaseDir)\include</QtIncludeDir> <QtIncludes>$(QtIncludeDir);$(QtIncludeDir)\QtNetwork;$(QtIncludeDir)\QtCore;$(QtIncludeDir)\QtWidgets;$(QtIncludeDir)\QtGui;</QtIncludes> <GeneratedFilesOutDir>.\QtGeneratedFiles\qt</GeneratedFilesOutDir> <QtToolsDir>$(QtBaseDir)\bin</QtToolsDir> <QtReleaseLibraries>$(QtPluginsLibraryDir)\platforms\qminimal.lib;$(QtPluginsLibraryDir)\platforms\qwindows.lib;$(QtPluginsLibraryDir)\styles\qwindowsvistastyle.lib;$(QtLibraryDir)\Qt5WindowsUIAutomationSupport.lib;$(QtLibraryDir)\qtfreetype.lib;$(QtLibraryDir)\qtharfbuzz.lib;$(QtLibraryDir)\qtlibpng.lib;$(QtLibraryDir)\qtpcre2.lib;$(QtLibraryDir)\Qt5AccessibilitySupport.lib;$(QtLibraryDir)\Qt5Core.lib;$(QtLibraryDir)\Qt5Concurrent.lib;$(QtLibraryDir)\Qt5EventDispatcherSupport.lib;$(QtLibraryDir)\Qt5FontDatabaseSupport.lib;$(QtLibraryDir)\Qt5Gui.lib;$(QtLibraryDir)\Qt5Network.lib;$(QtLibraryDir)\Qt5PlatformCompositorSupport.lib;$(QtLibraryDir)\Qt5ThemeSupport.lib;$(QtLibraryDir)\Qt5Widgets.lib;$(QtLibraryDir)\Qt5WinExtras.lib;$(QtLibraryDir)\qtmain.lib;Wtsapi32.lib;userenv.lib;netapi32.lib;imm32.lib;Dwmapi.lib;version.lib;winmm.lib;UxTheme.lib</QtReleaseLibraries> <QtDebugLibraries>$(QtPluginsLibraryDir)\platforms\qwindowsd.lib;$(QtPluginsLibraryDir)\platforms\qminimald.lib;$(QtPluginsLibraryDir)\styles\qwindowsvistastyled.lib;$(QtLibraryDir)\*d.lib;Wtsapi32.lib;crypt32.lib;userenv.lib;netapi32.lib;imm32.lib;Dwmapi.lib;version.lib;winmm.lib;UxTheme.lib</QtDebugLibraries> </PropertyGroup> <ItemDefinitionGroup> <ClCompile> <PreprocessorDefinitions>QT_NO_KEYWORDS;QT_USE_QSTRINGBUILDER;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> </ItemDefinitionGroup> </Project>
0
bitcoin
bitcoin/build_msvc/common.init.vcxproj.in
<?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Label="Globals"> <VCProjectVersion>16.0</VCProjectVersion> <UseNativeEnvironment>true</UseNativeEnvironment> </PropertyGroup> <PropertyGroup Label="Vcpkg"> <VcpkgEnabled>true</VcpkgEnabled> <VcpkgEnableManifest>true</VcpkgEnableManifest> <VcpkgManifestInstall>true</VcpkgManifestInstall> <VcpkgUseStatic>true</VcpkgUseStatic> <VcpkgAutoLink>true</VcpkgAutoLink> <VcpkgConfiguration>$(Configuration)</VcpkgConfiguration> <VcpkgTriplet Condition="'$(Platform)'=='x64'">x64-windows-static</VcpkgTriplet> </PropertyGroup> <PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'=='' and !Exists('$(WindowsSdkDir)\DesignTime\CommonConfiguration\Neutral\Windows.props')"> <WindowsTargetPlatformVersion_10 Condition="'$(WindowsTargetPlatformVersion_10)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</WindowsTargetPlatformVersion_10> <WindowsTargetPlatformVersion_10 Condition="'$(WindowsTargetPlatformVersion_10)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion)</WindowsTargetPlatformVersion_10> <!-- Sometimes the version in the registry has to .0 suffix, and sometimes it doesn't. Check and add it --> <WindowsTargetPlatformVersion_10 Condition="'$(WindowsTargetPlatformVersion_10)' != '' and !$(WindowsTargetPlatformVersion_10.EndsWith('.0'))">$(WindowsTargetPlatformVersion_10).0</WindowsTargetPlatformVersion_10> <WindowsTargetPlatformVersion>$(WindowsTargetPlatformVersion_10)</WindowsTargetPlatformVersion> </PropertyGroup> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Release|x64"> <Configuration>Release</Configuration> <Platform>x64</Platform> </ProjectConfiguration> <ProjectConfiguration Include="Debug|x64"> <Configuration>Debug</Configuration> <Platform>x64</Platform> </ProjectConfiguration> </ItemGroup> <PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration"> <LinkIncremental>false</LinkIncremental> <UseDebugLibraries>false</UseDebugLibraries> <PlatformToolset>@TOOLSET@</PlatformToolset> <CharacterSet>Unicode</CharacterSet> <GenerateManifest>No</GenerateManifest> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> <IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration"> <LinkIncremental>true</LinkIncremental> <UseDebugLibraries>true</UseDebugLibraries> <PlatformToolset>@TOOLSET@</PlatformToolset> <CharacterSet>Unicode</CharacterSet> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> <IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'"> <ClCompile> <Optimization>MaxSpeed</Optimization> <WholeProgramOptimization>false</WholeProgramOptimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <SDLCheck>true</SDLCheck> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <DebugInformationFormat>None</DebugInformationFormat> </ClCompile> <Link> <EnableCOMDATFolding>false</EnableCOMDATFolding> <OptimizeReferences>false</OptimizeReferences> <AdditionalOptions>/LTCG:OFF</AdditionalOptions> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'"> <ClCompile> <Optimization>Disabled</Optimization> <WholeProgramOptimization>false</WholeProgramOptimization> <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <SDLCheck>true</SDLCheck> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup> <ClCompile> <WarningLevel>Level3</WarningLevel> <PrecompiledHeader>NotUsing</PrecompiledHeader> <AdditionalOptions>/utf-8 /Zc:__cplusplus /std:c++20 %(AdditionalOptions)</AdditionalOptions> <DisableSpecificWarnings>4018;4244;4267;4715;4805</DisableSpecificWarnings> <TreatWarningAsError>true</TreatWarningAsError> <PreprocessorDefinitions>_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;SECP256K1_STATIC;ZMQ_STATIC;NOMINMAX;WIN32;HAVE_CONFIG_H;_CRT_SECURE_NO_WARNINGS;_CONSOLE;_WIN32_WINNT=0x0601;_WIN32_IE=0x0501;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>..\..\src;..\..\src\minisketch\include;..\..\src\univalue\include;..\..\src\secp256k1\include;..\..\src\leveldb\include;..\..\src\leveldb\helpers\memenv;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> <Link> <SubSystem>Console</SubSystem> <AdditionalDependencies>Iphlpapi.lib;ws2_32.lib;Shlwapi.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> <RandomizedBaseAddress>true</RandomizedBaseAddress> </Link> </ItemDefinitionGroup> <Import Project="common.init.vcxproj.user" Condition="Exists('common.init.vcxproj.user')" /> </Project>
0
bitcoin
bitcoin/build_msvc/README.md
Building Bitcoin Core with Visual Studio ======================================== Introduction --------------------- Visual Studio 2022 is minimum required to build Bitcoin Core. Solution and project files to build with `msbuild` or Visual Studio can be found in the `build_msvc` directory. To build Bitcoin Core from the command-line, it is sufficient to only install the [Visual Studio Build Tools](https://visualstudio.microsoft.com/downloads/) component. The "Desktop development with C++" workload must be installed as well. Building with Visual Studio is an alternative to the Linux based [cross-compiler build](../doc/build-windows.md). Prerequisites --------------------- To build [dependencies](../doc/dependencies.md) (except for [Qt](#qt)), the default approach is to use the [vcpkg](https://vcpkg.io) package manager from Microsoft: 1. [Install](https://vcpkg.io/en/getting-started.html) vcpkg. 2. By default, vcpkg makes both `release` and `debug` builds for each package. To save build time and disk space, one could skip `debug` builds (example uses PowerShell): ```powershell Add-Content -Path "vcpkg\triplets\x64-windows-static.cmake" -Value "set(VCPKG_BUILD_TYPE release)" ``` Qt --------------------- To build Bitcoin Core with the GUI, a static build of Qt is required. 1. Download a single ZIP archive of Qt source code from https://download.qt.io/official_releases/qt/ (e.g., [`qt-everywhere-opensource-src-5.15.11.zip`](https://download.qt.io/official_releases/qt/5.15/5.15.11/single/qt-everywhere-opensource-src-5.15.11.zip)), and expand it into a dedicated folder. The following instructions assume that this folder is `C:\dev\qt-source`. > 💡 **Tip:** If you use the default path with "Extract All" for the Qt source code zip file, and end up with something like `C:\dev\qt-everywhere-opensource-src-5.15.11\qt-everywhere-src-5.15.11`, you are likely to encounter a "path too long" error when building. To fix the problem move the source files to a shorter path such as the recommended `C:\dev\qt-source`. 2. Open "x64 Native Tools Command Prompt for VS 2022", and input the following commands: ```cmd cd C:\dev\qt-source mkdir build cd build ..\configure -release -silent -opensource -confirm-license -opengl desktop -static -static-runtime -mp -qt-zlib -qt-pcre -qt-libpng -nomake examples -nomake tests -nomake tools -no-angle -no-dbus -no-gif -no-gtk -no-ico -no-icu -no-libjpeg -no-libudev -no-sql-sqlite -no-sql-odbc -no-sqlite -no-vulkan -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdeclarative -skip doc -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtlottie -skip qtmacextras -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtquick3d -skip qtquickcontrols -skip qtquickcontrols2 -skip qtquicktimeline -skip qtremoteobjects -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtsvg -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebglplugin -skip qtwebsockets -skip qtwebview -skip qtx11extras -skip qtxmlpatterns -no-openssl -no-feature-bearermanagement -no-feature-printdialog -no-feature-printer -no-feature-printpreviewdialog -no-feature-printpreviewwidget -no-feature-sql -no-feature-sqlmodel -no-feature-textbrowser -no-feature-textmarkdownwriter -no-feature-textodfwriter -no-feature-xml -prefix C:\Qt_static nmake nmake install ``` One could speed up building with [`jom`](https://wiki.qt.io/Jom), a replacement for `nmake` which makes use of all CPU cores. To build Bitcoin Core without Qt, unload or disable the `bitcoin-qt`, `libbitcoin_qt` and `test_bitcoin-qt` projects. Building --------------------- 1. Use Python to generate `*.vcxproj` for the Visual Studio 2022 toolchain from Makefile: ```cmd python build_msvc\msvc-autogen.py ``` 2. An optional step is to adjust the settings in the `build_msvc` directory and the `common.init.vcxproj` file. This project file contains settings that are common to all projects such as the runtime library version and target Windows SDK version. The Qt directories can also be set. To specify a non-default path to a static Qt package directory, use the `QTBASEDIR` environment variable. 3. To build from the command-line with the Visual Studio toolchain use: ```cmd msbuild build_msvc\bitcoin.sln -property:Configuration=Release -maxCpuCount -verbosity:minimal ``` Alternatively, open the `build_msvc/bitcoin.sln` file in Visual Studio. Security --------------------- [Base address randomization](https://learn.microsoft.com/en-us/cpp/build/reference/dynamicbase-use-address-space-layout-randomization) is used to make Bitcoin Core more secure. When building Bitcoin using the `build_msvc` process base address randomization can be disabled by editing `common.init.vcproj` to change `RandomizedBaseAddress` from `true` to `false` and then rebuilding the project. To check if `bitcoind` has `RandomizedBaseAddress` enabled or disabled run ``` .\dumpbin.exe /headers src/bitcoind.exe ``` If is it enabled then in the output `Dynamic base` will be listed in the `DLL characteristics` under `OPTIONAL HEADER VALUES` as shown below ``` 8160 DLL characteristics High Entropy Virtual Addresses Dynamic base NX compatible Terminal Server Aware ``` This may not disable all stack randomization as versions of windows employ additional stack randomization protections. These protections must be turned off in the OS configuration.
0
bitcoin
bitcoin/build_msvc/vcpkg.json
{ "name": "bitcoin-core", "version-string": "1", "dependencies": [ "berkeleydb", "boost-date-time", "boost-multi-index", "boost-signals2", "boost-test", "libevent", "sqlite3", "zeromq" ], "builtin-baseline": "9edb1b8e590cc086563301d735cae4b6e732d2d2", "overrides": [ { "name": "libevent", "version": "2.1.12#7" } ] }
0
bitcoin
bitcoin/build_msvc/bitcoin.sln
Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.28803.452 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbitcoin_consensus", "libbitcoin_consensus\libbitcoin_consensus.vcxproj", "{2B384FA8-9EE1-4544-93CB-0D733C25E8CE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bitcoind", "bitcoind\bitcoind.vcxproj", "{D4513DDF-6013-44DC-ADCC-12EAF6D1F038}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbitcoin_util", "libbitcoin_util\libbitcoin_util.vcxproj", "{B53A5535-EE9D-4C6F-9A26-F79EE3BC3754}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbitcoin_common", "libbitcoin_common\libbitcoin_common.vcxproj", "{7C87E378-DF58-482E-AA2F-1BC129BC19CE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbitcoin_crypto", "libbitcoin_crypto\libbitcoin_crypto.vcxproj", "{6190199C-6CF4-4DAD-BFBD-93FA72A760C1}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbitcoin_node", "libbitcoin_node\libbitcoin_node.vcxproj", "{460FEE33-1FE1-483F-B3BF-931FF8E969A5}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libunivalue", "libunivalue\libunivalue.vcxproj", "{5724BA7D-A09A-4BA8-800B-C4C1561B3D69}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbitcoin_wallet", "libbitcoin_wallet\libbitcoin_wallet.vcxproj", "{93B86837-B543-48A5-A89B-7C87ABB77DF2}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbitcoin_zmq", "libbitcoin_zmq\libbitcoin_zmq.vcxproj", "{792D487F-F14C-49FC-A9DE-3FC150F31C3F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_bitcoin", "test_bitcoin\test_bitcoin.vcxproj", "{A56B73DB-D46D-4882-8374-1FE3FFA08F07}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbitcoin_cli", "libbitcoin_cli\libbitcoin_cli.vcxproj", "{0667528C-D734-4009-ADF9-C0D6C4A5A5A6}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bitcoin-cli", "bitcoin-cli\bitcoin-cli.vcxproj", "{0B2D7431-F876-4A58-87BF-F748338CD3BF}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bench_bitcoin", "bench_bitcoin\bench_bitcoin.vcxproj", "{1125654E-E1B2-4431-8B5C-62EA9A2FEECB}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bitcoin-tx", "bitcoin-tx\bitcoin-tx.vcxproj", "{D3022AF6-AD33-4CE3-B358-87CB6A1B29CF}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bitcoin-util", "bitcoin-util\bitcoin-util.vcxproj", "{57A04EC9-542A-4E40-83D0-AC3BE1F36805}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bitcoin-wallet", "bitcoin-wallet\bitcoin-wallet.vcxproj", "{84DE8790-EDE3-4483-81AC-C32F15E861F4}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbitcoin_wallet_tool", "libbitcoin_wallet_tool\libbitcoin_wallet_tool.vcxproj", "{F91AC55E-6F5E-4C58-9AC5-B40DB7DEEF93}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsecp256k1", "libsecp256k1\libsecp256k1.vcxproj", "{BB493552-3B8C-4A8C-BF69-A6E7A51D2EA6}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libleveldb", "libleveldb\libleveldb.vcxproj", "{18430FEF-6B61-4C53-B396-718E02850F1B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbitcoin_qt", "libbitcoin_qt\libbitcoin_qt.vcxproj", "{2B4ABFF8-D1FD-4845-88C9-1F3C0A6512BF}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bitcoin-qt", "bitcoin-qt\bitcoin-qt.vcxproj", "{7E99172D-7FF2-4CB6-B736-AC9B76ED412A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtest_util", "libtest_util\libtest_util.vcxproj", "{868474FD-35F6-4400-8EED-30A33E7521D4}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_bitcoin-qt", "test_bitcoin-qt\test_bitcoin-qt.vcxproj", "{51201D5E-D939-4854-AE9D-008F03FF518E}" EndProject Project("{542007E3-BE0D-4B0D-A6B0-AA8813E2558D}") = "libminisketch", "libminisketch\libminisketch.vcxproj", "{542007E3-BE0D-4B0D-A6B0-AA8813E2558D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {2B384FA8-9EE1-4544-93CB-0D733C25E8CE}.Debug|x64.ActiveCfg = Debug|x64 {2B384FA8-9EE1-4544-93CB-0D733C25E8CE}.Debug|x64.Build.0 = Debug|x64 {2B384FA8-9EE1-4544-93CB-0D733C25E8CE}.Release|x64.ActiveCfg = Release|x64 {2B384FA8-9EE1-4544-93CB-0D733C25E8CE}.Release|x64.Build.0 = Release|x64 {D4513DDF-6013-44DC-ADCC-12EAF6D1F038}.Debug|x64.ActiveCfg = Debug|x64 {D4513DDF-6013-44DC-ADCC-12EAF6D1F038}.Debug|x64.Build.0 = Debug|x64 {D4513DDF-6013-44DC-ADCC-12EAF6D1F038}.Release|x64.ActiveCfg = Release|x64 {D4513DDF-6013-44DC-ADCC-12EAF6D1F038}.Release|x64.Build.0 = Release|x64 {B53A5535-EE9D-4C6F-9A26-F79EE3BC3754}.Debug|x64.ActiveCfg = Debug|x64 {B53A5535-EE9D-4C6F-9A26-F79EE3BC3754}.Debug|x64.Build.0 = Debug|x64 {B53A5535-EE9D-4C6F-9A26-F79EE3BC3754}.Release|x64.ActiveCfg = Release|x64 {B53A5535-EE9D-4C6F-9A26-F79EE3BC3754}.Release|x64.Build.0 = Release|x64 {7C87E378-DF58-482E-AA2F-1BC129BC19CE}.Debug|x64.ActiveCfg = Debug|x64 {7C87E378-DF58-482E-AA2F-1BC129BC19CE}.Debug|x64.Build.0 = Debug|x64 {7C87E378-DF58-482E-AA2F-1BC129BC19CE}.Release|x64.ActiveCfg = Release|x64 {7C87E378-DF58-482E-AA2F-1BC129BC19CE}.Release|x64.Build.0 = Release|x64 {6190199C-6CF4-4DAD-BFBD-93FA72A760C1}.Debug|x64.ActiveCfg = Debug|x64 {6190199C-6CF4-4DAD-BFBD-93FA72A760C1}.Debug|x64.Build.0 = Debug|x64 {6190199C-6CF4-4DAD-BFBD-93FA72A760C1}.Release|x64.ActiveCfg = Release|x64 {6190199C-6CF4-4DAD-BFBD-93FA72A760C1}.Release|x64.Build.0 = Release|x64 {460FEE33-1FE1-483F-B3BF-931FF8E969A5}.Debug|x64.ActiveCfg = Debug|x64 {460FEE33-1FE1-483F-B3BF-931FF8E969A5}.Debug|x64.Build.0 = Debug|x64 {460FEE33-1FE1-483F-B3BF-931FF8E969A5}.Release|x64.ActiveCfg = Release|x64 {460FEE33-1FE1-483F-B3BF-931FF8E969A5}.Release|x64.Build.0 = Release|x64 {5724BA7D-A09A-4BA8-800B-C4C1561B3D69}.Debug|x64.ActiveCfg = Debug|x64 {5724BA7D-A09A-4BA8-800B-C4C1561B3D69}.Debug|x64.Build.0 = Debug|x64 {5724BA7D-A09A-4BA8-800B-C4C1561B3D69}.Release|x64.ActiveCfg = Release|x64 {5724BA7D-A09A-4BA8-800B-C4C1561B3D69}.Release|x64.Build.0 = Release|x64 {93B86837-B543-48A5-A89B-7C87ABB77DF2}.Debug|x64.ActiveCfg = Debug|x64 {93B86837-B543-48A5-A89B-7C87ABB77DF2}.Debug|x64.Build.0 = Debug|x64 {93B86837-B543-48A5-A89B-7C87ABB77DF2}.Release|x64.ActiveCfg = Release|x64 {93B86837-B543-48A5-A89B-7C87ABB77DF2}.Release|x64.Build.0 = Release|x64 {792D487F-F14C-49FC-A9DE-3FC150F31C3F}.Debug|x64.ActiveCfg = Debug|x64 {792D487F-F14C-49FC-A9DE-3FC150F31C3F}.Debug|x64.Build.0 = Debug|x64 {792D487F-F14C-49FC-A9DE-3FC150F31C3F}.Release|x64.ActiveCfg = Release|x64 {792D487F-F14C-49FC-A9DE-3FC150F31C3F}.Release|x64.Build.0 = Release|x64 {A56B73DB-D46D-4882-8374-1FE3FFA08F07}.Debug|x64.ActiveCfg = Debug|x64 {A56B73DB-D46D-4882-8374-1FE3FFA08F07}.Debug|x64.Build.0 = Debug|x64 {A56B73DB-D46D-4882-8374-1FE3FFA08F07}.Release|x64.ActiveCfg = Release|x64 {A56B73DB-D46D-4882-8374-1FE3FFA08F07}.Release|x64.Build.0 = Release|x64 {0667528C-D734-4009-ADF9-C0D6C4A5A5A6}.Debug|x64.ActiveCfg = Debug|x64 {0667528C-D734-4009-ADF9-C0D6C4A5A5A6}.Debug|x64.Build.0 = Debug|x64 {0667528C-D734-4009-ADF9-C0D6C4A5A5A6}.Release|x64.ActiveCfg = Release|x64 {0667528C-D734-4009-ADF9-C0D6C4A5A5A6}.Release|x64.Build.0 = Release|x64 {0B2D7431-F876-4A58-87BF-F748338CD3BF}.Debug|x64.ActiveCfg = Debug|x64 {0B2D7431-F876-4A58-87BF-F748338CD3BF}.Debug|x64.Build.0 = Debug|x64 {0B2D7431-F876-4A58-87BF-F748338CD3BF}.Release|x64.ActiveCfg = Release|x64 {0B2D7431-F876-4A58-87BF-F748338CD3BF}.Release|x64.Build.0 = Release|x64 {1125654E-E1B2-4431-8B5C-62EA9A2FEECB}.Debug|x64.ActiveCfg = Debug|x64 {1125654E-E1B2-4431-8B5C-62EA9A2FEECB}.Debug|x64.Build.0 = Debug|x64 {1125654E-E1B2-4431-8B5C-62EA9A2FEECB}.Release|x64.ActiveCfg = Release|x64 {1125654E-E1B2-4431-8B5C-62EA9A2FEECB}.Release|x64.Build.0 = Release|x64 {D3022AF6-AD33-4CE3-B358-87CB6A1B29CF}.Debug|x64.ActiveCfg = Debug|x64 {D3022AF6-AD33-4CE3-B358-87CB6A1B29CF}.Debug|x64.Build.0 = Debug|x64 {D3022AF6-AD33-4CE3-B358-87CB6A1B29CF}.Release|x64.ActiveCfg = Release|x64 {D3022AF6-AD33-4CE3-B358-87CB6A1B29CF}.Release|x64.Build.0 = Release|x64 {57A04EC9-542A-4E40-83D0-AC3BE1F36805}.Debug|x64.ActiveCfg = Debug|x64 {57A04EC9-542A-4E40-83D0-AC3BE1F36805}.Debug|x64.Build.0 = Debug|x64 {57A04EC9-542A-4E40-83D0-AC3BE1F36805}.Release|x64.ActiveCfg = Release|x64 {57A04EC9-542A-4E40-83D0-AC3BE1F36805}.Release|x64.Build.0 = Release|x64 {84DE8790-EDE3-4483-81AC-C32F15E861F4}.Debug|x64.ActiveCfg = Debug|x64 {84DE8790-EDE3-4483-81AC-C32F15E861F4}.Debug|x64.Build.0 = Debug|x64 {84DE8790-EDE3-4483-81AC-C32F15E861F4}.Release|x64.ActiveCfg = Release|x64 {84DE8790-EDE3-4483-81AC-C32F15E861F4}.Release|x64.Build.0 = Release|x64 {F91AC55E-6F5E-4C58-9AC5-B40DB7DEEF93}.Debug|x64.ActiveCfg = Debug|x64 {F91AC55E-6F5E-4C58-9AC5-B40DB7DEEF93}.Debug|x64.Build.0 = Debug|x64 {F91AC55E-6F5E-4C58-9AC5-B40DB7DEEF93}.Release|x64.ActiveCfg = Release|x64 {F91AC55E-6F5E-4C58-9AC5-B40DB7DEEF93}.Release|x64.Build.0 = Release|x64 {BB493552-3B8C-4A8C-BF69-A6E7A51D2EA6}.Debug|x64.ActiveCfg = Debug|x64 {BB493552-3B8C-4A8C-BF69-A6E7A51D2EA6}.Debug|x64.Build.0 = Debug|x64 {BB493552-3B8C-4A8C-BF69-A6E7A51D2EA6}.Release|x64.ActiveCfg = Release|x64 {BB493552-3B8C-4A8C-BF69-A6E7A51D2EA6}.Release|x64.Build.0 = Release|x64 {18430FEF-6B61-4C53-B396-718E02850F1B}.Debug|x64.ActiveCfg = Debug|x64 {18430FEF-6B61-4C53-B396-718E02850F1B}.Debug|x64.Build.0 = Debug|x64 {18430FEF-6B61-4C53-B396-718E02850F1B}.Release|x64.ActiveCfg = Release|x64 {18430FEF-6B61-4C53-B396-718E02850F1B}.Release|x64.Build.0 = Release|x64 {2B4ABFF8-D1FD-4845-88C9-1F3C0A6512BF}.Debug|x64.ActiveCfg = Debug|x64 {2B4ABFF8-D1FD-4845-88C9-1F3C0A6512BF}.Debug|x64.Build.0 = Debug|x64 {2B4ABFF8-D1FD-4845-88C9-1F3C0A6512BF}.Release|x64.ActiveCfg = Release|x64 {2B4ABFF8-D1FD-4845-88C9-1F3C0A6512BF}.Release|x64.Build.0 = Release|x64 {7E99172D-7FF2-4CB6-B736-AC9B76ED412A}.Debug|x64.ActiveCfg = Debug|x64 {7E99172D-7FF2-4CB6-B736-AC9B76ED412A}.Debug|x64.Build.0 = Debug|x64 {7E99172D-7FF2-4CB6-B736-AC9B76ED412A}.Release|x64.ActiveCfg = Release|x64 {7E99172D-7FF2-4CB6-B736-AC9B76ED412A}.Release|x64.Build.0 = Release|x64 {868474FD-35F6-4400-8EED-30A33E7521D4}.Debug|x64.ActiveCfg = Debug|x64 {868474FD-35F6-4400-8EED-30A33E7521D4}.Debug|x64.Build.0 = Debug|x64 {868474FD-35F6-4400-8EED-30A33E7521D4}.Release|x64.ActiveCfg = Release|x64 {868474FD-35F6-4400-8EED-30A33E7521D4}.Release|x64.Build.0 = Release|x64 {51201D5E-D939-4854-AE9D-008F03FF518E}.Debug|x64.ActiveCfg = Debug|x64 {51201D5E-D939-4854-AE9D-008F03FF518E}.Debug|x64.Build.0 = Debug|x64 {51201D5E-D939-4854-AE9D-008F03FF518E}.Release|x64.ActiveCfg = Release|x64 {51201D5E-D939-4854-AE9D-008F03FF518E}.Release|x64.Build.0 = Release|x64 {542007E3-BE0D-4B0D-A6B0-AA8813E2558D}.Debug|x64.ActiveCfg = Debug|x64 {542007E3-BE0D-4B0D-A6B0-AA8813E2558D}.Debug|x64.Build.0 = Debug|x64 {542007E3-BE0D-4B0D-A6B0-AA8813E2558D}.Release|x64.ActiveCfg = Release|x64 {542007E3-BE0D-4B0D-A6B0-AA8813E2558D}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {58AAB032-7274-49BD-845E-5EF4DBB69B70} EndGlobalSection EndGlobal
0
bitcoin
bitcoin/build_msvc/bitcoin_config.h.in
// Copyright (c) 2018-2020 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_BITCOIN_CONFIG_H #define BITCOIN_BITCOIN_CONFIG_H /* Version Build */ #define CLIENT_VERSION_BUILD $ /* Version is release */ #define CLIENT_VERSION_IS_RELEASE $ /* Major version */ #define CLIENT_VERSION_MAJOR $ /* Minor version */ #define CLIENT_VERSION_MINOR $ /* Copyright holder(s) before %s replacement */ #define COPYRIGHT_HOLDERS "The %s developers" /* Copyright holder(s) */ #define COPYRIGHT_HOLDERS_FINAL "The Bitcoin Core developers" /* Replacement for %s in copyright holders string */ #define COPYRIGHT_HOLDERS_SUBSTITUTION "Bitcoin Core" /* Copyright year */ #define COPYRIGHT_YEAR $ /* Define to 1 to enable wallet functions */ #define ENABLE_WALLET 1 /* Define to 1 to enable BDB wallet */ #define USE_BDB 1 /* Define to 1 to enable SQLite wallet */ #define USE_SQLITE 1 /* Define this symbol to enable ZMQ functions */ #define ENABLE_ZMQ 1 /* Define to 1 if you have the declaration of `be16toh', and to 0 if you don't. */ #define HAVE_DECL_BE16TOH 0 /* Define to 1 if you have the declaration of `be32toh', and to 0 if you don't. */ #define HAVE_DECL_BE32TOH 0 /* Define to 1 if you have the declaration of `be64toh', and to 0 if you don't. */ #define HAVE_DECL_BE64TOH 0 /* Define to 1 if you have the declaration of `bswap_16', and to 0 if you don't. */ #define HAVE_DECL_BSWAP_16 0 /* Define to 1 if you have the declaration of `bswap_32', and to 0 if you don't. */ #define HAVE_DECL_BSWAP_32 0 /* Define to 1 if you have the declaration of `bswap_64', and to 0 if you don't. */ #define HAVE_DECL_BSWAP_64 0 /* Define to 1 if you have the declaration of `fork', and to 0 if you don't. */ #define HAVE_DECL_FORK 0 /* Define to 1 if you have the declaration of `htobe16', and to 0 if you don't. */ #define HAVE_DECL_HTOBE16 0 /* Define to 1 if you have the declaration of `htobe32', and to 0 if you don't. */ #define HAVE_DECL_HTOBE32 0 /* Define to 1 if you have the declaration of `htobe64', and to 0 if you don't. */ #define HAVE_DECL_HTOBE64 0 /* Define to 1 if you have the declaration of `htole16', and to 0 if you don't. */ #define HAVE_DECL_HTOLE16 0 /* Define to 1 if you have the declaration of `htole32', and to 0 if you don't. */ #define HAVE_DECL_HTOLE32 0 /* Define to 1 if you have the declaration of `htole64', and to 0 if you don't. */ #define HAVE_DECL_HTOLE64 0 /* Define to 1 if you have the declaration of `le16toh', and to 0 if you don't. */ #define HAVE_DECL_LE16TOH 0 /* Define to 1 if you have the declaration of `le32toh', and to 0 if you don't. */ #define HAVE_DECL_LE32TOH 0 /* Define to 1 if you have the declaration of `le64toh', and to 0 if you don't. */ #define HAVE_DECL_LE64TOH 0 /* Define to 1 if you have the declaration of `setsid', and to 0 if you don't. */ #define HAVE_DECL_SETSID 0 /* Define if the dllexport attribute is supported. */ #define HAVE_DLLEXPORT_ATTRIBUTE 1 /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "https://github.com/bitcoin/bitcoin/issues" /* Define to the full name of this package. */ #define PACKAGE_NAME "Bitcoin Core" /* Define to the full name and version of this package. */ #define PACKAGE_STRING $ /* Define to the home page for this package. */ #define PACKAGE_URL "https://bitcoincore.org/" /* Define to the version of this package. */ #define PACKAGE_VERSION $ /* Define this symbol if the minimal qt platform exists */ #define QT_QPA_PLATFORM_MINIMAL 1 /* Define this symbol if the qt platform is windows */ #define QT_QPA_PLATFORM_WINDOWS 1 /* Define this symbol if qt plugins are static */ #define QT_STATICPLUGIN 1 /* Windows Universal Platform constraints */ #if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) /* Either a desktop application without API restrictions, or and older system before these macros were defined. */ /* ::wsystem is available */ #define HAVE_SYSTEM 1 #endif // !WINAPI_FAMILY || WINAPI_FAMILY_DESKTOP_APP #endif //BITCOIN_BITCOIN_CONFIG_H
0
bitcoin
bitcoin/build_msvc/common.vcxproj
<?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup><BuildDependsOn>$(BuildDependsOn);CopyBuildArtifacts</BuildDependsOn></PropertyGroup> <Target Name="CopyBuildArtifacts" Condition="'$(ConfigurationType)' != 'StaticLibrary'"> <ItemGroup> <BuildArtifacts Include="$(OutDir)$(TargetName)$(TargetExt)"></BuildArtifacts> <BuildArtifacts Include="$(OutDir)$(TargetName).pdb" Condition="Exists('$(OutDir)$(TargetName).pdb')"></BuildArtifacts> </ItemGroup> <Copy SourceFiles="@(BuildArtifacts)" SkipUnchangedFiles="true" DestinationFolder="..\..\src\" Condition="'$(OutDir)' != ''"></Copy> </Target> <Import Project="common.vcxproj.user" Condition="Exists('common.vcxproj.user')" /> </Project>
0
bitcoin
bitcoin/build_msvc/msvc-autogen.py
#!/usr/bin/env python3 # Copyright (c) 2016-2022 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. import os import re import argparse from shutil import copyfile SOURCE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'src')) DEFAULT_PLATFORM_TOOLSET = R'v143' libs = [ 'libbitcoin_cli', 'libbitcoin_common', 'libbitcoin_crypto', 'libbitcoin_node', 'libbitcoin_util', 'libbitcoin_wallet_tool', 'libbitcoin_wallet', 'libbitcoin_zmq', 'bench_bitcoin', 'libtest_util', ] ignore_list = [ ] lib_sources = {} def parse_makefile(makefile): with open(makefile, 'r', encoding='utf-8') as file: current_lib = '' for line in file.read().splitlines(): if current_lib: source = line.split()[0] if source.endswith('.cpp') and not source.startswith('$') and source not in ignore_list: source_filename = source.replace('/', '\\') object_filename = source.replace('/', '_')[:-4] + ".obj" lib_sources[current_lib].append((source_filename, object_filename)) if not line.endswith('\\'): current_lib = '' continue for lib in libs: _lib = lib.replace('-', '_') if re.search(_lib + '.*_SOURCES \\= \\\\', line): current_lib = lib lib_sources[current_lib] = [] break def parse_config_into_btc_config(): def find_between( s, first, last ): try: start = s.index( first ) + len( first ) end = s.index( last, start ) return s[start:end] except ValueError: return "" config_info = [] with open(os.path.join(SOURCE_DIR,'../configure.ac'), encoding="utf8") as f: for line in f: if line.startswith("define"): config_info.append(find_between(line, "(_", ")")) config_info = [c for c in config_info if not c.startswith("COPYRIGHT_HOLDERS")] config_dict = dict(item.split(", ") for item in config_info) config_dict["PACKAGE_VERSION"] = f"\"{config_dict['CLIENT_VERSION_MAJOR']}.{config_dict['CLIENT_VERSION_MINOR']}.{config_dict['CLIENT_VERSION_BUILD']}\"" version = config_dict["PACKAGE_VERSION"].strip('"') config_dict["PACKAGE_STRING"] = f"\"Bitcoin Core {version}\"" with open(os.path.join(SOURCE_DIR,'../build_msvc/bitcoin_config.h.in'), "r", encoding="utf8") as template_file: template = template_file.readlines() for index, line in enumerate(template): header = "" if line.startswith("#define"): header = line.split(" ")[1] if header in config_dict: template[index] = line.replace("$", f"{config_dict[header]}") with open(os.path.join(SOURCE_DIR,'../build_msvc/bitcoin_config.h'), "w", encoding="utf8") as btc_config: btc_config.writelines(template) def set_properties(vcxproj_filename, placeholder, content): with open(vcxproj_filename + '.in', 'r', encoding='utf-8') as vcxproj_in_file: with open(vcxproj_filename, 'w', encoding='utf-8') as vcxproj_file: vcxproj_file.write(vcxproj_in_file.read().replace(placeholder, content)) def main(): parser = argparse.ArgumentParser(description='Bitcoin-core msbuild configuration initialiser.') parser.add_argument('-toolset', nargs='?', default=DEFAULT_PLATFORM_TOOLSET, help='Optionally sets the msbuild platform toolset, e.g. v143 for Visual Studio 2022.' ' default is %s.'%DEFAULT_PLATFORM_TOOLSET) args = parser.parse_args() set_properties(os.path.join(SOURCE_DIR, '../build_msvc/common.init.vcxproj'), '@TOOLSET@', args.toolset) for makefile_name in os.listdir(SOURCE_DIR): if 'Makefile' in makefile_name: parse_makefile(os.path.join(SOURCE_DIR, makefile_name)) for key, value in lib_sources.items(): vcxproj_filename = os.path.abspath(os.path.join(os.path.dirname(__file__), key, key + '.vcxproj')) content = '' for source_filename, object_filename in value: content += ' <ClCompile Include="..\\..\\src\\' + source_filename + '">\n' content += ' <ObjectFileName>$(IntDir)' + object_filename + '</ObjectFileName>\n' content += ' </ClCompile>\n' set_properties(vcxproj_filename, '@SOURCE_FILES@\n', content) parse_config_into_btc_config() copyfile(os.path.join(SOURCE_DIR,'../build_msvc/bitcoin_config.h'), os.path.join(SOURCE_DIR, 'config/bitcoin-config.h')) if __name__ == '__main__': main()
0
bitcoin/build_msvc
bitcoin/build_msvc/libbitcoin_cli/libbitcoin_cli.vcxproj.in
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{0667528C-D734-4009-ADF9-C0D6C4A5A5A6}</ProjectGuid> </PropertyGroup> <PropertyGroup> <ConfigurationType>StaticLibrary</ConfigurationType> </PropertyGroup> <ItemGroup> @SOURCE_FILES@ </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/bench_bitcoin/bench_bitcoin.vcxproj.in
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{1125654E-E1B2-4431-8B5C-62EA9A2FEECB}</ProjectGuid> </PropertyGroup> <PropertyGroup> <ConfigurationType>Application</ConfigurationType> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> </PropertyGroup> <ItemGroup> @SOURCE_FILES@ </ItemGroup> <ItemGroup> <ProjectReference Include="..\libbitcoin_consensus\libbitcoin_consensus.vcxproj"> <Project>{2b384fa8-9ee1-4544-93cb-0d733c25e8ce}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_common\libbitcoin_common.vcxproj"> <Project>{7c87e378-df58-482e-aa2f-1bc129bc19ce}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_crypto\libbitcoin_crypto.vcxproj"> <Project>{6190199c-6cf4-4dad-bfbd-93fa72a760c1}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_node\libbitcoin_node.vcxproj"> <Project>{460fee33-1fe1-483f-b3bf-931ff8e969a5}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_util\libbitcoin_util.vcxproj"> <Project>{b53a5535-ee9d-4c6f-9a26-f79ee3bc3754}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_wallet\libbitcoin_wallet.vcxproj"> <Project>{93b86837-b543-48a5-a89b-7c87abb77df2}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_zmq\libbitcoin_zmq.vcxproj"> <Project>{792d487f-f14c-49fc-a9de-3fc150f31c3f}</Project> </ProjectReference> <ProjectReference Include="..\libunivalue\libunivalue.vcxproj"> <Project>{5724ba7d-a09a-4ba8-800b-c4c1561b3d69}</Project> </ProjectReference> <ProjectReference Include="..\libsecp256k1\libsecp256k1.vcxproj"> <Project>{bb493552-3b8c-4a8c-bf69-a6e7a51d2ea6}</Project> </ProjectReference> <ProjectReference Include="..\libleveldb\libleveldb.vcxproj"> <Project>{18430fef-6b61-4c53-b396-718e02850f1b}</Project> </ProjectReference> <ProjectReference Include="..\libtest_util\libtest_util.vcxproj"> <Project>{1e065f03-3566-47d0-8fa9-daa72b084e7d}</Project> </ProjectReference> </ItemGroup> <Target Name="RawBenchHeaderGen" BeforeTargets="PrepareForBuild"> <PropertyGroup> <ErrorText>There was an error executing the raw bench header generation task.</ErrorText> </PropertyGroup> <ItemGroup> <RawBenchFile Include="..\..\src\bench\data\*.raw" /> </ItemGroup> <HeaderFromHexdump RawFilePath="%(RawBenchFile.FullPath)" HeaderFilePath="%(RawBenchFile.FullPath).h" SourceHeader="static unsigned const char %(RawBenchFile.Filename)_raw[] = {" SourceFooter="};" /> </Target> <Import Label="hexdumpTarget" Project="..\msbuild\tasks\hexdump.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc/msbuild
bitcoin/build_msvc/msbuild/tasks/hexdump.targets
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <UsingTask TaskName="HeaderFromHexdump" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll" > <ParameterGroup> <RawFilePath Required="true" /> <HeaderFilePath Required="true" /> <SourceHeader Required="true" /> <SourceFooter Required="true" /> </ParameterGroup> <Task> <Using Namespace="System"/> <Using Namespace="System.IO"/> <Code Type="Fragment" Language="cs"> <![CDATA[ Log.LogMessage("msbuild inline hexdump task for " + RawFilePath + "."); if(File.Exists(RawFilePath) == false) { Log.LogError("hexdump task could not locate " + RawFilePath + "."); } else { FileInfo inFileInfo = new FileInfo(RawFilePath); FileInfo outFileInfo = new FileInfo(HeaderFilePath); if (outFileInfo.Exists == false || inFileInfo.LastWriteTime > outFileInfo.LastWriteTime) { using (Stream inStm = File.OpenRead(RawFilePath)) { using (StreamWriter sw = new StreamWriter(HeaderFilePath)) { sw.WriteLine(SourceHeader); int count = 0; int rawChar = inStm.ReadByte(); while(rawChar != -1) { sw.Write("0x{0:x2}, ", rawChar); count++; if(count % 8 == 0) { sw.WriteLine(); } rawChar = inStm.ReadByte(); } sw.WriteLine(SourceFooter); } } } } ]]> </Code> </Task> </UsingTask> </Project>
0
bitcoin/build_msvc/msbuild
bitcoin/build_msvc/msbuild/tasks/replaceinfile.targets
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <UsingTask TaskName="ReplaceInFile" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll" > <ParameterGroup> <FilePath Required="true" /> <Replace Required="true" /> <By Required="false" /> <ToFullPath Required="false" /> </ParameterGroup> <Task> <Using Namespace="System"/> <Using Namespace="System.IO"/> <Code Type="Fragment" Language="cs"> <![CDATA[ if(File.Exists(FilePath) == false) { Log.LogError("replaceinfile task could not locate " + FilePath + "."); } else { var data = File.ReadAllText(FilePath); var by = By; if (ToFullPath == "true") { by = Path.GetFullPath(by); } data = data.Replace(Replace, by); Log.LogMessage("Replace '" + Replace + "' by '" + by + "' in " + FilePath); File.WriteAllText(FilePath, data, new System.Text.UTF8Encoding(false)); } ]]> </Code> </Task> </UsingTask> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/bitcoind/bitcoind.vcxproj
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{D4513DDF-6013-44DC-ADCC-12EAF6D1F038}</ProjectGuid> </PropertyGroup> <PropertyGroup Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> </PropertyGroup> <ItemGroup> <ClCompile Include="..\..\src\bitcoind.cpp" /> <ClCompile Include="..\..\src\init\bitcoind.cpp"> <ObjectFileName>$(IntDir)init_bitcoind.obj</ObjectFileName> </ClCompile> </ItemGroup> <ItemGroup> <ProjectReference Include="..\libbitcoin_consensus\libbitcoin_consensus.vcxproj"> <Project>{2b384fa8-9ee1-4544-93cb-0d733c25e8ce}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_common\libbitcoin_common.vcxproj"> <Project>{7c87e378-df58-482e-aa2f-1bc129bc19ce}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_crypto\libbitcoin_crypto.vcxproj"> <Project>{6190199c-6cf4-4dad-bfbd-93fa72a760c1}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_node\libbitcoin_node.vcxproj"> <Project>{460fee33-1fe1-483f-b3bf-931ff8e969a5}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_util\libbitcoin_util.vcxproj"> <Project>{b53a5535-ee9d-4c6f-9a26-f79ee3bc3754}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_wallet\libbitcoin_wallet.vcxproj"> <Project>{93b86837-b543-48a5-a89b-7c87abb77df2}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_zmq\libbitcoin_zmq.vcxproj"> <Project>{792d487f-f14c-49fc-a9de-3fc150f31c3f}</Project> </ProjectReference> <ProjectReference Include="..\libunivalue\libunivalue.vcxproj"> <Project>{5724ba7d-a09a-4ba8-800b-c4c1561b3d69}</Project> </ProjectReference> <ProjectReference Include="..\libsecp256k1\libsecp256k1.vcxproj"> <Project>{bb493552-3b8c-4a8c-bf69-a6e7a51d2ea6}</Project> </ProjectReference> <ProjectReference Include="..\libleveldb\libleveldb.vcxproj"> <Project>{18430fef-6b61-4c53-b396-718e02850f1b}</Project> </ProjectReference> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Label="ReplaceInFile" Project="..\msbuild\tasks\replaceinfile.targets" /> <PropertyGroup> <ConfigIniIn>..\..\test\config.ini.in</ConfigIniIn> <ConfigIniOut>..\..\test\config.ini</ConfigIniOut> </PropertyGroup> <Target Name="AfterBuild"> <Copy SourceFiles="$(ConfigIniIn)" DestinationFiles="$(ConfigIniOut)" ></Copy> <ReplaceInFile FilePath="$(ConfigIniOut)" Replace="@PACKAGE_NAME@" By="Bitcoin Core"></ReplaceInFile> <ReplaceInFile FilePath="$(ConfigIniOut)" Replace="@PACKAGE_BUGREPORT@" By="https://github.com/bitcoin/bitcoin/issues"></ReplaceInFile> <ReplaceInFile FilePath="$(ConfigIniOut)" Replace="@abs_top_srcdir@" By="..\.." ToFullPath="true"></ReplaceInFile> <ReplaceInFile FilePath="$(ConfigIniOut)" Replace="@abs_top_builddir@" By="..\.." ToFullPath="true"></ReplaceInFile> <ReplaceInFile FilePath="$(ConfigIniOut)" Replace="@EXEEXT@" By=".exe"></ReplaceInFile> <ReplaceInFile FilePath="$(ConfigIniOut)" Replace="@ENABLE_WALLET_TRUE@" By=""></ReplaceInFile> <ReplaceInFile FilePath="$(ConfigIniOut)" Replace="@USE_BDB_TRUE@" By=""></ReplaceInFile> <ReplaceInFile FilePath="$(ConfigIniOut)" Replace="@USE_SQLITE_TRUE@" By=""></ReplaceInFile> <ReplaceInFile FilePath="$(ConfigIniOut)" Replace="@BUILD_BITCOIN_CLI_TRUE@" By=""></ReplaceInFile> <ReplaceInFile FilePath="$(ConfigIniOut)" Replace="@BUILD_BITCOIN_UTIL_TRUE@" By=""></ReplaceInFile> <ReplaceInFile FilePath="$(ConfigIniOut)" Replace="@BUILD_BITCOIN_WALLET_TRUE@" By=""></ReplaceInFile> <ReplaceInFile FilePath="$(ConfigIniOut)" Replace="@BUILD_BITCOIND_TRUE@" By=""></ReplaceInFile> <ReplaceInFile FilePath="$(ConfigIniOut)" Replace="@ENABLE_FUZZ_BINARY_TRUE@" By="#"></ReplaceInFile> <ReplaceInFile FilePath="$(ConfigIniOut)" Replace="@ENABLE_ZMQ_TRUE@" By=""></ReplaceInFile> <ReplaceInFile FilePath="$(ConfigIniOut)" Replace="@ENABLE_EXTERNAL_SIGNER_TRUE@" By="#"></ReplaceInFile> <ReplaceInFile FilePath="$(ConfigIniOut)" Replace="@ENABLE_USDT_TRACEPOINTS_TRUE@" By="#"></ReplaceInFile> </Target> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/libbitcoin_qt/libbitcoin_qt.vcxproj
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <Import Project="..\common.qt.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{2B4ABFF8-D1FD-4845-88C9-1F3C0A6512BF}</ProjectGuid> <ConfigurationType>StaticLibrary</ConfigurationType> </PropertyGroup> <ItemGroup> <ClCompile Include="..\..\src\qt\addressbookpage.cpp" /> <ClCompile Include="..\..\src\qt\addresstablemodel.cpp" /> <ClCompile Include="..\..\src\qt\askpassphrasedialog.cpp" /> <ClCompile Include="..\..\src\qt\bantablemodel.cpp" /> <ClCompile Include="..\..\src\qt\bitcoin.cpp" /> <ClCompile Include="..\..\src\qt\bitcoinaddressvalidator.cpp" /> <ClCompile Include="..\..\src\qt\bitcoinamountfield.cpp" /> <ClCompile Include="..\..\src\qt\bitcoingui.cpp" /> <ClCompile Include="..\..\src\qt\bitcoinstrings.cpp" /> <ClCompile Include="..\..\src\qt\bitcoinunits.cpp" /> <ClCompile Include="..\..\src\qt\clientmodel.cpp" /> <ClCompile Include="..\..\src\qt\coincontroldialog.cpp" /> <ClCompile Include="..\..\src\qt\coincontroltreewidget.cpp" /> <ClCompile Include="..\..\src\qt\createwalletdialog.cpp" /> <ClCompile Include="..\..\src\qt\csvmodelwriter.cpp" /> <ClCompile Include="..\..\src\qt\editaddressdialog.cpp" /> <ClCompile Include="..\..\src\qt\guiutil.cpp" /> <ClCompile Include="..\..\src\qt\initexecutor.cpp" /> <ClCompile Include="..\..\src\qt\intro.cpp" /> <ClCompile Include="..\..\src\qt\modaloverlay.cpp" /> <ClCompile Include="..\..\src\qt\networkstyle.cpp" /> <ClCompile Include="..\..\src\qt\notificator.cpp" /> <ClCompile Include="..\..\src\qt\openuridialog.cpp" /> <ClCompile Include="..\..\src\qt\optionsdialog.cpp" /> <ClCompile Include="..\..\src\qt\optionsmodel.cpp" /> <ClCompile Include="..\..\src\qt\overviewpage.cpp" /> <ClCompile Include="..\..\src\qt\paymentserver.cpp" /> <ClCompile Include="..\..\src\qt\peertablemodel.cpp" /> <ClCompile Include="..\..\src\qt\peertablesortproxy.cpp" /> <ClCompile Include="..\..\src\qt\platformstyle.cpp" /> <ClCompile Include="..\..\src\qt\psbtoperationsdialog.cpp" /> <ClCompile Include="..\..\src\qt\qrimagewidget.cpp" /> <ClCompile Include="..\..\src\qt\qvalidatedlineedit.cpp" /> <ClCompile Include="..\..\src\qt\qvaluecombobox.cpp" /> <ClCompile Include="..\..\src\qt\receivecoinsdialog.cpp" /> <ClCompile Include="..\..\src\qt\receiverequestdialog.cpp" /> <ClCompile Include="..\..\src\qt\recentrequeststablemodel.cpp" /> <ClCompile Include="..\..\src\qt\rpcconsole.cpp" /> <ClCompile Include="..\..\src\qt\sendcoinsdialog.cpp" /> <ClCompile Include="..\..\src\qt\sendcoinsentry.cpp" /> <ClCompile Include="..\..\src\qt\signverifymessagedialog.cpp" /> <ClCompile Include="..\..\src\qt\splashscreen.cpp" /> <ClCompile Include="..\..\src\qt\trafficgraphwidget.cpp" /> <ClCompile Include="..\..\src\qt\transactiondesc.cpp" /> <ClCompile Include="..\..\src\qt\transactiondescdialog.cpp" /> <ClCompile Include="..\..\src\qt\transactionfilterproxy.cpp" /> <ClCompile Include="..\..\src\qt\transactionoverviewwidget.cpp" /> <ClCompile Include="..\..\src\qt\transactionrecord.cpp" /> <ClCompile Include="..\..\src\qt\transactiontablemodel.cpp" /> <ClCompile Include="..\..\src\qt\transactionview.cpp" /> <ClCompile Include="..\..\src\qt\utilitydialog.cpp" /> <ClCompile Include="..\..\src\qt\walletcontroller.cpp" /> <ClCompile Include="..\..\src\qt\walletframe.cpp" /> <ClCompile Include="..\..\src\qt\walletmodel.cpp" /> <ClCompile Include="..\..\src\qt\walletmodeltransaction.cpp" /> <ClCompile Include="..\..\src\qt\walletview.cpp" /> <ClCompile Include="..\..\src\qt\winshutdownmonitor.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_addressbookpage.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_addresstablemodel.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_askpassphrasedialog.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_bantablemodel.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_bitcoin.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_bitcoinaddressvalidator.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_bitcoinamountfield.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_bitcoingui.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_bitcoinunits.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_clientmodel.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_coincontroldialog.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_coincontroltreewidget.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_createwalletdialog.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_csvmodelwriter.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_editaddressdialog.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_guiutil.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_initexecutor.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_intro.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_modaloverlay.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_networkstyle.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_notificator.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_openuridialog.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_optionsdialog.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_optionsmodel.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_overviewpage.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_paymentserver.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_peertablemodel.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_peertablesortproxy.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_platformstyle.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_psbtoperationsdialog.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_qrimagewidget.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_qvalidatedlineedit.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_qvaluecombobox.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_receivecoinsdialog.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_receiverequestdialog.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_recentrequeststablemodel.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_rpcconsole.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_sendcoinsdialog.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_sendcoinsentry.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_signverifymessagedialog.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_splashscreen.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_trafficgraphwidget.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_transactiondesc.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_transactiondescdialog.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_transactionfilterproxy.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_transactionoverviewwidget.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_transactionrecord.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_transactiontablemodel.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_transactionview.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_utilitydialog.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_walletcontroller.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_walletframe.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_walletmodel.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_walletmodeltransaction.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_walletview.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_winshutdownmonitor.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\rcc\qrc_bitcoin.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\rcc\qrc_bitcoin_locale.cpp" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ClCompile> <PreprocessorDefinitions>_AMD64_;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>$(QtIncludes);$(GeneratedFilesOutDir)\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> <PreprocessorDefinitions>_AMD64_;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>$(QtIncludes);$(GeneratedFilesOutDir)\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> </ItemDefinitionGroup> <ItemGroup> <QT_MOC Include="..\..\src\qt\bitcoinamountfield.cpp" /> <QT_MOC Include="..\..\src\qt\intro.cpp" /> <QT_MOC Include="..\..\src\qt\overviewpage.cpp" /> <QT_MOC Include="..\..\src\qt\rpcconsole.cpp" /> <MocHeaderFiles Include="..\..\src\qt\*.h" /> <ResourceTemplates Include="..\..\src\qt\*.qrc" /> <UiFormFiles Include="..\..\src\qt\forms\*.ui" /> <TranslationFiles Include="..\..\src\qt\locale\*.ts" /> </ItemGroup> <Target Name="moccode" Inputs="@(QT_MOC)" Outputs="@(QT_MOC->'$(GeneratedFilesOutDir)\%(Filename).moc')"> <PropertyGroup> <ErrorText>There was an error executing the libbitcoin_qt moc code include generation task.</ErrorText> </PropertyGroup> <MakeDir Directories="$(GeneratedFilesOutDir)" /> <Exec Command="echo Performing libbitcoin_qt moc code include generation task, output path $(GeneratedFilesOutDir)." /> <Exec Command="echo $(QtToolsDir)\moc.exe $(MOC_DEFINES) &quot;%(QT_MOC.Identity)&quot; -o $(GeneratedFilesOutDir)\%(Filename).moc." /> <Exec Command="$(QtToolsDir)\moc.exe $(MOC_DEFINES) &quot;%(QT_MOC.Identity)&quot; -o $(GeneratedFilesOutDir)\%(Filename).moc" /> </Target> <Target Name="mocheader" Inputs="@(MocHeaderFiles)" Outputs="@(MocHeaderFiles->'$(GeneratedFilesOutDir)\moc\moc_%(Filename).cpp')"> <PropertyGroup> <ErrorText>There was an error executing the libbitcoin_qt moc header generation task.</ErrorText> </PropertyGroup> <Exec Command="echo Performing libbitcoin_qt moc header generation task, output path $(GeneratedFilesOutDir)\moc." /> <Exec Command="echo $(QtToolsDir)\moc.exe $(MOC_DEFINES) &quot;%(MocHeaderFiles.Identity)&quot; -o $(GeneratedFilesOutDir)\moc\moc_%(Filename).cpp." /> <MakeDir Directories="$(GeneratedFilesOutDir)\moc\" /> <Exec Command="$(QtToolsDir)\moc.exe $(MOC_DEFINES) &quot;%(MocHeaderFiles.Identity)&quot; -o $(GeneratedFilesOutDir)\moc\moc_%(Filename).cpp" /> </Target> <Target Name="forms" Inputs="@(UiFormFiles)" Outputs="@(UiFormFiles->'$(GeneratedFilesOutDir)\forms\ui_%(Filename).h')"> <PropertyGroup> <ErrorText>There was an error executing the libbitcoin_qt forms header generation task.</ErrorText> </PropertyGroup> <Exec Command="echo Performing libbitcoin_qt forms header generation task, output path $(GeneratedFilesOutDir)\forms." /> <MakeDir Directories="$(GeneratedFilesOutDir)\forms\" /> <Exec Command="$(QtToolsDir)\uic.exe &quot;%(UiFormFiles.Identity)&quot; -o $(GeneratedFilesOutDir)\forms\ui_%(Filename).h" /> </Target> <Target Name="translation" Inputs="@(TranslationFiles)" Outputs="@(TranslationFiles->'..\..\src\qt\locale\%(Filename).qm')"> <PropertyGroup> <ErrorText>There was an error executing the libbitcoin_qt translation file generation task.</ErrorText> </PropertyGroup> <Exec Command="echo Performing libbitcoin_qt translation file generation task." /> <Exec Command="$(QtToolsDir)\lrelease.exe &quot;%(TranslationFiles.Identity)&quot; -qm ..\..\src\qt\locale\%(Filename).qm" /> </Target> <Target Name="resource" Inputs="@(ResourceTemplates)" Outputs="@(ResourceTemplates->'$(GeneratedFilesOutDir)\rcc\qrc_%(Filename).cpp')" DependsOnTargets="translation"> <PropertyGroup> <ErrorText>There was an error executing the libbitcoin_qt resource code generation task.</ErrorText> </PropertyGroup> <Exec Command="echo Performing libbitcoin_qt resource code generation task, output path $(GeneratedFilesOutDir)\rcc." /> <MakeDir Directories="$(GeneratedFilesOutDir)\rcc\" /> <Exec Command="$(QtToolsDir)\rcc.exe --verbose --name %(Filename) &quot;%(ResourceTemplates.Identity)&quot; -o $(GeneratedFilesOutDir)\rcc\qrc_%(Filename).cpp" /> </Target> <Target Name="qtclean"> <Exec Command="echo Clean libbitcoin_qt generated files from $(GeneratedFilesOutDir)." /> <RemoveDir Directories="$(GeneratedFilesOutDir)\forms;$(GeneratedFilesOutDir)\moc;$(GeneratedFilesOutDir)\rcc;" /> <RemoveDir Directories="$(GeneratedFilesOutDir)" /> </Target> <PropertyGroup> <BuildDependsOn> moccode; mocheader; forms; translation; resource; $(BuildDependsOn); </BuildDependsOn> </PropertyGroup> <PropertyGroup> <CleanDependsOn> qtclean; $(CleanDependsOn); </CleanDependsOn> </PropertyGroup> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/bitcoin-wallet/bitcoin-wallet.vcxproj
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{84DE8790-EDE3-4483-81AC-C32F15E861F4}</ProjectGuid> </PropertyGroup> <PropertyGroup Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> </PropertyGroup> <ItemGroup> <ClCompile Include="..\..\src\bitcoin-wallet.cpp" /> <ClCompile Include="..\..\src\init\bitcoin-wallet.cpp"> <ObjectFileName>$(IntDir)init_bitcoin-wallet.obj</ObjectFileName> </ClCompile> </ItemGroup> <ItemGroup> <ProjectReference Include="..\libbitcoin_consensus\libbitcoin_consensus.vcxproj"> <Project>{2b384fa8-9ee1-4544-93cb-0d733c25e8ce}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_common\libbitcoin_common.vcxproj"> <Project>{7c87e378-df58-482e-aa2f-1bc129bc19ce}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_crypto\libbitcoin_crypto.vcxproj"> <Project>{6190199c-6cf4-4dad-bfbd-93fa72a760c1}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_util\libbitcoin_util.vcxproj"> <Project>{b53a5535-ee9d-4c6f-9a26-f79ee3bc3754}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_wallet\libbitcoin_wallet.vcxproj"> <Project>{93b86837-b543-48a5-a89b-7c87abb77df2}</Project> </ProjectReference> <ProjectReference Include="..\libunivalue\libunivalue.vcxproj"> <Project>{5724ba7d-a09a-4ba8-800b-c4c1561b3d69}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_wallet_tool\libbitcoin_wallet_tool.vcxproj"> <Project>{f91ac55e-6f5e-4c58-9ac5-b40db7deef93}</Project> </ProjectReference> <ProjectReference Include="..\libsecp256k1\libsecp256k1.vcxproj"> <Project>{bb493552-3b8c-4a8c-bf69-a6e7a51d2ea6}</Project> </ProjectReference> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/libbitcoin_common/libbitcoin_common.vcxproj.in
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{7C87E378-DF58-482E-AA2F-1BC129BC19CE}</ProjectGuid> </PropertyGroup> <PropertyGroup Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> </PropertyGroup> <ItemGroup> <ClCompile Include="..\..\src\common\url.cpp" /> @SOURCE_FILES@ </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/libleveldb/libleveldb.vcxproj
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{18430FEF-6B61-4C53-B396-718E02850F1B}</ProjectGuid> </PropertyGroup> <PropertyGroup Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> </PropertyGroup> <ItemGroup> <ClCompile Include="..\..\src\leveldb\db\builder.cc" /> <ClCompile Include="..\..\src\leveldb\db\c.cc" /> <ClCompile Include="..\..\src\leveldb\db\dbformat.cc" /> <ClCompile Include="..\..\src\leveldb\db\db_impl.cc" /> <ClCompile Include="..\..\src\leveldb\db\db_iter.cc" /> <ClCompile Include="..\..\src\leveldb\db\dumpfile.cc" /> <ClCompile Include="..\..\src\leveldb\db\filename.cc" /> <ClCompile Include="..\..\src\leveldb\db\log_reader.cc" /> <ClCompile Include="..\..\src\leveldb\db\log_writer.cc" /> <ClCompile Include="..\..\src\leveldb\db\memtable.cc" /> <ClCompile Include="..\..\src\leveldb\db\repair.cc" /> <ClCompile Include="..\..\src\leveldb\db\table_cache.cc" /> <ClCompile Include="..\..\src\leveldb\db\version_edit.cc" /> <ClCompile Include="..\..\src\leveldb\db\version_set.cc" /> <ClCompile Include="..\..\src\leveldb\db\write_batch.cc" /> <ClCompile Include="..\..\src\leveldb\helpers\memenv\memenv.cc" /> <ClCompile Include="..\..\src\leveldb\table\block.cc" /> <ClCompile Include="..\..\src\leveldb\table\block_builder.cc" /> <ClCompile Include="..\..\src\leveldb\table\filter_block.cc" /> <ClCompile Include="..\..\src\leveldb\table\format.cc" /> <ClCompile Include="..\..\src\leveldb\table\iterator.cc" /> <ClCompile Include="..\..\src\leveldb\table\merger.cc" /> <ClCompile Include="..\..\src\leveldb\table\table.cc" /> <ClCompile Include="..\..\src\leveldb\table\table_builder.cc" /> <ClCompile Include="..\..\src\leveldb\table\two_level_iterator.cc" /> <ClCompile Include="..\..\src\leveldb\util\arena.cc" /> <ClCompile Include="..\..\src\leveldb\util\bloom.cc" /> <ClCompile Include="..\..\src\leveldb\util\cache.cc" /> <ClCompile Include="..\..\src\leveldb\util\coding.cc" /> <ClCompile Include="..\..\src\leveldb\util\comparator.cc" /> <ClCompile Include="..\..\src\leveldb\util\crc32c.cc" /> <ClCompile Include="..\..\src\leveldb\util\env.cc" /> <ClCompile Include="..\..\src\leveldb\util\env_windows.cc" /> <ClCompile Include="..\..\src\leveldb\util\filter_policy.cc" /> <ClCompile Include="..\..\src\leveldb\util\hash.cc" /> <ClCompile Include="..\..\src\leveldb\util\histogram.cc" /> <ClCompile Include="..\..\src\leveldb\util\logging.cc" /> <ClCompile Include="..\..\src\leveldb\util\options.cc" /> <ClCompile Include="..\..\src\leveldb\util\status.cc" /> </ItemGroup> <ItemDefinitionGroup> <ClCompile> <PreprocessorDefinitions>HAVE_CRC32C=0;HAVE_SNAPPY=0;LEVELDB_IS_BIG_ENDIAN=0;_UNICODE;UNICODE;_CRT_NONSTDC_NO_DEPRECATE;LEVELDB_PLATFORM_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <DisableSpecificWarnings>4244;4267;4722</DisableSpecificWarnings> <AdditionalIncludeDirectories>..\..\src\leveldb;..\..\src\leveldb\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> </ItemDefinitionGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/test_bitcoin-qt/test_bitcoin-qt.vcxproj
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <Import Project="..\common.qt.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{51201D5E-D939-4854-AE9D-008F03FF518E}</ProjectGuid> <ConfigurationType>Application</ConfigurationType> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> </PropertyGroup> <ItemGroup> <ClCompile Include="..\..\src\init\bitcoin-qt.cpp" /> <ClCompile Include="..\..\src\test\util\setup_common.cpp" /> <ClCompile Include="..\..\src\wallet\test\util.cpp"> <ObjectFileName>$(IntDir)wallet_test_util.obj</ObjectFileName> </ClCompile> <ClCompile Include="..\..\src\qt\test\addressbooktests.cpp" /> <ClCompile Include="..\..\src\qt\test\apptests.cpp" /> <ClCompile Include="..\..\src\qt\test\optiontests.cpp" /> <ClCompile Include="..\..\src\qt\test\rpcnestedtests.cpp" /> <ClCompile Include="..\..\src\qt\test\test_main.cpp" /> <ClCompile Include="..\..\src\qt\test\uritests.cpp" /> <ClCompile Include="..\..\src\qt\test\util.cpp"> <ObjectFileName>$(IntDir)qt_test_util.obj</ObjectFileName> </ClCompile> <ClCompile Include="..\..\src\qt\test\wallettests.cpp" /> <ClCompile Include="..\..\src\wallet\test\wallet_test_fixture.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_addressbooktests.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_apptests.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_optiontests.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_rpcnestedtests.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_uritests.cpp" /> <ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_wallettests.cpp" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\libbitcoin_consensus\libbitcoin_consensus.vcxproj"> <Project>{2b384fa8-9ee1-4544-93cb-0d733c25e8ce}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_cli\libbitcoin_cli.vcxproj"> <Project>{0667528c-d734-4009-adf9-c0d6c4a5a5a6}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_common\libbitcoin_common.vcxproj"> <Project>{7c87e378-df58-482e-aa2f-1bc129bc19ce}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_crypto\libbitcoin_crypto.vcxproj"> <Project>{6190199c-6cf4-4dad-bfbd-93fa72a760c1}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_qt\libbitcoin_qt.vcxproj"> <Project>{2b4abff8-d1fd-4845-88c9-1f3c0a6512bf}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_node\libbitcoin_node.vcxproj"> <Project>{460fee33-1fe1-483f-b3bf-931ff8e969a5}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_util\libbitcoin_util.vcxproj"> <Project>{b53a5535-ee9d-4c6f-9a26-f79ee3bc3754}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_wallet\libbitcoin_wallet.vcxproj"> <Project>{93b86837-b543-48a5-a89b-7c87abb77df2}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_zmq\libbitcoin_zmq.vcxproj"> <Project>{792d487f-f14c-49fc-a9de-3fc150f31c3f}</Project> </ProjectReference> <ProjectReference Include="..\libtest_util\libtest_util.vcxproj"> <Project>{1e065f03-3566-47d0-8fa9-daa72b084e7d}</Project> </ProjectReference> <ProjectReference Include="..\libleveldb\libleveldb.vcxproj"> <Project>{18430fef-6b61-4c53-b396-718e02850f1b}</Project> </ProjectReference> <ProjectReference Include="..\libsecp256k1\libsecp256k1.vcxproj"> <Project>{bb493552-3b8c-4a8c-bf69-a6e7a51d2ea6}</Project> </ProjectReference> <ProjectReference Include="..\libunivalue\libunivalue.vcxproj"> <Project>{5724ba7d-a09a-4ba8-800b-c4c1561b3d69}</Project> </ProjectReference> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'"> <ClCompile> <AdditionalIncludeDirectories>..\libbitcoin_qt\$(GeneratedFilesOutDir)\..\;$(QtIncludeDir)\QtTest;$(QtIncludes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> <Link> <AdditionalDependencies>$(QtLibraryDir)\Qt5Test.lib;$(QtReleaseLibraries);%(AdditionalDependencies)</AdditionalDependencies> <AdditionalOptions>/LTCG:OFF</AdditionalOptions> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'"> <ClCompile> <AdditionalIncludeDirectories>..\libbitcoin_qt\$(GeneratedFilesOutDir)\..\;$(QtIncludeDir)\QtTest;$(QtIncludes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> <Link> <AdditionalDependencies>$(QtDebugLibraries);%(AdditionalDependencies)</AdditionalDependencies> </Link> </ItemDefinitionGroup> <ItemGroup> <MocTestFiles Include="..\..\src\qt\test\addressbooktests.h" /> <MocTestFiles Include="..\..\src\qt\test\apptests.h" /> <MocTestFiles Include="..\..\src\qt\test\optiontests.h" /> <MocTestFiles Include="..\..\src\qt\test\rpcnestedtests.h" /> <MocTestFiles Include="..\..\src\qt\test\uritests.h" /> <MocTestFiles Include="..\..\src\qt\test\wallettests.h" /> </ItemGroup> <Target Name="moccode" Inputs="@(MocTestFiles)" Outputs="@(MocTestFiles->'$(GeneratedFilesOutDir)\moc\moc_%(Filename).cpp')"> <PropertyGroup> <ErrorText>There was an error executing the test_bitcoin-qt moc code generation task.</ErrorText> </PropertyGroup> <Exec Command="echo Performing test_bitcoin-qt moc generation task, output path $(GeneratedFilesOutDir)\moc." /> <MakeDir Directories="$(GeneratedFilesOutDir)\moc\" /> <Exec Command="$(QtToolsDir)\moc.exe $(MOC_DEFINES) &quot;%(MocTestFiles.Identity)&quot; -o $(GeneratedFilesOutDir)\moc\moc_%(Filename).cpp" /> </Target> <Target Name="QtTestCleanGeneratedFiles"> <Exec Command="echo Clean test_bitcoin-qt generated files from $(GeneratedFilesOutDir)." /> <RemoveDir Directories="$(GeneratedFilesOutDir)\moc\*" /> <RemoveDir Directories="$(GeneratedFilesOutDir)\moc" /> </Target> <PropertyGroup> <BuildDependsOn> moccode; $(BuildDependsOn); </BuildDependsOn> </PropertyGroup> <PropertyGroup> <CleanDependsOn> QtTestCleanGeneratedFiles; $(CleanDependsOn); </CleanDependsOn> </PropertyGroup> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/bitcoin-tx/bitcoin-tx.vcxproj
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{D3022AF6-AD33-4CE3-B358-87CB6A1B29CF}</ProjectGuid> </PropertyGroup> <PropertyGroup Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> </PropertyGroup> <ItemGroup> <ClCompile Include="..\..\src\bitcoin-tx.cpp" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\libbitcoin_consensus\libbitcoin_consensus.vcxproj"> <Project>{2b384fa8-9ee1-4544-93cb-0d733c25e8ce}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_common\libbitcoin_common.vcxproj"> <Project>{7c87e378-df58-482e-aa2f-1bc129bc19ce}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_crypto\libbitcoin_crypto.vcxproj"> <Project>{6190199c-6cf4-4dad-bfbd-93fa72a760c1}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_util\libbitcoin_util.vcxproj"> <Project>{b53a5535-ee9d-4c6f-9a26-f79ee3bc3754}</Project> </ProjectReference> <ProjectReference Include="..\libunivalue\libunivalue.vcxproj"> <Project>{5724ba7d-a09a-4ba8-800b-c4c1561b3d69}</Project> </ProjectReference> <ProjectReference Include="..\libsecp256k1\libsecp256k1.vcxproj"> <Project>{bb493552-3b8c-4a8c-bf69-a6e7a51d2ea6}</Project> </ProjectReference> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/libminisketch/libminisketch.vcxproj
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{542007E3-BE0D-4B0D-A6B0-AA8813E2558D}</ProjectGuid> </PropertyGroup> <PropertyGroup Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> </PropertyGroup> <ItemGroup> <ClCompile Include="..\..\src\minisketch\src\minisketch.cpp" /> <ClCompile Include="..\..\src\minisketch\src\fields\clmul_1byte.cpp" /> <ClCompile Include="..\..\src\minisketch\src\fields\clmul_2bytes.cpp" /> <ClCompile Include="..\..\src\minisketch\src\fields\clmul_3bytes.cpp" /> <ClCompile Include="..\..\src\minisketch\src\fields\clmul_4bytes.cpp" /> <ClCompile Include="..\..\src\minisketch\src\fields\clmul_5bytes.cpp" /> <ClCompile Include="..\..\src\minisketch\src\fields\clmul_6bytes.cpp" /> <ClCompile Include="..\..\src\minisketch\src\fields\clmul_7bytes.cpp" /> <ClCompile Include="..\..\src\minisketch\src\fields\clmul_8bytes.cpp" /> <ClCompile Include="..\..\src\minisketch\src\fields\generic_1byte.cpp" /> <ClCompile Include="..\..\src\minisketch\src\fields\generic_2bytes.cpp" /> <ClCompile Include="..\..\src\minisketch\src\fields\generic_3bytes.cpp" /> <ClCompile Include="..\..\src\minisketch\src\fields\generic_4bytes.cpp" /> <ClCompile Include="..\..\src\minisketch\src\fields\generic_5bytes.cpp" /> <ClCompile Include="..\..\src\minisketch\src\fields\generic_6bytes.cpp" /> <ClCompile Include="..\..\src\minisketch\src\fields\generic_7bytes.cpp" /> <ClCompile Include="..\..\src\minisketch\src\fields\generic_8bytes.cpp" /> </ItemGroup> <ItemDefinitionGroup> <ClCompile> <DisableSpecificWarnings>4060;4065;4146;4244;4267</DisableSpecificWarnings> <PreprocessorDefinitions>HAVE_CLMUL;DISABLE_DEFAULT_FIELDS;ENABLE_FIELD_32;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> </ItemDefinitionGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/libbitcoin_util/libbitcoin_util.vcxproj.in
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{B53A5535-EE9D-4C6F-9A26-F79EE3BC3754}</ProjectGuid> </PropertyGroup> <PropertyGroup Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> </PropertyGroup> <ItemGroup> @SOURCE_FILES@ </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/bitcoin-util/bitcoin-util.vcxproj
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{57A04EC9-542A-4E40-83D0-AC3BE1F36805}</ProjectGuid> </PropertyGroup> <PropertyGroup Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> </PropertyGroup> <ItemGroup> <ClCompile Include="..\..\src\bitcoin-util.cpp" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\libbitcoin_consensus\libbitcoin_consensus.vcxproj"> <Project>{2b384fa8-9ee1-4544-93cb-0d733c25e8ce}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_common\libbitcoin_common.vcxproj"> <Project>{7c87e378-df58-482e-aa2f-1bc129bc19ce}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_crypto\libbitcoin_crypto.vcxproj"> <Project>{6190199c-6cf4-4dad-bfbd-93fa72a760c1}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_util\libbitcoin_util.vcxproj"> <Project>{b53a5535-ee9d-4c6f-9a26-f79ee3bc3754}</Project> </ProjectReference> <ProjectReference Include="..\libunivalue\libunivalue.vcxproj"> <Project>{5724ba7d-a09a-4ba8-800b-c4c1561b3d69}</Project> </ProjectReference> <ProjectReference Include="..\libsecp256k1\libsecp256k1.vcxproj"> <Project>{bb493552-3b8c-4a8c-bf69-a6e7a51d2ea6}</Project> </ProjectReference> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/bitcoin-qt/bitcoin-qt.vcxproj
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <Import Project="..\common.qt.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{7E99172D-7FF2-4CB6-B736-AC9B76ED412A}</ProjectGuid> <ConfigurationType>Application</ConfigurationType> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> </PropertyGroup> <ItemGroup> <ClCompile Include="..\..\src\qt\main.cpp" /> <ClCompile Include="..\..\src\init\bitcoin-qt.cpp" /> <ResourceCompile Include="..\..\src\qt\res\bitcoin-qt-res.rc" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\libbitcoin_consensus\libbitcoin_consensus.vcxproj"> <Project>{2b384fa8-9ee1-4544-93cb-0d733c25e8ce}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_cli\libbitcoin_cli.vcxproj"> <Project>{0667528c-d734-4009-adf9-c0d6c4a5a5a6}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_common\libbitcoin_common.vcxproj"> <Project>{7c87e378-df58-482e-aa2f-1bc129bc19ce}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_crypto\libbitcoin_crypto.vcxproj"> <Project>{6190199c-6cf4-4dad-bfbd-93fa72a760c1}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_qt\libbitcoin_qt.vcxproj"> <Project>{2b4abff8-d1fd-4845-88c9-1f3c0a6512bf}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_node\libbitcoin_node.vcxproj"> <Project>{460fee33-1fe1-483f-b3bf-931ff8e969a5}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_util\libbitcoin_util.vcxproj"> <Project>{b53a5535-ee9d-4c6f-9a26-f79ee3bc3754}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_wallet\libbitcoin_wallet.vcxproj"> <Project>{93b86837-b543-48a5-a89b-7c87abb77df2}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_zmq\libbitcoin_zmq.vcxproj"> <Project>{792d487f-f14c-49fc-a9de-3fc150f31c3f}</Project> </ProjectReference> <ProjectReference Include="..\libleveldb\libleveldb.vcxproj"> <Project>{18430fef-6b61-4c53-b396-718e02850f1b}</Project> </ProjectReference> <ProjectReference Include="..\libsecp256k1\libsecp256k1.vcxproj"> <Project>{bb493552-3b8c-4a8c-bf69-a6e7a51d2ea6}</Project> </ProjectReference> <ProjectReference Include="..\libunivalue\libunivalue.vcxproj"> <Project>{5724ba7d-a09a-4ba8-800b-c4c1561b3d69}</Project> </ProjectReference> </ItemGroup> <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'"> <ClCompile> <AdditionalIncludeDirectories>$(QtIncludes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> <Link> <SubSystem>Windows</SubSystem> <AdditionalDependencies>$(QtReleaseLibraries);%(AdditionalDependencies)</AdditionalDependencies> <AdditionalOptions>/LTCG:OFF</AdditionalOptions> </Link> <ResourceCompile> <AdditionalIncludeDirectories>..\..\src;</AdditionalIncludeDirectories> <PreprocessorDefinitions>HAVE_CONFIG_H;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ResourceCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'"> <ClCompile> <AdditionalIncludeDirectories>$(QtIncludes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> <Link> <AdditionalDependencies>$(QtDebugLibraries);%(AdditionalDependencies)</AdditionalDependencies> </Link> <ResourceCompile> <AdditionalIncludeDirectories>..\..\src;</AdditionalIncludeDirectories> <PreprocessorDefinitions>HAVE_CONFIG_H;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ResourceCompile> </ItemDefinitionGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/libbitcoin_wallet/libbitcoin_wallet.vcxproj.in
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{93B86837-B543-48A5-A89B-7C87ABB77DF2}</ProjectGuid> </PropertyGroup> <PropertyGroup Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> </PropertyGroup> <ItemGroup> <ClCompile Include="..\..\src\wallet\bdb.cpp" /> <ClCompile Include="..\..\src\wallet\salvage.cpp" /> <ClCompile Include="..\..\src\wallet\sqlite.cpp" /> @SOURCE_FILES@ </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/libbitcoin_node/libbitcoin_node.vcxproj.in
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{460FEE33-1FE1-483F-B3BF-931FF8E969A5}</ProjectGuid> </PropertyGroup> <PropertyGroup Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> </PropertyGroup> <ItemGroup> @SOURCE_FILES@ <ClCompile Include="..\..\src\wallet\init.cpp"> <ObjectFileName>$(IntDir)wallet_init.obj</ObjectFileName> </ClCompile> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/libbitcoin_wallet_tool/libbitcoin_wallet_tool.vcxproj.in
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{F91AC55E-6F5E-4C58-9AC5-B40DB7DEEF93}</ProjectGuid> </PropertyGroup> <PropertyGroup Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> </PropertyGroup> <ItemGroup> @SOURCE_FILES@ </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/libunivalue/libunivalue.vcxproj
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{5724BA7D-A09A-4BA8-800B-C4C1561B3D69}</ProjectGuid> </PropertyGroup> <PropertyGroup Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> </PropertyGroup> <ItemGroup> <ClCompile Include="..\..\src\univalue\lib\univalue.cpp" /> <ClCompile Include="..\..\src\univalue\lib\univalue_get.cpp" /> <ClCompile Include="..\..\src\univalue\lib\univalue_read.cpp" /> <ClCompile Include="..\..\src\univalue\lib\univalue_write.cpp" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/libbitcoin_zmq/libbitcoin_zmq.vcxproj.in
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{792D487F-F14C-49FC-A9DE-3FC150F31C3F}</ProjectGuid> </PropertyGroup> <PropertyGroup Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> </PropertyGroup> <ItemGroup> @SOURCE_FILES@ </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/test_bitcoin/test_bitcoin.vcxproj
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{A56B73DB-D46D-4882-8374-1FE3FFA08F07}</ProjectGuid> </PropertyGroup> <PropertyGroup Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> </PropertyGroup> <ItemGroup> <ClCompile Include="..\..\src\test\*_properties.cpp" /> <ClCompile Include="..\..\src\test\*_tests.cpp" /> <ClCompile Include="..\..\src\test\gen\*_gen.cpp" /> <ClCompile Include="..\..\src\test\main.cpp" /> <ClCompile Include="..\..\src\test\util\*.cpp" /> <ClCompile Include="..\..\src\wallet\test\*_fixture.cpp" /> <ClCompile Include="..\..\src\wallet\test\*_tests.cpp" /> <ClCompile Include="..\..\src\wallet\test\util.cpp" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\libminisketch\libminisketch.vcxproj"> <Project>{542007e3-be0d-4b0d-a6b0-aa8813e2558d}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_consensus\libbitcoin_consensus.vcxproj"> <Project>{2b384fa8-9ee1-4544-93cb-0d733c25e8ce}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_cli\libbitcoin_cli.vcxproj"> <Project>{0667528c-d734-4009-adf9-c0d6c4a5a5a6}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_common\libbitcoin_common.vcxproj"> <Project>{7c87e378-df58-482e-aa2f-1bc129bc19ce}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_crypto\libbitcoin_crypto.vcxproj"> <Project>{6190199c-6cf4-4dad-bfbd-93fa72a760c1}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_node\libbitcoin_node.vcxproj"> <Project>{460fee33-1fe1-483f-b3bf-931ff8e969a5}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_util\libbitcoin_util.vcxproj"> <Project>{b53a5535-ee9d-4c6f-9a26-f79ee3bc3754}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_wallet\libbitcoin_wallet.vcxproj"> <Project>{93b86837-b543-48a5-a89b-7c87abb77df2}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_zmq\libbitcoin_zmq.vcxproj"> <Project>{792d487f-f14c-49fc-a9de-3fc150f31c3f}</Project> </ProjectReference> <ProjectReference Include="..\libtest_util\libtest_util.vcxproj"> <Project>{1e065f03-3566-47d0-8fa9-daa72b084e7d}</Project> </ProjectReference> <ProjectReference Include="..\libunivalue\libunivalue.vcxproj"> <Project>{5724ba7d-a09a-4ba8-800b-c4c1561b3d69}</Project> </ProjectReference> <ProjectReference Include="..\libsecp256k1\libsecp256k1.vcxproj"> <Project>{bb493552-3b8c-4a8c-bf69-a6e7a51d2ea6}</Project> </ProjectReference> <ProjectReference Include="..\libleveldb\libleveldb.vcxproj"> <Project>{18430fef-6b61-4c53-b396-718e02850f1b}</Project> </ProjectReference> </ItemGroup> <ItemDefinitionGroup> <ClCompile> <DisableSpecificWarnings>4018;4244;4267;4703;4715;4805</DisableSpecificWarnings> </ClCompile> </ItemDefinitionGroup> <Target Name="RawBenchHeaderGen" BeforeTargets="PrepareForBuild"> <PropertyGroup> <ErrorText>There was an error executing the JSON test header generation task.</ErrorText> </PropertyGroup> <ItemGroup> <JsonTestFile Include="..\..\src\test\data\*.json" /> <RawTestFile Include="..\..\src\test\data\*.raw" /> </ItemGroup> <HeaderFromHexdump RawFilePath="%(RawTestFile.FullPath)" HeaderFilePath="%(RawTestFile.FullPath).h" SourceHeader="static unsigned const char %(RawTestFile.Filename)_raw[] = {" SourceFooter="};" /> <HeaderFromHexdump RawFilePath="%(JsonTestFile.FullPath)" HeaderFilePath="%(JsonTestFile.FullPath).h" SourceHeader="#include &lt;string&gt;&#x0D;&#x0A;namespace json_tests{ static const std::string %(JsonTestFile.Filename){" SourceFooter="};}" /> </Target> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Label="hexdumpTarget" Project="..\msbuild\tasks\hexdump.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/libsecp256k1/libsecp256k1.vcxproj
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{BB493552-3B8C-4A8C-BF69-A6E7A51D2EA6}</ProjectGuid> </PropertyGroup> <PropertyGroup Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> </PropertyGroup> <ItemGroup> <ClCompile Include="..\..\src\secp256k1\src\precomputed_ecmult.c" /> <ClCompile Include="..\..\src\secp256k1\src\precomputed_ecmult_gen.c" /> <ClCompile Include="..\..\src\secp256k1\src\secp256k1.c" /> </ItemGroup> <ItemDefinitionGroup> <ClCompile> <PreprocessorDefinitions>ENABLE_MODULE_RECOVERY;ENABLE_MODULE_EXTRAKEYS;ENABLE_MODULE_SCHNORRSIG;ENABLE_MODULE_ELLSWIFT;%(PreprocessorDefinitions)</PreprocessorDefinitions> <UndefinePreprocessorDefinitions>USE_ASM_X86_64;%(UndefinePreprocessorDefinitions)</UndefinePreprocessorDefinitions> <AdditionalIncludeDirectories>..\..\src\secp256k1;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <DisableSpecificWarnings>4146;4244;4267</DisableSpecificWarnings> </ClCompile> </ItemDefinitionGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/libbitcoin_crypto/libbitcoin_crypto.vcxproj.in
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{6190199C-6CF4-4DAD-BFBD-93FA72A760C1}</ProjectGuid> </PropertyGroup> <PropertyGroup Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> </PropertyGroup> <ItemGroup> @SOURCE_FILES@ </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/libbitcoin_consensus/libbitcoin_consensus.vcxproj
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{2B384FA8-9EE1-4544-93CB-0D733C25E8CE}</ProjectGuid> </PropertyGroup> <PropertyGroup Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> </PropertyGroup> <ItemGroup> <ClCompile Include="..\..\src\arith_uint256.cpp" /> <ClCompile Include="..\..\src\consensus\merkle.cpp" /> <ClCompile Include="..\..\src\consensus\tx_check.cpp" /> <ClCompile Include="..\..\src\hash.cpp" /> <ClCompile Include="..\..\src\primitives\block.cpp" /> <ClCompile Include="..\..\src\primitives\transaction.cpp" /> <ClCompile Include="..\..\src\pubkey.cpp" /> <ClCompile Include="..\..\src\script\bitcoinconsensus.cpp" /> <ClCompile Include="..\..\src\script\interpreter.cpp" /> <ClCompile Include="..\..\src\script\script.cpp" /> <ClCompile Include="..\..\src\script\script_error.cpp" /> <ClCompile Include="..\..\src\uint256.cpp" /> <ClCompile Include="..\..\src\util\strencodings.cpp" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/libtest_util/libtest_util.vcxproj.in
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{868474FD-35F6-4400-8EED-30A33E7521D4}</ProjectGuid> </PropertyGroup> <PropertyGroup Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> </PropertyGroup> <ItemGroup> <ClCompile Include="..\..\src\wallet\test\util.cpp" /> @SOURCE_FILES@ </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin/build_msvc
bitcoin/build_msvc/bitcoin-cli/bitcoin-cli.vcxproj
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\common.init.vcxproj" /> <PropertyGroup Label="Globals"> <ProjectGuid>{0B2D7431-F876-4A58-87BF-F748338CD3BF}</ProjectGuid> </PropertyGroup> <PropertyGroup> <ConfigurationType>Application</ConfigurationType> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> </PropertyGroup> <ItemGroup> <ClCompile Include="..\..\src\bitcoin-cli.cpp" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\libbitcoin_cli\libbitcoin_cli.vcxproj"> <Project>{0667528c-d734-4009-adf9-c0d6c4a5a5a6}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_common\libbitcoin_common.vcxproj"> <Project>{7c87e378-df58-482e-aa2f-1bc129bc19ce}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_crypto\libbitcoin_crypto.vcxproj"> <Project>{6190199c-6cf4-4dad-bfbd-93fa72a760c1}</Project> </ProjectReference> <ProjectReference Include="..\libbitcoin_util\libbitcoin_util.vcxproj"> <Project>{b53a5535-ee9d-4c6f-9a26-f79ee3bc3754}</Project> </ProjectReference> <ProjectReference Include="..\libunivalue\libunivalue.vcxproj"> <Project>{5724ba7d-a09a-4ba8-800b-c4c1561b3d69}</Project> </ProjectReference> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="..\common.vcxproj" /> </Project>
0
bitcoin
bitcoin/ci/test_imagefile
# Copyright (c) The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or https://opensource.org/license/mit/. # See ci/README.md for usage. ARG CI_IMAGE_NAME_TAG FROM ${CI_IMAGE_NAME_TAG} ARG FILE_ENV ENV FILE_ENV=${FILE_ENV} COPY ./ci/retry/retry /usr/bin/retry COPY ./ci/test/00_setup_env.sh ./${FILE_ENV} ./ci/test/01_base_install.sh /ci_container_base/ci/test/ RUN ["bash", "-c", "cd /ci_container_base/ && set -o errexit && source ./ci/test/00_setup_env.sh && ./ci/test/01_base_install.sh"]
0
bitcoin
bitcoin/ci/test_run_all.sh
#!/usr/bin/env bash # # Copyright (c) 2019-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 set -o errexit; source ./ci/test/00_setup_env.sh set -o errexit "./ci/test/02_run_container.sh"
0
bitcoin
bitcoin/ci/README.md
## CI Scripts This directory contains scripts for each build step in each build stage. ### Running a Stage Locally Be aware that the tests will be built and run in-place, so please run at your own risk. If the repository is not a fresh git clone, you might have to clean files from previous builds or test runs first. The ci needs to perform various sysadmin tasks such as installing packages or writing to the user's home directory. While it should be fine to run the ci system locally on you development box, the ci scripts can generally be assumed to have received less review and testing compared to other parts of the codebase. If you want to keep the work tree clean, you might want to run the ci system in a virtual machine with a Linux operating system of your choice. To allow for a wide range of tested environments, but also ensure reproducibility to some extent, the test stage requires `bash`, `docker`, and `python3` to be installed. To install all requirements on Ubuntu, run ``` sudo apt install bash docker.io python3 ``` It is recommended to run the ci system in a clean env. To run the test stage with a specific configuration, ``` env -i HOME="$HOME" PATH="$PATH" USER="$USER" bash -c 'FILE_ENV="./ci/test/00_setup_env_arm.sh" ./ci/test_run_all.sh' ``` ### Configurations The test files (`FILE_ENV`) are constructed to test a wide range of configurations, rather than a single pass/fail. This helps to catch build failures and logic errors that present on platforms other than the ones the author has tested. Some builders use the dependency-generator in `./depends`, rather than using the system package manager to install build dependencies. This guarantees that the tester is using the same versions as the release builds, which also use `./depends`. It is also possible to force a specific configuration without modifying the file. For example, ``` env -i HOME="$HOME" PATH="$PATH" USER="$USER" bash -c 'MAKEJOBS="-j1" FILE_ENV="./ci/test/00_setup_env_arm.sh" ./ci/test_run_all.sh' ``` The files starting with `0n` (`n` greater than 0) are the scripts that are run in order. ### Cache In order to avoid rebuilding all dependencies for each build, the binaries are cached and reused when possible. Changes in the dependency-generator will trigger cache-invalidation and rebuilds as necessary.
0
bitcoin
bitcoin/ci/lint_run_all.sh
#!/usr/bin/env bash # # Copyright (c) 2019-2020 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 set -o errexit; source ./ci/test/00_setup_env.sh set -o errexit; source ./ci/lint/04_install.sh set -o errexit ./ci/lint/06_script.sh
0
bitcoin
bitcoin/ci/lint_imagefile
# Copyright (c) The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or https://opensource.org/license/mit/. # See test/lint/README.md for usage. FROM debian:bookworm ENV DEBIAN_FRONTEND=noninteractive ENV LC_ALL=C.UTF-8 COPY ./.python-version /.python-version COPY ./ci/lint/container-entrypoint.sh /entrypoint.sh COPY ./ci/lint/04_install.sh /install.sh COPY ./test/lint/test_runner /test/lint/test_runner RUN /install.sh && \ echo 'alias lint="./ci/lint/06_script.sh"' >> ~/.bashrc && \ chmod 755 /entrypoint.sh && \ rm -rf /var/lib/apt/lists/* WORKDIR /bitcoin ENTRYPOINT ["/entrypoint.sh"]
0
bitcoin/ci
bitcoin/ci/lint/container-entrypoint.sh
#!/usr/bin/env bash # # Copyright (c) The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or https://opensource.org/license/mit/. export LC_ALL=C # Fixes permission issues when there is a container UID/GID mismatch with the owner # of the mounted bitcoin src dir. git config --global --add safe.directory /bitcoin export PATH="/python_build/bin:${PATH}" export LINT_RUNNER_PATH="/lint_test_runner" if [ -z "$1" ]; then LOCAL_BRANCH=1 bash -ic "./ci/lint/06_script.sh" else exec "$@" fi
0
bitcoin/ci
bitcoin/ci/lint/06_script.sh
#!/usr/bin/env bash # # Copyright (c) 2018-2022 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C set -ex if [ -n "$LOCAL_BRANCH" ]; then # To faithfully recreate CI linting locally, specify all commits on the current # branch. COMMIT_RANGE="$(git merge-base HEAD master)..HEAD" elif [ -n "$CIRRUS_PR" ]; then COMMIT_RANGE="HEAD~..HEAD" echo git log --no-merges --oneline "$COMMIT_RANGE" echo test/lint/commit-script-check.sh "$COMMIT_RANGE" else COMMIT_RANGE="SKIP_EMPTY_NOT_A_PR" fi export COMMIT_RANGE RUST_BACKTRACE=1 "${LINT_RUNNER_PATH}/test_runner" if [ "$CIRRUS_REPO_FULL_NAME" = "bitcoin/bitcoin" ] && [ "$CIRRUS_PR" = "" ] ; then # Sanity check only the last few commits to get notified of missing sigs, # missing keys, or expired keys. Usually there is only one new merge commit # per push on the master branch and a few commits on release branches, so # sanity checking only a few (10) commits seems sufficient and cheap. git log HEAD~10 -1 --format='%H' > ./contrib/verify-commits/trusted-sha512-root-commit git log HEAD~10 -1 --format='%H' > ./contrib/verify-commits/trusted-git-root mapfile -t KEYS < contrib/verify-commits/trusted-keys git config user.email "ci@ci.ci" git config user.name "ci" ${CI_RETRY_EXE} gpg --keyserver hkps://keys.openpgp.org --recv-keys "${KEYS[@]}" && ./contrib/verify-commits/verify-commits.py; fi
0
bitcoin/ci
bitcoin/ci/lint/04_install.sh
#!/usr/bin/env bash # # Copyright (c) 2018-2022 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C export PATH=$PWD/ci/retry:$PATH ${CI_RETRY_EXE} apt-get update # Lint dependencies: # - curl/xz-utils (to install shellcheck) # - git (used in many lint scripts) # - gpg (used by verify-commits) ${CI_RETRY_EXE} apt-get install -y curl xz-utils git gpg PYTHON_PATH="/python_build" if [ ! -d "${PYTHON_PATH}/bin" ]; then ( ${CI_RETRY_EXE} git clone https://github.com/pyenv/pyenv.git cd pyenv/plugins/python-build || exit 1 ./install.sh ) # For dependencies see https://github.com/pyenv/pyenv/wiki#suggested-build-environment ${CI_RETRY_EXE} apt-get install -y build-essential libssl-dev zlib1g-dev \ libbz2-dev libreadline-dev libsqlite3-dev curl llvm \ libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \ clang env CC=clang python-build "$(cat "./.python-version")" "${PYTHON_PATH}" fi export PATH="${PYTHON_PATH}/bin:${PATH}" command -v python3 python3 --version export LINT_RUNNER_PATH="/lint_test_runner" if [ ! -d "${LINT_RUNNER_PATH}" ]; then ${CI_RETRY_EXE} apt-get install -y cargo ( cd ./test/lint/test_runner || exit 1 cargo build mkdir -p "${LINT_RUNNER_PATH}" mv target/debug/test_runner "${LINT_RUNNER_PATH}" ) fi ${CI_RETRY_EXE} pip3 install \ codespell==2.2.5 \ flake8==6.1.0 \ lief==0.13.2 \ mypy==1.4.1 \ pyzmq==25.1.0 \ vulture==2.6 SHELLCHECK_VERSION=v0.8.0 curl -sL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | \ tar --xz -xf - --directory /tmp/ mv "/tmp/shellcheck-${SHELLCHECK_VERSION}/shellcheck" /usr/bin/
0
bitcoin/ci
bitcoin/ci/test/00_setup_env_native_asan.sh
#!/usr/bin/env bash # # Copyright (c) 2019-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="docker.io/ubuntu:24.04" # Only install BCC tracing packages in Cirrus CI. if [[ "${CIRRUS_CI}" == "true" ]]; then BPFCC_PACKAGE="bpfcc-tools linux-headers-$(uname --kernel-release)" export CI_CONTAINER_CAP="--privileged -v /sys/kernel:/sys/kernel:rw" else BPFCC_PACKAGE="" export CI_CONTAINER_CAP="--cap-add SYS_PTRACE" # If run with (ASan + LSan), the container needs access to ptrace (https://github.com/google/sanitizers/issues/764) fi export CONTAINER_NAME=ci_native_asan export PACKAGES="systemtap-sdt-dev clang-17 llvm-17 libclang-rt-17-dev python3-zmq qtbase5-dev qttools5-dev-tools libevent-dev libboost-dev libdb5.3++-dev libminiupnpc-dev libnatpmp-dev libzmq3-dev libqrencode-dev libsqlite3-dev ${BPFCC_PACKAGE}" export NO_DEPENDS=1 export GOAL="install" export BITCOIN_CONFIG="--enable-c++20 --enable-usdt --enable-zmq --with-incompatible-bdb --with-gui=qt5 \ CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKORDER' \ --with-sanitizers=address,float-divide-by-zero,integer,undefined \ CC='clang-17 -ftrivial-auto-var-init=pattern' CXX='clang++-17 -ftrivial-auto-var-init=pattern'"
0
bitcoin/ci
bitcoin/ci/test/wrap-valgrind.sh
#!/usr/bin/env bash # # Copyright (c) 2018-2021 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 for b_name in "${BASE_OUTDIR}/bin"/*; do # shellcheck disable=SC2044 for b in $(find "${BASE_ROOT_DIR}" -executable -type f -name "$(basename "$b_name")"); do echo "Wrap $b ..." mv "$b" "${b}_orig" echo '#!/usr/bin/env bash' > "$b" echo "valgrind --gen-suppressions=all --quiet --error-exitcode=1 --suppressions=${BASE_ROOT_DIR}/contrib/valgrind.supp \"${b}_orig\" \"\$@\"" >> "$b" chmod +x "$b" done done
0
bitcoin/ci
bitcoin/ci/test/00_setup_env_native_fuzz_with_valgrind.sh
#!/usr/bin/env bash # # Copyright (c) 2019-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="docker.io/debian:bookworm" export CONTAINER_NAME=ci_native_fuzz_valgrind export PACKAGES="clang llvm libclang-rt-dev libevent-dev libboost-dev libsqlite3-dev valgrind" export NO_DEPENDS=1 export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false export RUN_FUZZ_TESTS=true export FUZZ_TESTS_CONFIG="--valgrind" export GOAL="install" # Temporarily pin dwarf 4, until using Valgrind 3.20 or later export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer CC='clang -gdwarf-4' CXX='clang++ -gdwarf-4'" export CCACHE_MAXSIZE=200M
0
bitcoin/ci
bitcoin/ci/test/00_setup_env_i686_centos.sh
#!/usr/bin/env bash # # Copyright (c) 2020-2022 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 export HOST=i686-pc-linux-gnu export CONTAINER_NAME=ci_i686_centos export CI_IMAGE_NAME_TAG="quay.io/centos/amd64:stream9" export CI_BASE_PACKAGES="gcc-c++ glibc-devel.x86_64 libstdc++-devel.x86_64 glibc-devel.i686 libstdc++-devel.i686 ccache libtool make git python3 python3-pip which patch lbzip2 xz procps-ng dash rsync coreutils bison util-linux e2fsprogs" export PIP_PACKAGES="pyzmq" export GOAL="install" export NO_WERROR=1 # Suppress error: #warning _FORTIFY_SOURCE > 2 is treated like 2 on this platform [-Werror=cpp] export BITCOIN_CONFIG="--enable-zmq --with-gui=qt5 --enable-reduce-exports" export CONFIG_SHELL="/bin/dash"
0
bitcoin/ci
bitcoin/ci/test/02_run_container.sh
#!/usr/bin/env bash # # Copyright (c) 2018-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 export CI_IMAGE_LABEL="bitcoin-ci-test" set -ex if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then # Export all env vars to avoid missing some. # Though, exclude those with newlines to avoid parsing problems. python3 -c 'import os; [print(f"{key}={value}") for key, value in os.environ.items() if "\n" not in value and "HOME" != key and "PATH" != key and "USER" != key]' | tee /tmp/env # System-dependent env vars must be kept as is. So read them from the container. docker run --rm "${CI_IMAGE_NAME_TAG}" bash -c "env | grep --extended-regexp '^(HOME|PATH|USER)='" | tee --append /tmp/env echo "Creating $CI_IMAGE_NAME_TAG container to run in" DOCKER_BUILDKIT=1 docker build \ --file "${BASE_READ_ONLY_DIR}/ci/test_imagefile" \ --build-arg "CI_IMAGE_NAME_TAG=${CI_IMAGE_NAME_TAG}" \ --build-arg "FILE_ENV=${FILE_ENV}" \ --label="${CI_IMAGE_LABEL}" \ --tag="${CONTAINER_NAME}" \ "${BASE_READ_ONLY_DIR}" docker volume create "${CONTAINER_NAME}_ccache" || true docker volume create "${CONTAINER_NAME}_depends" || true docker volume create "${CONTAINER_NAME}_depends_sources" || true docker volume create "${CONTAINER_NAME}_depends_SDKs_android" || true docker volume create "${CONTAINER_NAME}_previous_releases" || true if [ -n "${RESTART_CI_DOCKER_BEFORE_RUN}" ] ; then echo "Restart docker before run to stop and clear all containers started with --rm" podman container rm --force --all # Similar to "systemctl restart docker" # Still prune everything in case the filtered pruning doesn't work, or if labels were not set # on a previous run. Belt and suspenders approach, should be fine to remove in the future. # Prune images used by --external containers (e.g. build containers) when # using podman. echo "Prune all dangling images" podman image prune --force --external fi echo "Prune all dangling $CI_IMAGE_LABEL images" # When detecting podman-docker, `--external` should be added. docker image prune --force --filter "label=$CI_IMAGE_LABEL" # shellcheck disable=SC2086 CI_CONTAINER_ID=$(docker run --cap-add LINUX_IMMUTABLE $CI_CONTAINER_CAP --rm --interactive --detach --tty \ --mount "type=bind,src=$BASE_READ_ONLY_DIR,dst=$BASE_READ_ONLY_DIR,readonly" \ --mount "type=volume,src=${CONTAINER_NAME}_ccache,dst=$CCACHE_DIR" \ --mount "type=volume,src=${CONTAINER_NAME}_depends,dst=$DEPENDS_DIR/built" \ --mount "type=volume,src=${CONTAINER_NAME}_depends_sources,dst=$DEPENDS_DIR/sources" \ --mount "type=volume,src=${CONTAINER_NAME}_depends_SDKs_android,dst=$DEPENDS_DIR/SDKs/android" \ --mount "type=volume,src=${CONTAINER_NAME}_previous_releases,dst=$PREVIOUS_RELEASES_DIR" \ --env-file /tmp/env \ --name "$CONTAINER_NAME" \ "$CONTAINER_NAME") export CI_CONTAINER_ID export CI_EXEC_CMD_PREFIX="docker exec ${CI_CONTAINER_ID}" else echo "Running on host system without docker wrapper" echo "Create missing folders" mkdir -p "${CCACHE_DIR}" mkdir -p "${PREVIOUS_RELEASES_DIR}" fi if [ "$CI_OS_NAME" == "macos" ]; then IN_GETOPT_BIN="$(brew --prefix gnu-getopt)/bin/getopt" export IN_GETOPT_BIN fi CI_EXEC () { $CI_EXEC_CMD_PREFIX bash -c "export PATH=${BINS_SCRATCH_DIR}:${BASE_ROOT_DIR}/ci/retry:\$PATH && cd \"${BASE_ROOT_DIR}\" && $*" } export -f CI_EXEC # Normalize all folders to BASE_ROOT_DIR CI_EXEC rsync --archive --stats --human-readable "${BASE_READ_ONLY_DIR}/" "${BASE_ROOT_DIR}" || echo "Nothing to copy from ${BASE_READ_ONLY_DIR}/" CI_EXEC "${BASE_ROOT_DIR}/ci/test/01_base_install.sh" # Fixes permission issues when there is a container UID/GID mismatch with the owner # of the git source code directory. CI_EXEC git config --global --add safe.directory \"*\" CI_EXEC mkdir -p "${BINS_SCRATCH_DIR}" CI_EXEC "${BASE_ROOT_DIR}/ci/test/03_test_script.sh" if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then echo "Stop and remove CI container by ID" docker container kill "${CI_CONTAINER_ID}" fi
0
bitcoin/ci
bitcoin/ci/test/00_setup_env_native_fuzz.sh
#!/usr/bin/env bash # # Copyright (c) 2019-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="docker.io/ubuntu:24.04" export CONTAINER_NAME=ci_native_fuzz export PACKAGES="clang-17 llvm-17 libclang-rt-17-dev libevent-dev libboost-dev libsqlite3-dev" export NO_DEPENDS=1 export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false export RUN_FUZZ_TESTS=true export GOAL="install" export CI_CONTAINER_CAP="--cap-add SYS_PTRACE" # If run with (ASan + LSan), the container needs access to ptrace (https://github.com/google/sanitizers/issues/764) export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer,address,undefined,float-divide-by-zero,integer \ CC='clang-17 -ftrivial-auto-var-init=pattern' CXX='clang++-17 -ftrivial-auto-var-init=pattern'" export CCACHE_MAXSIZE=200M export LLVM_SYMBOLIZER_PATH="/usr/bin/llvm-symbolizer-17"
0
bitcoin/ci
bitcoin/ci/test/00_setup_env_native_tidy.sh
#!/usr/bin/env bash # # Copyright (c) 2023-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="docker.io/ubuntu:24.04" export CONTAINER_NAME=ci_native_tidy export TIDY_LLVM_V="17" export PACKAGES="clang-${TIDY_LLVM_V} libclang-${TIDY_LLVM_V}-dev llvm-${TIDY_LLVM_V}-dev libomp-${TIDY_LLVM_V}-dev clang-tidy-${TIDY_LLVM_V} jq bear cmake libevent-dev libboost-dev libminiupnpc-dev libnatpmp-dev libzmq3-dev systemtap-sdt-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libqrencode-dev libsqlite3-dev libdb++-dev" export NO_DEPENDS=1 export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false export RUN_FUZZ_TESTS=false export RUN_TIDY=true export GOAL="install" export BITCOIN_CONFIG="CC=clang-${TIDY_LLVM_V} CXX=clang++-${TIDY_LLVM_V} --with-incompatible-bdb --disable-hardening CFLAGS='-O0 -g0' CXXFLAGS='-O0 -g0 -I/usr/lib/llvm-${TIDY_LLVM_V}/lib/clang/${TIDY_LLVM_V}/include'" export CCACHE_MAXSIZE=200M
0
bitcoin/ci
bitcoin/ci/test/00_setup_env_native_qt5.sh
#!/usr/bin/env bash # # Copyright (c) 2019-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 export CONTAINER_NAME=ci_native_qt5 export CI_IMAGE_NAME_TAG="docker.io/debian:bullseye" # Use minimum supported python3.9 and gcc-10, see doc/dependencies.md export PACKAGES="gcc-10 g++-10 python3-zmq qtbase5-dev qttools5-dev-tools libdbus-1-dev libharfbuzz-dev" export DEP_OPTS="NO_QT=1 NO_UPNP=1 NO_NATPMP=1 DEBUG=1 ALLOW_HOST_PACKAGES=1 CC=gcc-10 CXX=g++-10" export TEST_RUNNER_EXTRA="--previous-releases --coverage --extended --exclude feature_dbcrash" # Run extended tests so that coverage does not fail, but exclude the very slow dbcrash export RUN_UNIT_TESTS_SEQUENTIAL="true" export RUN_UNIT_TESTS="false" export GOAL="install" export DOWNLOAD_PREVIOUS_RELEASES="true" export BITCOIN_CONFIG="--enable-zmq --with-libs=no --with-gui=qt5 --enable-reduce-exports --enable-debug \ CFLAGS=\"-g0 -O2 -funsigned-char\" CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE' CXXFLAGS=\"-g0 -O2 -funsigned-char\""
0
bitcoin/ci
bitcoin/ci/test/00_setup_env.sh
#!/usr/bin/env bash # # Copyright (c) 2019-2022 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 set -ex # The source root dir, usually from git, usually read-only. # The ci system copies this folder. BASE_READ_ONLY_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../../ >/dev/null 2>&1 && pwd ) export BASE_READ_ONLY_DIR # The destination root dir inside the container. # This folder will also hold any SDKs. # This folder only exists on the ci guest and will be a copy of BASE_READ_ONLY_DIR export BASE_ROOT_DIR="${BASE_ROOT_DIR:-/ci_container_base}" # The depends dir. # This folder exists only on the ci guest, and on the ci host as a volume. export DEPENDS_DIR=${DEPENDS_DIR:-$BASE_ROOT_DIR/depends} # A folder for the ci system to put temporary files (build result, datadirs for tests, ...) # This folder only exists on the ci guest. export BASE_SCRATCH_DIR=${BASE_SCRATCH_DIR:-$BASE_ROOT_DIR/ci/scratch} # A folder for the ci system to put executables. # This folder only exists on the ci guest. export BINS_SCRATCH_DIR="${BASE_SCRATCH_DIR}/bins/" echo "Setting specific values in env" if [ -n "${FILE_ENV}" ]; then set -o errexit; # shellcheck disable=SC1090 source "${FILE_ENV}" fi echo "Fallback to default values in env (if not yet set)" # The number of parallel jobs to pass down to make and test_runner.py export MAKEJOBS=${MAKEJOBS:--j4} # Whether to prefer BusyBox over GNU utilities export USE_BUSY_BOX=${USE_BUSY_BOX:-false} export RUN_UNIT_TESTS=${RUN_UNIT_TESTS:-true} export RUN_FUNCTIONAL_TESTS=${RUN_FUNCTIONAL_TESTS:-true} export RUN_TIDY=${RUN_TIDY:-false} # By how much to scale the test_runner timeouts (option --timeout-factor). # This is needed because some ci machines have slow CPU or disk, so sanitizers # might be slow or a reindex might be waiting on disk IO. export TEST_RUNNER_TIMEOUT_FACTOR=${TEST_RUNNER_TIMEOUT_FACTOR:-40} export RUN_FUZZ_TESTS=${RUN_FUZZ_TESTS:-false} # Randomize test order. # See https://www.boost.org/doc/libs/1_71_0/libs/test/doc/html/boost_test/utf_reference/rt_param_reference/random.html export BOOST_TEST_RANDOM=${BOOST_TEST_RANDOM:-1} # See man 7 debconf export DEBIAN_FRONTEND=noninteractive export CCACHE_MAXSIZE=${CCACHE_MAXSIZE:-100M} export CCACHE_TEMPDIR=${CCACHE_TEMPDIR:-/tmp/.ccache-temp} export CCACHE_COMPRESS=${CCACHE_COMPRESS:-1} # The cache dir. # This folder exists only on the ci guest, and on the ci host as a volume. export CCACHE_DIR=${CCACHE_DIR:-$BASE_SCRATCH_DIR/.ccache} # Folder where the build result is put (bin and lib). export BASE_OUTDIR=${BASE_OUTDIR:-$BASE_SCRATCH_DIR/out} # Folder where the build is done (dist and out-of-tree build). export BASE_BUILD_DIR=${BASE_BUILD_DIR:-$BASE_SCRATCH_DIR/build} # The folder for previous release binaries. # This folder exists only on the ci guest, and on the ci host as a volume. export PREVIOUS_RELEASES_DIR=${PREVIOUS_RELEASES_DIR:-$BASE_ROOT_DIR/prev_releases} export CI_BASE_PACKAGES=${CI_BASE_PACKAGES:-build-essential libtool autotools-dev automake pkg-config bsdmainutils curl ca-certificates ccache python3 rsync git procps bison e2fsprogs} export GOAL=${GOAL:-install} export DIR_QA_ASSETS=${DIR_QA_ASSETS:-${BASE_SCRATCH_DIR}/qa-assets} export CI_RETRY_EXE=${CI_RETRY_EXE:-"retry --"}
0
bitcoin/ci
bitcoin/ci/test/00_setup_env_win64.sh
#!/usr/bin/env bash # # Copyright (c) 2019-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 export CONTAINER_NAME=ci_win64 export CI_IMAGE_NAME_TAG="docker.io/amd64/ubuntu:22.04" # Check that Jammy can cross-compile to win64 export HOST=x86_64-w64-mingw32 export DPKG_ADD_ARCH="i386" export PACKAGES="nsis g++-mingw-w64-x86-64-posix wine-binfmt wine64 wine32 file" export RUN_FUNCTIONAL_TESTS=false export GOAL="deploy" # Prior to 11.0.0, the mingw-w64 headers were missing noreturn attributes, causing warnings when # cross-compiling for Windows. https://sourceforge.net/p/mingw-w64/bugs/306/ # https://github.com/mingw-w64/mingw-w64/commit/1690994f515910a31b9fb7c7bd3a52d4ba987abe export BITCOIN_CONFIG="--enable-reduce-exports --disable-gui-tests CXXFLAGS=-Wno-return-type"
0
bitcoin/ci
bitcoin/ci/test/00_setup_env_native_valgrind.sh
#!/usr/bin/env bash # # Copyright (c) 2019-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="docker.io/debian:bookworm" export CONTAINER_NAME=ci_native_valgrind export PACKAGES="valgrind clang llvm libclang-rt-dev python3-zmq libevent-dev libboost-dev libdb5.3++-dev libminiupnpc-dev libnatpmp-dev libzmq3-dev libsqlite3-dev" export USE_VALGRIND=1 export NO_DEPENDS=1 export TEST_RUNNER_EXTRA="--exclude feature_init,rpc_bind,feature_bind_extra" # Excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547 export GOAL="install" # Temporarily pin dwarf 4, until using Valgrind 3.20 or later export BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=no CC='clang -gdwarf-4' CXX='clang++ -gdwarf-4'" # TODO enable GUI
0
bitcoin/ci
bitcoin/ci/test/wrap-wine.sh
#!/usr/bin/env bash # # Copyright (c) 2020-2022 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 for b_name in {"${BASE_OUTDIR}/bin"/*,src/secp256k1/*tests,src/minisketch/test{,-verify},src/univalue/{test_json,unitester,object}}.exe; do # shellcheck disable=SC2044 for b in $(find "${BASE_ROOT_DIR}" -executable -type f -name "$(basename "$b_name")"); do if (file "$b" | grep "Windows"); then echo "Wrap $b ..." mv "$b" "${b}_orig" echo '#!/usr/bin/env bash' > "$b" echo "( wine \"${b}_orig\" \"\$@\" ) || ( sleep 1 && wine \"${b}_orig\" \"\$@\" )" >> "$b" chmod +x "$b" fi done done
0
bitcoin/ci
bitcoin/ci/test/00_setup_env_native_fuzz_with_msan.sh
#!/usr/bin/env bash # # Copyright (c) 2020-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="docker.io/ubuntu:22.04" LIBCXX_DIR="/msan/cxx_build/" export MSAN_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -g -O1 -fno-optimize-sibling-calls" LIBCXX_FLAGS="-nostdinc++ -nostdlib++ -isystem ${LIBCXX_DIR}include/c++/v1 -L${LIBCXX_DIR}lib -Wl,-rpath,${LIBCXX_DIR}lib -lc++ -lc++abi -lpthread -Wno-unused-command-line-argument" export MSAN_AND_LIBCXX_FLAGS="${MSAN_FLAGS} ${LIBCXX_FLAGS}" export CONTAINER_NAME="ci_native_fuzz_msan" export PACKAGES="cmake ninja-build" # BDB generates false-positives and will be removed in future export DEP_OPTS="NO_BDB=1 NO_QT=1 CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'" export GOAL="install" export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer,memory --disable-hardening --with-asm=no CFLAGS='${MSAN_FLAGS}' CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'" export USE_MEMORY_SANITIZER="true" export RUN_UNIT_TESTS="false" export RUN_FUNCTIONAL_TESTS="false" export RUN_FUZZ_TESTS=true export CCACHE_MAXSIZE=250M
0
bitcoin/ci
bitcoin/ci/test/00_setup_env_i686_multiprocess.sh
#!/usr/bin/env bash # # Copyright (c) 2020-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 export HOST=i686-pc-linux-gnu export CONTAINER_NAME=ci_i686_multiprocess export CI_IMAGE_NAME_TAG="docker.io/amd64/ubuntu:22.04" export PACKAGES="cmake llvm clang g++-multilib" export DEP_OPTS="DEBUG=1 MULTIPROCESS=1" export GOAL="install" export BITCOIN_CONFIG="--enable-debug CC='clang -m32' CXX='clang++ -m32' \ LDFLAGS='--rtlib=compiler-rt -lgcc_s' CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE'" export BITCOIND=bitcoin-node # Used in functional tests
0
bitcoin/ci
bitcoin/ci/test/00_setup_env_s390x.sh
#!/usr/bin/env bash # # Copyright (c) 2019-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 export HOST=s390x-linux-gnu export PACKAGES="python3-zmq" export CONTAINER_NAME=ci_s390x export CI_IMAGE_NAME_TAG="docker.io/s390x/debian:bookworm" export TEST_RUNNER_EXTRA="--exclude feature_init,rpc_bind,feature_bind_extra" # Excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547 export RUN_FUNCTIONAL_TESTS=true export GOAL="install" export BITCOIN_CONFIG="--enable-reduce-exports"
0
bitcoin/ci
bitcoin/ci/test/00_setup_env_mac_native.sh
#!/usr/bin/env bash # # Copyright (c) 2019-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 export HOST=x86_64-apple-darwin export PIP_PACKAGES="zmq" export GOAL="install" export BITCOIN_CONFIG="--with-gui --with-miniupnpc --with-natpmp --enable-reduce-exports" export CI_OS_NAME="macos" export NO_DEPENDS=1 export OSX_SDK="" export CCACHE_MAXSIZE=400M export RUN_FUZZ_TESTS=true
0
bitcoin/ci
bitcoin/ci/test/00_setup_env_mac.sh
#!/usr/bin/env bash # # Copyright (c) 2019-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 export SDK_URL=${SDK_URL:-https://bitcoincore.org/depends-sources/sdks} export CONTAINER_NAME=ci_macos_cross export CI_IMAGE_NAME_TAG="docker.io/ubuntu:22.04" export HOST=x86_64-apple-darwin export PACKAGES="cmake zip" export XCODE_VERSION=15.0 export XCODE_BUILD_ID=15A240d export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false export GOAL="deploy" export BITCOIN_CONFIG="--with-gui --enable-reduce-exports"
0
bitcoin/ci
bitcoin/ci/test/00_setup_env_android.sh
#!/usr/bin/env bash # # Copyright (c) 2019-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 export HOST=aarch64-linux-android export PACKAGES="unzip openjdk-8-jdk gradle" export CONTAINER_NAME=ci_android export CI_IMAGE_NAME_TAG="docker.io/amd64/ubuntu:22.04" export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false export ANDROID_API_LEVEL=28 export ANDROID_BUILD_TOOLS_VERSION=28.0.3 export ANDROID_NDK_VERSION=23.2.8568313 export ANDROID_TOOLS_URL=https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip export ANDROID_HOME="${DEPENDS_DIR}/SDKs/android" export ANDROID_NDK_HOME="${ANDROID_HOME}/ndk/${ANDROID_NDK_VERSION}" export DEP_OPTS="ANDROID_SDK=${ANDROID_HOME} ANDROID_NDK=${ANDROID_NDK_HOME} ANDROID_API_LEVEL=${ANDROID_API_LEVEL} ANDROID_TOOLCHAIN_BIN=${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/" export BITCOIN_CONFIG="--disable-tests --enable-gui-tests --disable-bench --disable-fuzz-binary --without-utils --without-libs --without-daemon"
0
bitcoin/ci
bitcoin/ci/test/03_test_script.sh
#!/usr/bin/env bash # # Copyright (c) 2018-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 set -ex export ASAN_OPTIONS="detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1" export LSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/lsan" export TSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/tsan:halt_on_error=1:log_path=${BASE_SCRATCH_DIR}/sanitizer-output/tsan" export UBSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1:report_error_type=1" if [ "$CI_OS_NAME" == "macos" ]; then top -l 1 -s 0 | awk ' /PhysMem/ {print}' echo "Number of CPUs: $(sysctl -n hw.logicalcpu)" else free -m -h echo "Number of CPUs (nproc): $(nproc)" echo "System info: $(uname --kernel-name --kernel-release)" lscpu fi echo "Free disk space:" df -h # What host to compile for. See also ./depends/README.md # Tests that need cross-compilation export the appropriate HOST. # Tests that run natively guess the host export HOST=${HOST:-$("$BASE_ROOT_DIR/depends/config.guess")} ( # compact->outputs[i].file_size is uninitialized memory, so reading it is UB. # The statistic bytes_written is only used for logging, which is disabled in # CI, so as a temporary minimal fix to work around UB and CI failures, leave # bytes_written unmodified. # See https://github.com/bitcoin/bitcoin/pull/28359#issuecomment-1698694748 echo 'diff --git a/src/leveldb/db/db_impl.cc b/src/leveldb/db/db_impl.cc index 65e31724bc..f61b471953 100644 --- a/src/leveldb/db/db_impl.cc +++ b/src/leveldb/db/db_impl.cc @@ -1028,9 +1028,6 @@ Status DBImpl::DoCompactionWork(CompactionState* compact) { stats.bytes_read += compact->compaction->input(which, i)->file_size; } } - for (size_t i = 0; i < compact->outputs.size(); i++) { - stats.bytes_written += compact->outputs[i].file_size; - } mutex_.Lock(); stats_[compact->compaction->level() + 1].Add(stats);' | patch -p1 git diff ) if [ "$RUN_FUZZ_TESTS" = "true" ]; then export DIR_FUZZ_IN=${DIR_QA_ASSETS}/fuzz_seed_corpus/ if [ ! -d "$DIR_FUZZ_IN" ]; then ${CI_RETRY_EXE} git clone --depth=1 https://github.com/bitcoin-core/qa-assets "${DIR_QA_ASSETS}" fi ( cd "${DIR_QA_ASSETS}" echo "Using qa-assets repo from commit ..." git log -1 ) elif [ "$RUN_UNIT_TESTS" = "true" ] || [ "$RUN_UNIT_TESTS_SEQUENTIAL" = "true" ]; then export DIR_UNIT_TEST_DATA=${DIR_QA_ASSETS}/unit_test_data/ if [ ! -d "$DIR_UNIT_TEST_DATA" ]; then mkdir -p "$DIR_UNIT_TEST_DATA" ${CI_RETRY_EXE} curl --location --fail https://github.com/bitcoin-core/qa-assets/raw/main/unit_test_data/script_assets_test.json -o "${DIR_UNIT_TEST_DATA}/script_assets_test.json" fi fi mkdir -p "${BASE_SCRATCH_DIR}/sanitizer-output/" if [ "$USE_BUSY_BOX" = "true" ]; then echo "Setup to use BusyBox utils" # tar excluded for now because it requires passing in the exact archive type in ./depends (fixed in later BusyBox version) # ar excluded for now because it does not recognize the -q option in ./depends (unknown if fixed) for util in $(busybox --list | grep -v "^ar$" | grep -v "^tar$" ); do ln -s "$(command -v busybox)" "${BINS_SCRATCH_DIR}/$util"; done # Print BusyBox version patch --help fi # Make sure default datadir does not exist and is never read by creating a dummy file if [ "$CI_OS_NAME" == "macos" ]; then echo > "${HOME}/Library/Application Support/Bitcoin" else echo > "${HOME}/.bitcoin" fi if [ -z "$NO_DEPENDS" ]; then if [[ $CI_IMAGE_NAME_TAG == *centos* ]]; then SHELL_OPTS="CONFIG_SHELL=/bin/dash" else SHELL_OPTS="CONFIG_SHELL=" fi bash -c "$SHELL_OPTS make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS LOG=1" fi if [ "$DOWNLOAD_PREVIOUS_RELEASES" = "true" ]; then test/get_previous_releases.py -b -t "$PREVIOUS_RELEASES_DIR" fi BITCOIN_CONFIG_ALL="--disable-dependency-tracking" if [ -z "$NO_DEPENDS" ]; then BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} CONFIG_SITE=$DEPENDS_DIR/$HOST/share/config.site" fi if [ -z "$NO_WERROR" ]; then BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} --enable-werror" fi ccache --zero-stats PRINT_CCACHE_STATISTICS="ccache --version | head -n 1 && ccache --show-stats" if [ -n "$ANDROID_TOOLS_URL" ]; then make distclean || true ./autogen.sh bash -c "./configure $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG" || ( (cat config.log) && false) make "${MAKEJOBS}" && cd src/qt && ANDROID_HOME=${ANDROID_HOME} ANDROID_NDK_HOME=${ANDROID_NDK_HOME} make apk bash -c "${PRINT_CCACHE_STATISTICS}" exit 0 fi BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} --enable-external-signer --prefix=$BASE_OUTDIR" if [ -n "$CONFIG_SHELL" ]; then "$CONFIG_SHELL" -c "./autogen.sh" else ./autogen.sh fi mkdir -p "${BASE_BUILD_DIR}" cd "${BASE_BUILD_DIR}" bash -c "${BASE_ROOT_DIR}/configure --cache-file=config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG" || ( (cat config.log) && false) make distdir VERSION="$HOST" cd "${BASE_BUILD_DIR}/bitcoin-$HOST" bash -c "./configure --cache-file=../config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG" || ( (cat config.log) && false) if [[ "${RUN_TIDY}" == "true" ]]; then MAYBE_BEAR="bear --config src/.bear-tidy-config" MAYBE_TOKEN="--" fi bash -c "${MAYBE_BEAR} ${MAYBE_TOKEN} make $MAKEJOBS $GOAL" || ( echo "Build failure. Verbose build follows." && make "$GOAL" V=1 ; false ) bash -c "${PRINT_CCACHE_STATISTICS}" du -sh "${DEPENDS_DIR}"/*/ du -sh "${PREVIOUS_RELEASES_DIR}" if [[ $HOST = *-mingw32 ]]; then # Generate all binaries, so that they can be wrapped make "$MAKEJOBS" -C src/secp256k1 VERBOSE=1 make "$MAKEJOBS" -C src minisketch/test.exe VERBOSE=1 "${BASE_ROOT_DIR}/ci/test/wrap-wine.sh" fi if [ -n "$USE_VALGRIND" ]; then "${BASE_ROOT_DIR}/ci/test/wrap-valgrind.sh" fi if [ "$RUN_UNIT_TESTS" = "true" ]; then DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" make "${MAKEJOBS}" check VERBOSE=1 fi if [ "$RUN_UNIT_TESTS_SEQUENTIAL" = "true" ]; then DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" "${BASE_OUTDIR}"/bin/test_bitcoin --catch_system_errors=no -l test_suite fi if [ "$RUN_FUNCTIONAL_TESTS" = "true" ]; then # shellcheck disable=SC2086 LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" test/functional/test_runner.py --ci "${MAKEJOBS}" --tmpdirprefix "${BASE_SCRATCH_DIR}"/test_runner/ --ansi --combinedlogslen=99999999 --timeout-factor="${TEST_RUNNER_TIMEOUT_FACTOR}" ${TEST_RUNNER_EXTRA} --quiet --failfast fi if [ "${RUN_TIDY}" = "true" ]; then cmake -B /tidy-build -DLLVM_DIR=/usr/lib/llvm-"${TIDY_LLVM_V}"/cmake -DCMAKE_BUILD_TYPE=Release -S "${BASE_ROOT_DIR}"/contrib/devtools/bitcoin-tidy cmake --build /tidy-build "$MAKEJOBS" cmake --build /tidy-build --target bitcoin-tidy-tests "$MAKEJOBS" set -eo pipefail cd "${BASE_BUILD_DIR}/bitcoin-$HOST/src/" ( run-clang-tidy-"${TIDY_LLVM_V}" -quiet -load="/tidy-build/libbitcoin-tidy.so" "${MAKEJOBS}" ) | grep -C5 "error" # Filter out files by regex here, because regex may not be # accepted in src/.bear-tidy-config # Filter out: # * qt qrc and moc generated files jq 'map(select(.file | test("src/qt/qrc_.*\\.cpp$|/moc_.*\\.cpp$") | not))' ../compile_commands.json > tmp.json mv tmp.json ../compile_commands.json cd "${BASE_BUILD_DIR}/bitcoin-$HOST/" python3 "/include-what-you-use/iwyu_tool.py" \ -p . "${MAKEJOBS}" \ -- -Xiwyu --cxx17ns -Xiwyu --mapping_file="${BASE_BUILD_DIR}/bitcoin-$HOST/contrib/devtools/iwyu/bitcoin.core.imp" \ -Xiwyu --max_line_length=160 \ 2>&1 | tee /tmp/iwyu_ci.out cd "${BASE_ROOT_DIR}/src" python3 "/include-what-you-use/fix_includes.py" --nosafe_headers < /tmp/iwyu_ci.out git --no-pager diff fi if [ "$RUN_FUZZ_TESTS" = "true" ]; then # shellcheck disable=SC2086 LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" test/fuzz/test_runner.py ${FUZZ_TESTS_CONFIG} "${MAKEJOBS}" -l DEBUG "${DIR_FUZZ_IN}" --empty_min_time=60 fi
0
bitcoin/ci
bitcoin/ci/test/00_setup_env_arm.sh
#!/usr/bin/env bash # # Copyright (c) 2019-2021 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 export HOST=arm-linux-gnueabihf export DPKG_ADD_ARCH="armhf" export PACKAGES="python3-zmq g++-arm-linux-gnueabihf busybox libc6:armhf libstdc++6:armhf libfontconfig1:armhf libxcb1:armhf" export CONTAINER_NAME=ci_arm_linux export CI_IMAGE_NAME_TAG="docker.io/arm64v8/debian:bookworm" export USE_BUSY_BOX=true export RUN_UNIT_TESTS=true export RUN_FUNCTIONAL_TESTS=false export GOAL="install" # -Wno-psabi is to disable ABI warnings: "note: parameter passing for argument of type ... changed in GCC 7.1" # This could be removed once the ABI change warning does not show up by default export BITCOIN_CONFIG="--enable-reduce-exports CXXFLAGS=-Wno-psabi"
0
bitcoin/ci
bitcoin/ci/test/00_setup_env_native_nowallet_libbitcoinkernel.sh
#!/usr/bin/env bash # # Copyright (c) 2019-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 export CONTAINER_NAME=ci_native_nowallet_libbitcoinkernel export CI_IMAGE_NAME_TAG="docker.io/debian:bullseye" # Use minimum supported python3.9 and clang-13, see doc/dependencies.md export PACKAGES="python3-zmq clang-13 llvm-13 libc++abi-13-dev libc++-13-dev" export DEP_OPTS="NO_WALLET=1 CC=clang-13 CXX='clang++-13 -stdlib=libc++'" export GOAL="install" export BITCOIN_CONFIG="--enable-reduce-exports --enable-experimental-util-chainstate --with-experimental-kernel-lib --enable-shared"
0
bitcoin/ci
bitcoin/ci/test/00_setup_env_native_tsan.sh
#!/usr/bin/env bash # # Copyright (c) 2019-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 export CONTAINER_NAME=ci_native_tsan export CI_IMAGE_NAME_TAG="docker.io/ubuntu:24.04" export PACKAGES="clang-17 llvm-17 libclang-rt-17-dev libc++abi-17-dev libc++-17-dev python3-zmq" export DEP_OPTS="CC=clang-17 CXX='clang++-17 -stdlib=libc++'" export GOAL="install" export BITCOIN_CONFIG="--enable-zmq CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKORDER -DDEBUG_LOCKCONTENTION' CXXFLAGS='-g' --with-sanitizers=thread"
0
bitcoin/ci
bitcoin/ci/test/00_setup_env_native_msan.sh
#!/usr/bin/env bash # # Copyright (c) 2020-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="docker.io/ubuntu:22.04" LIBCXX_DIR="/msan/cxx_build/" export MSAN_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -g -O1 -fno-optimize-sibling-calls" LIBCXX_FLAGS="-nostdinc++ -nostdlib++ -isystem ${LIBCXX_DIR}include/c++/v1 -L${LIBCXX_DIR}lib -Wl,-rpath,${LIBCXX_DIR}lib -lc++ -lc++abi -lpthread -Wno-unused-command-line-argument" export MSAN_AND_LIBCXX_FLAGS="${MSAN_FLAGS} ${LIBCXX_FLAGS}" export CONTAINER_NAME="ci_native_msan" export PACKAGES="cmake ninja-build" # BDB generates false-positives and will be removed in future export DEP_OPTS="NO_BDB=1 NO_QT=1 CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'" export GOAL="install" export BITCOIN_CONFIG="--with-sanitizers=memory --disable-hardening --with-asm=no CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'" export USE_MEMORY_SANITIZER="true" export RUN_FUNCTIONAL_TESTS="false" export CCACHE_MAXSIZE=250M
0
bitcoin/ci
bitcoin/ci/test/01_base_install.sh
#!/usr/bin/env bash # # Copyright (c) 2018-2022 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C.UTF-8 set -ex CFG_DONE="ci.base-install-done" # Use a global git setting to remember whether this script ran to avoid running it twice if [ "$(git config --global ${CFG_DONE})" == "true" ]; then echo "Skip base install" exit 0 fi if [ -n "$DPKG_ADD_ARCH" ]; then dpkg --add-architecture "$DPKG_ADD_ARCH" fi if [[ $CI_IMAGE_NAME_TAG == *centos* ]]; then bash -c "dnf -y install epel-release" bash -c "dnf -y --allowerasing install $CI_BASE_PACKAGES $PACKAGES" elif [ "$CI_OS_NAME" != "macos" ]; then if [[ -n "${APPEND_APT_SOURCES_LIST}" ]]; then echo "${APPEND_APT_SOURCES_LIST}" >> /etc/apt/sources.list fi ${CI_RETRY_EXE} apt-get update ${CI_RETRY_EXE} bash -c "apt-get install --no-install-recommends --no-upgrade -y $PACKAGES $CI_BASE_PACKAGES" fi if [ -n "$PIP_PACKAGES" ]; then # shellcheck disable=SC2086 ${CI_RETRY_EXE} pip3 install --user $PIP_PACKAGES fi if [[ ${USE_MEMORY_SANITIZER} == "true" ]]; then ${CI_RETRY_EXE} git clone --depth=1 https://github.com/llvm/llvm-project -b llvmorg-17.0.2 /msan/llvm-project cmake -G Ninja -B /msan/clang_build/ \ -DLLVM_ENABLE_PROJECTS="clang" \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_TARGETS_TO_BUILD=Native \ -DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" \ -S /msan/llvm-project/llvm ninja -C /msan/clang_build/ "-j$( nproc )" # Use nproc, because MAKEJOBS is the default in docker image builds ninja -C /msan/clang_build/ install-runtimes update-alternatives --install /usr/bin/clang++ clang++ /msan/clang_build/bin/clang++ 100 update-alternatives --install /usr/bin/clang clang /msan/clang_build/bin/clang 100 update-alternatives --install /usr/bin/llvm-symbolizer llvm-symbolizer /msan/clang_build/bin/llvm-symbolizer 100 cmake -G Ninja -B /msan/cxx_build/ \ -DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi' \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_USE_SANITIZER=MemoryWithOrigins \ -DCMAKE_C_COMPILER=clang \ -DCMAKE_CXX_COMPILER=clang++ \ -DLLVM_TARGETS_TO_BUILD=Native \ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \ -DLIBCXX_HARDENING_MODE=debug \ -S /msan/llvm-project/runtimes ninja -C /msan/cxx_build/ "-j$( nproc )" # Use nproc, because MAKEJOBS is the default in docker image builds fi if [[ "${RUN_TIDY}" == "true" ]]; then ${CI_RETRY_EXE} git clone --depth=1 https://github.com/include-what-you-use/include-what-you-use -b clang_"${TIDY_LLVM_V}" /include-what-you-use cmake -B /iwyu-build/ -G 'Unix Makefiles' -DCMAKE_PREFIX_PATH=/usr/lib/llvm-"${TIDY_LLVM_V}" -S /include-what-you-use make -C /iwyu-build/ install "-j$( nproc )" # Use nproc, because MAKEJOBS is the default in docker image builds fi mkdir -p "${DEPENDS_DIR}/SDKs" "${DEPENDS_DIR}/sdk-sources" OSX_SDK_BASENAME="Xcode-${XCODE_VERSION}-${XCODE_BUILD_ID}-extracted-SDK-with-libcxx-headers" if [ -n "$XCODE_VERSION" ] && [ ! -d "${DEPENDS_DIR}/SDKs/${OSX_SDK_BASENAME}" ]; then OSX_SDK_FILENAME="${OSX_SDK_BASENAME}.tar.gz" OSX_SDK_PATH="${DEPENDS_DIR}/sdk-sources/${OSX_SDK_FILENAME}" if [ ! -f "$OSX_SDK_PATH" ]; then ${CI_RETRY_EXE} curl --location --fail "${SDK_URL}/${OSX_SDK_FILENAME}" -o "$OSX_SDK_PATH" fi tar -C "${DEPENDS_DIR}/SDKs" -xf "$OSX_SDK_PATH" fi if [ -n "$ANDROID_HOME" ] && [ ! -d "$ANDROID_HOME" ]; then ANDROID_TOOLS_PATH=${DEPENDS_DIR}/sdk-sources/android-tools.zip if [ ! -f "$ANDROID_TOOLS_PATH" ]; then ${CI_RETRY_EXE} curl --location --fail "${ANDROID_TOOLS_URL}" -o "$ANDROID_TOOLS_PATH" fi mkdir -p "$ANDROID_HOME" unzip -o "$ANDROID_TOOLS_PATH" -d "$ANDROID_HOME" yes | "${ANDROID_HOME}"/cmdline-tools/bin/sdkmanager --sdk_root="${ANDROID_HOME}" --install "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" "platform-tools" "platforms;android-31" "platforms;android-${ANDROID_API_LEVEL}" "ndk;${ANDROID_NDK_VERSION}" fi git config --global ${CFG_DONE} "true"
0
bitcoin/ci
bitcoin/ci/retry/retry
#!/usr/bin/env bash GETOPT_BIN=$IN_GETOPT_BIN GETOPT_BIN=${GETOPT_BIN:-getopt} __sleep_amount() { if [ -n "$constant_sleep" ]; then sleep_time=$constant_sleep else #TODO: check for awk #TODO: check if user would rather use one of the other possible dependencies: python, ruby, bc, dc sleep_time=`awk "BEGIN {t = $min_sleep * $(( (1<<($attempts -1)) )); print (t > $max_sleep ? $max_sleep : t)}"` fi } __log_out() { echo "$1" 1>&2 } # Parameters: max_tries min_sleep max_sleep constant_sleep fail_script EXECUTION_COMMAND retry() { local max_tries="$1"; shift local min_sleep="$1"; shift local max_sleep="$1"; shift local constant_sleep="$1"; shift local fail_script="$1"; shift if [ -n "$VERBOSE" ]; then __log_out "Retry Parameters: max_tries=$max_tries min_sleep=$min_sleep max_sleep=$max_sleep constant_sleep=$constant_sleep" if [ -n "$fail_script" ]; then __log_out "Fail script: $fail_script"; fi __log_out "" __log_out "Execution Command: $*" __log_out "" fi local attempts=0 local return_code=1 while [[ $return_code -ne 0 && $attempts -le $max_tries ]]; do if [ $attempts -gt 0 ]; then __sleep_amount __log_out "Before retry #$attempts: sleeping $sleep_time seconds" sleep $sleep_time fi P="$1" for param in "${@:2}"; do P="$P '$param'"; done #TODO: replace single quotes in each arg with '"'"' ? export RETRY_ATTEMPT=$attempts bash -c "$P" return_code=$? #__log_out "Process returned $return_code on attempt $attempts" if [ $return_code -eq 127 ]; then # command not found exit $return_code elif [ $return_code -ne 0 ]; then attempts=$[$attempts +1] fi done if [ $attempts -gt $max_tries ]; then if [ -n "$fail_script" ]; then __log_out "Retries exhausted, running fail script" eval $fail_script else __log_out "Retries exhausted" fi fi exit $return_code } # If we're being sourced, don't worry about such things if [ "$BASH_SOURCE" == "$0" ]; then # Prints the help text help() { local retry=$(basename $0) cat <<EOF Usage: $retry [options] -- execute command -h, -?, --help -v, --verbose Verbose output -t, --tries=# Set max retries: Default 10 -s, --sleep=secs Constant sleep amount (seconds) -m, --min=secs Exponential Backoff: minimum sleep amount (seconds): Default 0.3 -x, --max=secs Exponential Backoff: maximum sleep amount (seconds): Default 60 -f, --fail="script +cmds" Fail Script: run in case of final failure EOF } # show help for no arguments if stdin is a terminal if { [ -z "$1" ] && [ -t 0 ] ; } || [ "$1" == '-h' ] || [ "$1" == '-?' ] || [ "$1" == '--help' ] then help exit 0 fi $GETOPT_BIN --test > /dev/null if [[ $? -ne 4 ]]; then echo "I’m sorry, 'getopt --test' failed in this environment. Please load GNU getopt." exit 1 fi OPTIONS=vt:s:m:x:f: LONGOPTIONS=verbose,tries:,sleep:,min:,max:,fail: PARSED=$($GETOPT_BIN --options="$OPTIONS" --longoptions="$LONGOPTIONS" --name "$0" -- "$@") if [[ $? -ne 0 ]]; then # e.g. $? == 1 # then getopt has complained about wrong arguments to stdout exit 2 fi # read getopt’s output this way to handle the quoting right: eval set -- "$PARSED" max_tries=10 min_sleep=0.3 max_sleep=60.0 constant_sleep= fail_script= # now enjoy the options in order and nicely split until we see -- while true; do case "$1" in -v|--verbose) VERBOSE=true shift ;; -t|--tries) max_tries="$2" shift 2 ;; -s|--sleep) constant_sleep="$2" shift 2 ;; -m|--min) min_sleep="$2" shift 2 ;; -x|--max) max_sleep="$2" shift 2 ;; -f|--fail) fail_script="$2" shift 2 ;; --) shift break ;; *) echo "Programming error" exit 3 ;; esac done retry "$max_tries" "$min_sleep" "$max_sleep" "$constant_sleep" "$fail_script" "$@" fi
0
bitcoin/ci
bitcoin/ci/retry/README.md
retry - The command line retry tool ------------------------------------------ Retry any shell command with exponential backoff or constant delay. ### Instructions Install: retry is a shell script, so drop it somewhere and make sure it's added to your $PATH. Or you can use the following one-liner: ```sh sudo sh -c "curl https://raw.githubusercontent.com/kadwanev/retry/master/retry -o /usr/local/bin/retry && chmod +x /usr/local/bin/retry" ``` If you're on OS X, retry is also on Homebrew: ``` brew pull 27283 brew install retry ``` Not popular enough for homebrew-core. Please star this project to help. ### Usage Help: `retry -?` Usage: retry [options] -- execute command -h, -?, --help -v, --verbose Verbose output -t, --tries=# Set max retries: Default 10 -s, --sleep=secs Constant sleep amount (seconds) -m, --min=secs Exponential Backoff: minimum sleep amount (seconds): Default 0.3 -x, --max=secs Exponential Backoff: maximum sleep amount (seconds): Default 60 -f, --fail="script +cmds" Fail Script: run in case of final failure ### Examples No problem: `retry echo u work good` u work good Test functionality: `retry 'echo "y u no work"; false'` y u no work Before retry #1: sleeping 0.3 seconds y u no work Before retry #2: sleeping 0.6 seconds y u no work Before retry #3: sleeping 1.2 seconds y u no work Before retry #4: sleeping 2.4 seconds y u no work Before retry #5: sleeping 4.8 seconds y u no work Before retry #6: sleeping 9.6 seconds y u no work Before retry #7: sleeping 19.2 seconds y u no work Before retry #8: sleeping 38.4 seconds y u no work Before retry #9: sleeping 60.0 seconds y u no work Before retry #10: sleeping 60.0 seconds y u no work etc.. Limit retries: `retry -t 4 'echo "y u no work"; false'` y u no work Before retry #1: sleeping 0.3 seconds y u no work Before retry #2: sleeping 0.6 seconds y u no work Before retry #3: sleeping 1.2 seconds y u no work Before retry #4: sleeping 2.4 seconds y u no work Retries exhausted Bad command: `retry poop` bash: poop: command not found Fail command: `retry -t 3 -f 'echo "oh poopsickles"' 'echo "y u no work"; false'` y u no work Before retry #1: sleeping 0.3 seconds y u no work Before retry #2: sleeping 0.6 seconds y u no work Before retry #3: sleeping 1.2 seconds y u no work Retries exhausted, running fail script oh poopsickles Last attempt passed: `retry -t 3 -- 'if [ $RETRY_ATTEMPT -eq 3 ]; then echo Passed at attempt $RETRY_ATTEMPT; true; else echo Failed at attempt $RETRY_ATTEMPT; false; fi;'` Failed at attempt 0 Before retry #1: sleeping 0.3 seconds Failed at attempt 1 Before retry #2: sleeping 0.6 seconds Failed at attempt 2 Before retry #3: sleeping 1.2 seconds Passed at attempt 3 ### License Apache 2.0 - go nuts
0
bitcoin
bitcoin/contrib/filter-lcov.py
#!/usr/bin/env python3 # Copyright (c) 2017-2020 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. import argparse parser = argparse.ArgumentParser(description='Remove the coverage data from a tracefile for all files matching the pattern.') parser.add_argument('--pattern', '-p', action='append', help='the pattern of files to remove', required=True) parser.add_argument('tracefile', help='the tracefile to remove the coverage data from') parser.add_argument('outfile', help='filename for the output to be written to') args = parser.parse_args() tracefile = args.tracefile pattern = args.pattern outfile = args.outfile in_remove = False with open(tracefile, 'r', encoding="utf8") as f: with open(outfile, 'w', encoding="utf8") as wf: for line in f: for p in pattern: if line.startswith("SF:") and p in line: in_remove = True if not in_remove: wf.write(line) if line == 'end_of_record\n': in_remove = False
0
bitcoin
bitcoin/contrib/README.md
Repository Tools --------------------- ### [Developer tools](/contrib/devtools) ### Specific tools for developers working on this repository. Additional tools, including the `github-merge.py` script, are available in the [maintainer-tools](https://github.com/bitcoin-core/bitcoin-maintainer-tools) repository. ### [Verify-Commits](/contrib/verify-commits) ### Tool to verify that every merge commit was signed by a developer using the `github-merge.py` script. ### [Linearize](/contrib/linearize) ### Construct a linear, no-fork, best version of the blockchain. ### [Qos](/contrib/qos) ### A Linux bash script that will set up traffic control (tc) to limit the outgoing bandwidth for connections to the Bitcoin network. This means one can have an always-on bitcoind instance running, and another local bitcoind/bitcoin-qt instance which connects to this node and receives blocks from it. ### [Seeds](/contrib/seeds) ### Utility to generate the pnSeed[] array that is compiled into the client. Build Tools and Keys --------------------- ### Packaging ### The [Debian](/contrib/debian) subfolder contains the copyright file. All other packaging related files can be found in the [bitcoin-core/packaging](https://github.com/bitcoin-core/packaging) repository. ### [MacDeploy](/contrib/macdeploy) ### Scripts and notes for Mac builds. Test and Verify Tools --------------------- ### [TestGen](/contrib/testgen) ### Utilities to generate test vectors for the data-driven Bitcoin tests. ### [Verify-Binaries](/contrib/verify-binaries) ### This script attempts to download and verify the signature file SHA256SUMS.asc from bitcoin.org. Command Line Tools --------------------- ### [Completions](/contrib/completions) ### Shell completions for bash and fish.
0
bitcoin
bitcoin/contrib/valgrind.supp
# This valgrind suppressions file includes known Valgrind warnings in our # dependencies that cannot be fixed in-tree. # # Example use: # $ valgrind --suppressions=contrib/valgrind.supp src/test/test_bitcoin # $ valgrind --suppressions=contrib/valgrind.supp --leak-check=full \ # --show-leak-kinds=all src/test/test_bitcoin # # To create suppressions for found issues, use the --gen-suppressions=all option: # $ valgrind --suppressions=contrib/valgrind.supp --leak-check=full \ # --show-leak-kinds=all --gen-suppressions=all --show-reachable=yes \ # --error-limit=no src/test/test_bitcoin # # Note that suppressions may depend on OS and/or library versions. # Tested on: # * aarch64 (Debian Bookworm system libs, clang, without gui) # * x86_64 (Debian Bookworm system libs, clang, without gui) { Suppress libdb warning - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=662917 Memcheck:Cond obj:*/libdb_cxx-*.so fun:__log_put } { Suppress libdb warning Memcheck:Param pwrite64(buf) fun:pwrite fun:__os_io } { Suppress libdb warning Memcheck:Cond fun:__log_putr.isra.1 } { Suppress libdb warning Memcheck:Param pwrite64(buf) ... obj:*/libdb_cxx-*.so } { Suppress uninitialized bytes warning in compat code Memcheck:Param ioctl(TCSET{S,SW,SF}) fun:tcsetattr } { Suppress libdb warning Memcheck:Leak fun:malloc ... obj:*/libdb_cxx-*.so } { Suppress leaks on shutdown Memcheck:Leak ... fun:_Z8ShutdownR11NodeContext } { Suppress leveldb leak Memcheck:Leak match-leak-kinds: reachable fun:_Znwm ... fun:_ZN7leveldb6DBImpl14BackgroundCallEv } { Suppress leveldb leak Memcheck:Leak fun:_Znwm ... fun:GetCoin } { Suppress LogInstance still reachable memory warning Memcheck:Leak match-leak-kinds: reachable fun:_Znwm fun:_Z11LogInstancev } { Suppress BCLog::Logger::StartLogging() still reachable memory warning Memcheck:Leak match-leak-kinds: reachable fun:malloc ... fun:_ZN5BCLog6Logger12StartLoggingEv } { Suppress https://bugs.kde.org/show_bug.cgi?id=472219 - fixed in Valgrind 3.22. Memcheck:Param ppoll(ufds.events) obj:/lib/ld-musl-aarch64.so.1 }
0
bitcoin/contrib
bitcoin/contrib/init/bitcoind.openrcconf
# /etc/conf.d/bitcoind: config file for /etc/init.d/bitcoind # Config file location #BITCOIND_CONFIGFILE="/etc/bitcoin/bitcoin.conf" # What directory to write pidfile to? (created and owned by $BITCOIND_USER) #BITCOIND_PIDDIR="/var/run/bitcoind" # What filename to give the pidfile #BITCOIND_PIDFILE="${BITCOIND_PIDDIR}/bitcoind.pid" # Where to write bitcoind data (be mindful that the blockchain is large) #BITCOIND_DATADIR="/var/lib/bitcoind" # User and group to own bitcoind process #BITCOIND_USER="bitcoin" #BITCOIND_GROUP="bitcoin" # Path to bitcoind executable #BITCOIND_BIN="/usr/bin/bitcoind" # Nice value to run bitcoind under #BITCOIND_NICE=0 # Additional options (avoid -conf and -datadir, use flags above) #BITCOIND_OPTS="" # The timeout in seconds OpenRC will wait for bitcoind to terminate # after a SIGTERM has been raised. # Note that this will be mapped as argument to start-stop-daemon's # '--retry' option, which means you can specify a retry schedule # here. For more information see man 8 start-stop-daemon. BITCOIND_SIGTERM_TIMEOUT=600
0
bitcoin/contrib
bitcoin/contrib/init/bitcoind.init
#!/usr/bin/env bash # # bitcoind The bitcoin core server. # # # chkconfig: 345 80 20 # description: bitcoind # processname: bitcoind # # Source function library. . /etc/init.d/functions # you can override defaults in /etc/sysconfig/bitcoind, see below if [ -f /etc/sysconfig/bitcoind ]; then . /etc/sysconfig/bitcoind fi RETVAL=0 prog=bitcoind # you can override the lockfile via BITCOIND_LOCKFILE in /etc/sysconfig/bitcoind lockfile=${BITCOIND_LOCKFILE-/var/lock/subsys/bitcoind} # bitcoind defaults to /usr/bin/bitcoind, override with BITCOIND_BIN bitcoind=${BITCOIND_BIN-/usr/bin/bitcoind} # bitcoind opts default to -disablewallet, override with BITCOIND_OPTS bitcoind_opts=${BITCOIND_OPTS--disablewallet} start() { echo -n $"Starting $prog: " daemon $DAEMONOPTS $bitcoind $bitcoind_opts RETVAL=$? echo [ $RETVAL -eq 0 ] && touch $lockfile return $RETVAL } stop() { echo -n $"Stopping $prog: " killproc $prog -t600 RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f $lockfile return $RETVAL } case "$1" in start) start ;; stop) stop ;; status) status $prog ;; restart) stop start ;; *) echo "Usage: service $prog {start|stop|status|restart}" exit 1 ;; esac
0
bitcoin/contrib
bitcoin/contrib/init/org.bitcoin.bitcoind.plist
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>org.bitcoin.bitcoind</string> <key>ProgramArguments</key> <array> <string>/usr/local/bin/bitcoind</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist>
0
bitcoin/contrib
bitcoin/contrib/init/README.md
Sample configuration files for: ``` systemd: bitcoind.service Upstart: bitcoind.conf OpenRC: bitcoind.openrc bitcoind.openrcconf CentOS: bitcoind.init macOS: org.bitcoin.bitcoind.plist ``` have been made available to assist packagers in creating node packages here. See [doc/init.md](../../doc/init.md) for more information.
0
bitcoin/contrib
bitcoin/contrib/init/bitcoind.conf
description "Bitcoin Core Daemon" start on runlevel [2345] stop on starting rc RUNLEVEL=[016] env BITCOIND_BIN="/usr/bin/bitcoind" env BITCOIND_USER="bitcoin" env BITCOIND_GROUP="bitcoin" env BITCOIND_PIDDIR="/var/run/bitcoind" # upstart can't handle variables constructed with other variables env BITCOIND_PIDFILE="/var/run/bitcoind/bitcoind.pid" env BITCOIND_CONFIGFILE="/etc/bitcoin/bitcoin.conf" env BITCOIND_DATADIR="/var/lib/bitcoind" expect fork respawn respawn limit 5 120 kill timeout 600 pre-start script # this will catch non-existent config files # bitcoind will check and exit with this very warning, but it can do so # long after forking, leaving upstart to think everything started fine. # since this is a commonly encountered case on install, just check and # warn here. if ! grep -qs '^rpcpassword=' "$BITCOIND_CONFIGFILE" ; then echo "ERROR: You must set a secure rpcpassword to run bitcoind." echo "The setting must appear in $BITCOIND_CONFIGFILE" echo echo "This password is security critical to securing wallets " echo "and must not be the same as the rpcuser setting." echo "You can generate a suitable random password using the following " echo "command from the shell:" echo echo "bash -c 'tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo'" echo echo "It is recommended that you also set alertnotify so you are " echo "notified of problems:" echo echo "ie: alertnotify=echo %%s | mail -s \"Bitcoin Alert\"" \ "admin@foo.com" echo exit 1 fi mkdir -p "$BITCOIND_PIDDIR" chmod 0755 "$BITCOIND_PIDDIR" chown $BITCOIND_USER:$BITCOIND_GROUP "$BITCOIND_PIDDIR" chown $BITCOIND_USER:$BITCOIND_GROUP "$BITCOIND_CONFIGFILE" chmod 0660 "$BITCOIND_CONFIGFILE" end script exec start-stop-daemon \ --start \ --pidfile "$BITCOIND_PIDFILE" \ --chuid $BITCOIND_USER:$BITCOIND_GROUP \ --exec "$BITCOIND_BIN" \ -- \ -pid="$BITCOIND_PIDFILE" \ -conf="$BITCOIND_CONFIGFILE" \ -datadir="$BITCOIND_DATADIR" \ -disablewallet \ -daemon
0
bitcoin/contrib
bitcoin/contrib/init/bitcoind.service
# It is not recommended to modify this file in-place, because it will # be overwritten during package upgrades. If you want to add further # options or overwrite existing ones then use # $ systemctl edit bitcoind.service # See "man systemd.service" for details. # Note that almost all daemon options could be specified in # /etc/bitcoin/bitcoin.conf, but keep in mind those explicitly # specified as arguments in ExecStart= will override those in the # config file. [Unit] Description=Bitcoin daemon Documentation=https://github.com/bitcoin/bitcoin/blob/master/doc/init.md # https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/ After=network-online.target Wants=network-online.target [Service] ExecStart=/usr/bin/bitcoind -pid=/run/bitcoind/bitcoind.pid \ -conf=/etc/bitcoin/bitcoin.conf \ -datadir=/var/lib/bitcoind \ -startupnotify='systemd-notify --ready' \ -shutdownnotify='systemd-notify --stopping' # Make sure the config directory is readable by the service user PermissionsStartOnly=true ExecStartPre=/bin/chgrp bitcoin /etc/bitcoin # Process management #################### Type=notify NotifyAccess=all PIDFile=/run/bitcoind/bitcoind.pid Restart=on-failure TimeoutStartSec=infinity TimeoutStopSec=600 # Directory creation and permissions #################################### # Run as bitcoin:bitcoin User=bitcoin Group=bitcoin # /run/bitcoind RuntimeDirectory=bitcoind RuntimeDirectoryMode=0710 # /etc/bitcoin ConfigurationDirectory=bitcoin ConfigurationDirectoryMode=0710 # /var/lib/bitcoind StateDirectory=bitcoind StateDirectoryMode=0710 # Hardening measures #################### # Provide a private /tmp and /var/tmp. PrivateTmp=true # Mount /usr, /boot/ and /etc read-only for the process. ProtectSystem=full # Deny access to /home, /root and /run/user ProtectHome=true # Disallow the process and all of its children to gain # new privileges through execve(). NoNewPrivileges=true # Use a new /dev namespace only populated with API pseudo devices # such as /dev/null, /dev/zero and /dev/random. PrivateDevices=true # Deny the creation of writable and executable memory mappings. MemoryDenyWriteExecute=true [Install] WantedBy=multi-user.target
0
bitcoin/contrib
bitcoin/contrib/init/bitcoind.openrc
#!/sbin/openrc-run # backward compatibility for existing gentoo layout # if [ -d "/var/lib/bitcoin/.bitcoin" ]; then BITCOIND_DEFAULT_DATADIR="/var/lib/bitcoin/.bitcoin" else BITCOIND_DEFAULT_DATADIR="/var/lib/bitcoind" fi BITCOIND_CONFIGFILE=${BITCOIND_CONFIGFILE:-/etc/bitcoin/bitcoin.conf} BITCOIND_PIDDIR=${BITCOIND_PIDDIR:-/var/run/bitcoind} BITCOIND_PIDFILE=${BITCOIND_PIDFILE:-${BITCOIND_PIDDIR}/bitcoind.pid} BITCOIND_DATADIR=${BITCOIND_DATADIR:-${BITCOIND_DEFAULT_DATADIR}} BITCOIND_USER=${BITCOIND_USER:-${BITCOIN_USER:-bitcoin}} BITCOIND_GROUP=${BITCOIND_GROUP:-bitcoin} BITCOIND_BIN=${BITCOIND_BIN:-/usr/bin/bitcoind} BITCOIND_NICE=${BITCOIND_NICE:-${NICELEVEL:-0}} BITCOIND_OPTS="${BITCOIND_OPTS:-${BITCOIN_OPTS}}" name="Bitcoin Core Daemon" description="Bitcoin cryptocurrency P2P network daemon" command="/usr/bin/bitcoind" command_args="-pid=\"${BITCOIND_PIDFILE}\" \ -conf=\"${BITCOIND_CONFIGFILE}\" \ -datadir=\"${BITCOIND_DATADIR}\" \ -daemon \ ${BITCOIND_OPTS}" required_files="${BITCOIND_CONFIGFILE}" start_stop_daemon_args="-u ${BITCOIND_USER} \ -N ${BITCOIND_NICE} -w 2000" pidfile="${BITCOIND_PIDFILE}" # The retry schedule to use when stopping the daemon. Could be either # a timeout in seconds or multiple signal/timeout pairs (like # "SIGKILL/180 SIGTERM/300") retry="${BITCOIND_SIGTERM_TIMEOUT}" depend() { need localmount net } # verify # 1) that the datadir exists and is writable (or create it) # 2) that a directory for the pid exists and is writable # 3) ownership and permissions on the config file start_pre() { checkpath \ -d \ --mode 0750 \ --owner "${BITCOIND_USER}:${BITCOIND_GROUP}" \ "${BITCOIND_DATADIR}" checkpath \ -d \ --mode 0755 \ --owner "${BITCOIND_USER}:${BITCOIND_GROUP}" \ "${BITCOIND_PIDDIR}" checkpath -f \ -o "${BITCOIND_USER}:${BITCOIND_GROUP}" \ -m 0660 \ "${BITCOIND_CONFIGFILE}" checkconfig || return 1 } checkconfig() { if grep -qs '^rpcuser=' "${BITCOIND_CONFIGFILE}" && \ ! grep -qs '^rpcpassword=' "${BITCOIND_CONFIGFILE}" ; then eerror "" eerror "ERROR: You must set a secure rpcpassword to run bitcoind." eerror "The setting must appear in ${BITCOIND_CONFIGFILE}" eerror "" eerror "This password is security critical to securing wallets " eerror "and must not be the same as the rpcuser setting." eerror "You can generate a suitable random password using the following " eerror "command from the shell:" eerror "" eerror "bash -c 'tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo'" eerror "" eerror "It is recommended that you also set alertnotify so you are " eerror "notified of problems:" eerror "" eerror "ie: alertnotify=echo %%s | mail -s \"Bitcoin Alert\"" \ "admin@foo.com" eerror "" return 1 fi }
0
bitcoin/contrib
bitcoin/contrib/tracing/mempool_monitor.py
#!/usr/bin/env python3 # Copyright (c) 2022 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """ Example logging Bitcoin Core mempool events using the mempool:added, mempool:removed, mempool:replaced, and mempool:rejected tracepoints. """ import curses import sys from datetime import datetime, timezone from bcc import BPF, USDT # BCC: The C program to be compiled to an eBPF program (by BCC) and loaded into # a sandboxed Linux kernel VM. PROGRAM = """ # include <uapi/linux/ptrace.h> // The longest rejection reason is 118 chars and is generated in case of SCRIPT_ERR_EVAL_FALSE by // strprintf("mandatory-script-verify-flag-failed (%s)", ScriptErrorString(check.GetScriptError())) #define MAX_REJECT_REASON_LENGTH 118 // The longest string returned by RemovalReasonToString() is 'sizelimit' #define MAX_REMOVAL_REASON_LENGTH 9 #define HASH_LENGTH 32 struct added_event { u8 hash[HASH_LENGTH]; s32 vsize; s64 fee; }; struct removed_event { u8 hash[HASH_LENGTH]; char reason[MAX_REMOVAL_REASON_LENGTH]; s32 vsize; s64 fee; u64 entry_time; }; struct rejected_event { u8 hash[HASH_LENGTH]; char reason[MAX_REJECT_REASON_LENGTH]; }; struct replaced_event { u8 replaced_hash[HASH_LENGTH]; s32 replaced_vsize; s64 replaced_fee; u64 replaced_entry_time; u8 replacement_hash[HASH_LENGTH]; s32 replacement_vsize; s64 replacement_fee; }; // BPF perf buffer to push the data to user space. BPF_PERF_OUTPUT(added_events); BPF_PERF_OUTPUT(removed_events); BPF_PERF_OUTPUT(rejected_events); BPF_PERF_OUTPUT(replaced_events); int trace_added(struct pt_regs *ctx) { struct added_event added = {}; bpf_usdt_readarg_p(1, ctx, &added.hash, HASH_LENGTH); bpf_usdt_readarg(2, ctx, &added.vsize); bpf_usdt_readarg(3, ctx, &added.fee); added_events.perf_submit(ctx, &added, sizeof(added)); return 0; } int trace_removed(struct pt_regs *ctx) { struct removed_event removed = {}; bpf_usdt_readarg_p(1, ctx, &removed.hash, HASH_LENGTH); bpf_usdt_readarg_p(2, ctx, &removed.reason, MAX_REMOVAL_REASON_LENGTH); bpf_usdt_readarg(3, ctx, &removed.vsize); bpf_usdt_readarg(4, ctx, &removed.fee); bpf_usdt_readarg(5, ctx, &removed.entry_time); removed_events.perf_submit(ctx, &removed, sizeof(removed)); return 0; } int trace_rejected(struct pt_regs *ctx) { struct rejected_event rejected = {}; bpf_usdt_readarg_p(1, ctx, &rejected.hash, HASH_LENGTH); bpf_usdt_readarg_p(2, ctx, &rejected.reason, MAX_REJECT_REASON_LENGTH); rejected_events.perf_submit(ctx, &rejected, sizeof(rejected)); return 0; } int trace_replaced(struct pt_regs *ctx) { struct replaced_event replaced = {}; bpf_usdt_readarg_p(1, ctx, &replaced.replaced_hash, HASH_LENGTH); bpf_usdt_readarg(2, ctx, &replaced.replaced_vsize); bpf_usdt_readarg(3, ctx, &replaced.replaced_fee); bpf_usdt_readarg(4, ctx, &replaced.replaced_entry_time); bpf_usdt_readarg_p(5, ctx, &replaced.replacement_hash, HASH_LENGTH); bpf_usdt_readarg(6, ctx, &replaced.replacement_vsize); bpf_usdt_readarg(7, ctx, &replaced.replacement_fee); replaced_events.perf_submit(ctx, &replaced, sizeof(replaced)); return 0; } """ def main(bitcoind_path): bitcoind_with_usdts = USDT(path=str(bitcoind_path)) # attaching the trace functions defined in the BPF program # to the tracepoints bitcoind_with_usdts.enable_probe(probe="mempool:added", fn_name="trace_added") bitcoind_with_usdts.enable_probe(probe="mempool:removed", fn_name="trace_removed") bitcoind_with_usdts.enable_probe(probe="mempool:replaced", fn_name="trace_replaced") bitcoind_with_usdts.enable_probe(probe="mempool:rejected", fn_name="trace_rejected") bpf = BPF(text=PROGRAM, usdt_contexts=[bitcoind_with_usdts]) events = [] def get_timestamp(): return datetime.now(timezone.utc) def handle_added(_, data, size): event = bpf["added_events"].event(data) events.append((get_timestamp(), "added", event)) def handle_removed(_, data, size): event = bpf["removed_events"].event(data) events.append((get_timestamp(), "removed", event)) def handle_rejected(_, data, size): event = bpf["rejected_events"].event(data) events.append((get_timestamp(), "rejected", event)) def handle_replaced(_, data, size): event = bpf["replaced_events"].event(data) events.append((get_timestamp(), "replaced", event)) bpf["added_events"].open_perf_buffer(handle_added) # By default, open_perf_buffer uses eight pages for a buffer, making for a total # buffer size of 32k on most machines. In practice, this size is insufficient: # Each `mempool:removed` event takes up 57 bytes in the buffer (32 bytes for txid, # 9 bytes for removal reason, and 8 bytes each for vsize and fee). Full blocks # contain around 2k transactions, requiring a buffer size of around 114kB. To cover # this amount, 32 4k pages are required. bpf["removed_events"].open_perf_buffer(handle_removed, page_cnt=32) bpf["rejected_events"].open_perf_buffer(handle_rejected) bpf["replaced_events"].open_perf_buffer(handle_replaced) curses.wrapper(loop, bpf, events) def loop(screen, bpf, events): dashboard = Dashboard(screen) while True: try: bpf.perf_buffer_poll(timeout=50) dashboard.render(events) except KeyboardInterrupt: exit() class Dashboard: """Visualization of mempool state using ncurses.""" INFO_WIN_HEIGHT = 2 EVENT_WIN_HEIGHT = 7 def __init__(self, screen): screen.nodelay(True) curses.curs_set(False) self._screen = screen self._time_started = datetime.now(timezone.utc) self._timestamps = {"added": [], "removed": [], "rejected": [], "replaced": []} self._event_history = {"added": 0, "removed": 0, "rejected": 0, "replaced": 0} self._init_windows() def _init_windows(self): """Initialize all windows.""" self._init_info_win() self._init_event_count_win() self._init_event_rate_win() self._init_event_log_win() @staticmethod def create_win(x, y, height, width, title=None): """Helper function to create generic windows and decorate them with box and title if requested.""" win = curses.newwin(height, width, x, y) if title: win.box() win.addstr(0, 2, title, curses.A_BOLD) return win def _init_info_win(self): """Create and populate the info window.""" self._info_win = Dashboard.create_win( x=0, y=1, height=Dashboard.INFO_WIN_HEIGHT, width=22 ) self._info_win.addstr(0, 0, "Mempool Monitor", curses.A_REVERSE) self._info_win.addstr(1, 0, "Press CTRL-C to stop.", curses.A_NORMAL) self._info_win.refresh() def _init_event_count_win(self): """Create and populate the event count window.""" self._event_count_win = Dashboard.create_win( x=3, y=1, height=Dashboard.EVENT_WIN_HEIGHT, width=37, title="Event count" ) header = " {:<8} {:>8} {:>7} {:>7} " self._event_count_win.addstr( 1, 1, header.format("Event", "total", "1 min", "10 min"), curses.A_UNDERLINE ) self._event_count_win.refresh() def _init_event_rate_win(self): """Create and populate the event rate window.""" self._event_rate_win = Dashboard.create_win( x=3, y=40, height=Dashboard.EVENT_WIN_HEIGHT, width=42, title="Event rate" ) header = " {:<8} {:>9} {:>9} {:>9} " self._event_rate_win.addstr( 1, 1, header.format("Event", "total", "1 min", "10 min"), curses.A_UNDERLINE ) self._event_rate_win.refresh() def _init_event_log_win(self): """Create windows showing event log. This comprises a dummy boxed window and an inset window so line breaks don't overwrite box.""" # dummy boxed window num_rows, num_cols = self._screen.getmaxyx() space_above = Dashboard.INFO_WIN_HEIGHT + 1 + Dashboard.EVENT_WIN_HEIGHT + 1 box_win_height = num_rows - space_above box_win_width = num_cols - 2 win_box = Dashboard.create_win( x=space_above, y=1, height=box_win_height, width=box_win_width, title="Event log", ) # actual logging window log_lines = box_win_height - 2 # top and bottom box lines log_line_len = box_win_width - 2 - 1 # box lines and left padding win = win_box.derwin(log_lines, log_line_len, 1, 2) win.idlok(True) win.scrollok(True) win_box.refresh() win.refresh() self._event_log_win_box = win_box self._event_log_win = win def calculate_metrics(self, events): """Calculate count and rate metrics.""" count, rate = {}, {} for event_ts, event_type, event_data in events: self._timestamps[event_type].append(event_ts) for event_type, ts in self._timestamps.items(): # remove timestamps older than ten minutes but keep track of their # count for the 'total' metric # self._event_history[event_type] += len( [t for t in ts if Dashboard.timestamp_age(t) >= 600] ) ts = [t for t in ts if Dashboard.timestamp_age(t) < 600] self._timestamps[event_type] = ts # count metric count_1m = len([t for t in ts if Dashboard.timestamp_age(t) < 60]) count_10m = len(ts) count_total = self._event_history[event_type] + len(ts) count[event_type] = (count_total, count_1m, count_10m) # rate metric runtime = Dashboard.timestamp_age(self._time_started) rate_1m = count_1m / min(60, runtime) rate_10m = count_10m / min(600, runtime) rate_total = count_total / runtime rate[event_type] = (rate_total, rate_1m, rate_10m) return count, rate def _update_event_count(self, count): """Update the event count window.""" w = self._event_count_win row_format = " {:<8} {:>6}tx {:>5}tx {:>5}tx " for line, metric in enumerate(["added", "removed", "replaced", "rejected"]): w.addstr(2 + line, 1, row_format.format(metric, *count[metric])) w.refresh() def _update_event_rate(self, rate): """Update the event rate window.""" w = self._event_rate_win row_format = " {:<8} {:>5.1f}tx/s {:>5.1f}tx/s {:>5.1f}tx/s " for line, metric in enumerate(["added", "removed", "replaced", "rejected"]): w.addstr(2 + line, 1, row_format.format(metric, *rate[metric])) w.refresh() def _update_event_log(self, events): """Update the event log window.""" w = self._event_log_win for event in events: w.addstr(Dashboard.parse_event(event) + "\n") w.refresh() def render(self, events): """Render the dashboard.""" count, rate = self.calculate_metrics(events) self._update_event_count(count) self._update_event_rate(rate) self._update_event_log(events) events.clear() @staticmethod def parse_event(event): """Converts events into human-readable messages""" ts_dt, type_, data = event ts = ts_dt.strftime("%H:%M:%SZ") if type_ == "added": return ( f"{ts} added {bytes(data.hash)[::-1].hex()}" f" with feerate {data.fee/data.vsize:.2f} sat/vB" f" ({data.fee} sat, {data.vsize} vbytes)" ) if type_ == "removed": return ( f"{ts} removed {bytes(data.hash)[::-1].hex()}" f" with feerate {data.fee/data.vsize:.2f} sat/vB" f" ({data.fee} sat, {data.vsize} vbytes)" f" received {ts_dt.timestamp()-data.entry_time:.1f} seconds ago" f": {data.reason.decode('UTF-8')}" ) if type_ == "rejected": return ( f"{ts} rejected {bytes(data.hash)[::-1].hex()}" f": {data.reason.decode('UTF-8')}" ) if type_ == "replaced": return ( f"{ts} replaced {bytes(data.replaced_hash)[::-1].hex()}" f" with feerate {data.replaced_fee/data.replaced_vsize:.2f} sat/vB" f" received {ts_dt.timestamp()-data.replaced_entry_time:.1f} seconds ago" f" ({data.replaced_fee} sat, {data.replaced_vsize} vbytes)" f" with {bytes(data.replacement_hash)[::-1].hex()}" f" with feerate {data.replacement_fee/data.replacement_vsize:.2f} sat/vB" f" ({data.replacement_fee} sat, {data.replacement_vsize} vbytes)" ) raise NotImplementedError("Unsupported event type: {type_}") @staticmethod def timestamp_age(timestamp): """Return age of timestamp in seconds.""" return (datetime.now(timezone.utc) - timestamp).total_seconds() if __name__ == "__main__": if len(sys.argv) < 2: print("USAGE: ", sys.argv[0], "path/to/bitcoind") exit(1) path = sys.argv[1] main(path)
0
bitcoin/contrib
bitcoin/contrib/tracing/log_raw_p2p_msgs.py
#!/usr/bin/env python3 # Copyright (c) 2021 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """ Demonstration of eBPF limitations and the effect on USDT with the net:inbound_message and net:outbound_message tracepoints. """ # This script shows a limitation of eBPF when data larger than 32kb is passed to # user-space. It uses BCC (https://github.com/iovisor/bcc) to load a sandboxed # eBPF program into the Linux kernel (root privileges are required). The eBPF # program attaches to two statically defined tracepoints. The tracepoint # 'net:inbound_message' is called when a new P2P message is received, and # 'net:outbound_message' is called on outbound P2P messages. The eBPF program # submits the P2P messages to this script via a BPF ring buffer. The submitted # messages are printed. # eBPF Limitations: # # Bitcoin P2P messages can be larger than 32kb (e.g. tx, block, ...). The eBPF # VM's stack is limited to 512 bytes, and we can't allocate more than about 32kb # for a P2P message in the eBPF VM. The message data is cut off when the message # is larger than MAX_MSG_DATA_LENGTH (see definition below). This can be detected # in user-space by comparing the data length to the message length variable. The # message is cut off when the data length is smaller than the message length. # A warning is included with the printed message data. # # Data is submitted to user-space (i.e. to this script) via a ring buffer. The # throughput of the ring buffer is limited. Each p2p_message is about 32kb in # size. In- or outbound messages submitted to the ring buffer in rapid # succession fill the ring buffer faster than it can be read. Some messages are # lost. # # BCC prints: "Possibly lost 2 samples" on lost messages. import sys from bcc import BPF, USDT # BCC: The C program to be compiled to an eBPF program (by BCC) and loaded into # a sandboxed Linux kernel VM. program = """ #include <uapi/linux/ptrace.h> #define MIN(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; }) // Maximum possible allocation size // from include/linux/percpu.h in the Linux kernel #define PCPU_MIN_UNIT_SIZE (32 << 10) // Tor v3 addresses are 62 chars + 6 chars for the port (':12345'). #define MAX_PEER_ADDR_LENGTH 62 + 6 #define MAX_PEER_CONN_TYPE_LENGTH 20 #define MAX_MSG_TYPE_LENGTH 20 #define MAX_MSG_DATA_LENGTH PCPU_MIN_UNIT_SIZE - 200 struct p2p_message { u64 peer_id; char peer_addr[MAX_PEER_ADDR_LENGTH]; char peer_conn_type[MAX_PEER_CONN_TYPE_LENGTH]; char msg_type[MAX_MSG_TYPE_LENGTH]; u64 msg_size; u8 msg[MAX_MSG_DATA_LENGTH]; }; // We can't store the p2p_message struct on the eBPF stack as it is limited to // 512 bytes and P2P message can be bigger than 512 bytes. However, we can use // an BPF-array with a length of 1 to allocate up to 32768 bytes (this is // defined by PCPU_MIN_UNIT_SIZE in include/linux/percpu.h in the Linux kernel). // Also see https://github.com/iovisor/bcc/issues/2306 BPF_ARRAY(msg_arr, struct p2p_message, 1); // Two BPF perf buffers for pushing data (here P2P messages) to user-space. BPF_PERF_OUTPUT(inbound_messages); BPF_PERF_OUTPUT(outbound_messages); int trace_inbound_message(struct pt_regs *ctx) { int idx = 0; struct p2p_message *msg = msg_arr.lookup(&idx); // lookup() does not return a NULL pointer. However, the BPF verifier // requires an explicit check that that the `msg` pointer isn't a NULL // pointer. See https://github.com/iovisor/bcc/issues/2595 if (msg == NULL) return 1; bpf_usdt_readarg(1, ctx, &msg->peer_id); bpf_usdt_readarg_p(2, ctx, &msg->peer_addr, MAX_PEER_ADDR_LENGTH); bpf_usdt_readarg_p(3, ctx, &msg->peer_conn_type, MAX_PEER_CONN_TYPE_LENGTH); bpf_usdt_readarg_p(4, ctx, &msg->msg_type, MAX_MSG_TYPE_LENGTH); bpf_usdt_readarg(5, ctx, &msg->msg_size); bpf_usdt_readarg_p(6, ctx, &msg->msg, MIN(msg->msg_size, MAX_MSG_DATA_LENGTH)); inbound_messages.perf_submit(ctx, msg, sizeof(*msg)); return 0; }; int trace_outbound_message(struct pt_regs *ctx) { int idx = 0; struct p2p_message *msg = msg_arr.lookup(&idx); // lookup() does not return a NULL pointer. However, the BPF verifier // requires an explicit check that that the `msg` pointer isn't a NULL // pointer. See https://github.com/iovisor/bcc/issues/2595 if (msg == NULL) return 1; bpf_usdt_readarg(1, ctx, &msg->peer_id); bpf_usdt_readarg_p(2, ctx, &msg->peer_addr, MAX_PEER_ADDR_LENGTH); bpf_usdt_readarg_p(3, ctx, &msg->peer_conn_type, MAX_PEER_CONN_TYPE_LENGTH); bpf_usdt_readarg_p(4, ctx, &msg->msg_type, MAX_MSG_TYPE_LENGTH); bpf_usdt_readarg(5, ctx, &msg->msg_size); bpf_usdt_readarg_p(6, ctx, &msg->msg, MIN(msg->msg_size, MAX_MSG_DATA_LENGTH)); outbound_messages.perf_submit(ctx, msg, sizeof(*msg)); return 0; }; """ def print_message(event, inbound): print(f"%s %s msg '%s' from peer %d (%s, %s) with %d bytes: %s" % ( f"Warning: incomplete message (only %d out of %d bytes)!" % ( len(event.msg), event.msg_size) if len(event.msg) < event.msg_size else "", "inbound" if inbound else "outbound", event.msg_type.decode("utf-8"), event.peer_id, event.peer_conn_type.decode("utf-8"), event.peer_addr.decode("utf-8"), event.msg_size, bytes(event.msg[:event.msg_size]).hex(), ) ) def main(bitcoind_path): bitcoind_with_usdts = USDT(path=str(bitcoind_path)) # attaching the trace functions defined in the BPF program to the tracepoints bitcoind_with_usdts.enable_probe( probe="inbound_message", fn_name="trace_inbound_message") bitcoind_with_usdts.enable_probe( probe="outbound_message", fn_name="trace_outbound_message") bpf = BPF(text=program, usdt_contexts=[bitcoind_with_usdts]) # BCC: perf buffer handle function for inbound_messages def handle_inbound(_, data, size): """ Inbound message handler. Called each time a message is submitted to the inbound_messages BPF table.""" event = bpf["inbound_messages"].event(data) print_message(event, True) # BCC: perf buffer handle function for outbound_messages def handle_outbound(_, data, size): """ Outbound message handler. Called each time a message is submitted to the outbound_messages BPF table.""" event = bpf["outbound_messages"].event(data) print_message(event, False) # BCC: add handlers to the inbound and outbound perf buffers bpf["inbound_messages"].open_perf_buffer(handle_inbound) bpf["outbound_messages"].open_perf_buffer(handle_outbound) print("Logging raw P2P messages.") print("Messages larger that about 32kb will be cut off!") print("Some messages might be lost!") while True: try: bpf.perf_buffer_poll() except KeyboardInterrupt: exit() if __name__ == "__main__": if len(sys.argv) < 2: print("USAGE:", sys.argv[0], "path/to/bitcoind") exit() path = sys.argv[1] main(path)
0
bitcoin/contrib
bitcoin/contrib/tracing/connectblock_benchmark.bt
#!/usr/bin/env bpftrace /* USAGE: bpftrace contrib/tracing/connectblock_benchmark.bt <start height> <end height> <logging threshold in ms> - <start height> sets the height at which the benchmark should start. Setting the start height to 0 starts the benchmark immediately, even before the first block is connected. - <end height> sets the height after which the benchmark should end. Setting the end height to 0 disables the benchmark. The script only logs blocks over <logging threshold in ms>. - Threshold <logging threshold in ms> This script requires a 'bitcoind' binary compiled with eBPF support and the 'validation:block_connected' USDT. By default, it's assumed that 'bitcoind' is located in './src/bitcoind'. This can be modified in the script below. EXAMPLES: bpftrace contrib/tracing/connectblock_benchmark.bt 300000 680000 1000 When run together 'bitcoind -reindex', this benchmarks the time it takes to connect the blocks between height 300.000 and 680.000 (inclusive) and prints details about all blocks that take longer than 1000ms to connect. Prints a histogram with block connection times when the benchmark is finished. bpftrace contrib/tracing/connectblock_benchmark.bt 0 0 500 When running together 'bitcoind', all newly connected blocks that take longer than 500ms to connect are logged. A histogram with block connection times is shown when the script is terminated. */ BEGIN { $start_height = $1; $end_height = $2; $logging_threshold_ms = $3; if ($end_height < $start_height) { printf("Error: start height (%d) larger than end height (%d)!\n", $start_height, $end_height); exit(); } if ($end_height > 0) { printf("ConnectBlock benchmark between height %d and %d inclusive\n", $start_height, $end_height); } else { printf("ConnectBlock logging starting at height %d\n", $start_height); } if ($logging_threshold_ms > 0) { printf("Logging blocks taking longer than %d ms to connect.\n", $3); } if ($start_height == 0) { @start = nsecs; } } /* Attaches to the 'validation:block_connected' USDT and collects stats when the connected block is between the start and end height (or the end height is unset). */ usdt:./src/bitcoind:validation:block_connected /arg1 >= $1 && (arg1 <= $2 || $2 == 0 )/ { $height = arg1; $transactions = arg2; $inputs = arg3; $sigops = arg4; $duration = (uint64) arg5; @height = $height; @blocks = @blocks + 1; @transactions = @transactions + $transactions; @inputs = @inputs + $inputs; @sigops = @sigops + $sigops; @durations = hist($duration / 1000); if ($height == $1 && $height != 0) { @start = nsecs; printf("Starting Connect Block Benchmark between height %d and %d.\n", $1, $2); } if ($2 > 0 && $height >= $2) { @end = nsecs; $duration = @end - @start; printf("\nTook %d ms to connect the blocks between height %d and %d.\n", $duration / 1000000, $1, $2); exit(); } } /* Attaches to the 'validation:block_connected' USDT and logs information about blocks where the time it took to connect the block is above the <logging threshold in ms>. */ usdt:./src/bitcoind:validation:block_connected / (uint64) arg5 / 1000> $3 / { $hash = arg0; $height = (int32) arg1; $transactions = (uint64) arg2; $inputs = (int32) arg3; $sigops = (int64) arg4; $duration = (int64) arg5; printf("Block %d (", $height); /* Prints each byte of the block hash as hex in big-endian (the block-explorer format) */ $p = $hash + 31; unroll(32) { $b = *(uint8*)$p; printf("%02x", $b); $p -= 1; } printf(") %4d tx %5d ins %5d sigops took %4d ms\n", $transactions, $inputs, $sigops, (uint64) $duration / 1000); } /* Prints stats about the blocks, transactions, inputs, and sigops processed in the last second (if any). */ interval:s:1 { if (@blocks > 0) { printf("BENCH %4d blk/s %6d tx/s %7d inputs/s %8d sigops/s (height %d)\n", @blocks, @transactions, @inputs, @sigops, @height); zero(@blocks); zero(@transactions); zero(@inputs); zero(@sigops); } } END { printf("\nHistogram of block connection times in milliseconds (ms).\n"); print(@durations); clear(@durations); clear(@blocks); clear(@transactions); clear(@inputs); clear(@sigops); clear(@height); clear(@start); clear(@end); }
0
bitcoin/contrib
bitcoin/contrib/tracing/log_utxos.bt
#!/usr/bin/env bpftrace /* USAGE: bpftrace contrib/tracing/log_utxos.bt This script requires a 'bitcoind' binary compiled with eBPF support and the 'utxocache' tracepoints. By default, it's assumed that 'bitcoind' is located in './src/bitcoind'. This can be modified in the script below. NOTE: requires bpftrace v0.12.0 or above. */ BEGIN { printf("%-7s %-71s %16s %7s %8s\n", "OP", "Outpoint", "Value", "Height", "Coinbase"); } /* Attaches to the 'utxocache:add' tracepoint and prints additions to the UTXO set cache. */ usdt:./src/bitcoind:utxocache:add { $txid = arg0; $index = (uint32)arg1; $height = (uint32)arg2; $value = (int64)arg3; $isCoinbase = arg4; printf("Added "); $p = $txid + 31; unroll(32) { $b = *(uint8*)$p; printf("%02x", $b); $p-=1; } printf(":%-6d %16ld %7d %s\n", $index, $value, $height, ($isCoinbase ? "Yes" : "No" )); } /* Attaches to the 'utxocache:spent' tracepoint and prints spents from the UTXO set cache. */ usdt:./src/bitcoind:utxocache:spent { $txid = arg0; $index = (uint32)arg1; $height = (uint32)arg2; $value = (int64)arg3; $isCoinbase = arg4; printf("Spent "); $p = $txid + 31; unroll(32) { $b = *(uint8*)$p; printf("%02x", $b); $p-=1; } printf(":%-6d %16ld %7d %s\n", $index, $value, $height, ($isCoinbase ? "Yes" : "No" )); } /* Attaches to the 'utxocache:uncache' tracepoint and uncache UTXOs from the UTXO set cache. */ usdt:./src/bitcoind:utxocache:uncache { $txid = arg0; $index = (uint32)arg1; $height = (uint32)arg2; $value = (int64)arg3; $isCoinbase = arg4; printf("Uncache "); $p = $txid + 31; unroll(32) { $b = *(uint8*)$p; printf("%02x", $b); $p-=1; } printf(":%-6d %16ld %7d %s\n", $index, $value, $height, ($isCoinbase ? "Yes" : "No" )); }
0
bitcoin/contrib
bitcoin/contrib/tracing/README.md
Example scripts for User-space, Statically Defined Tracing (USDT) ================================================================= This directory contains scripts showcasing User-space, Statically Defined Tracing (USDT) support for Bitcoin Core on Linux using. For more information on USDT support in Bitcoin Core see the [USDT documentation]. [USDT documentation]: ../../doc/tracing.md Examples for the two main eBPF front-ends, [bpftrace] and [BPF Compiler Collection (BCC)], with support for USDT, are listed. BCC is used for complex tools and daemons and `bpftrace` is preferred for one-liners and shorter scripts. [bpftrace]: https://github.com/iovisor/bpftrace [BPF Compiler Collection (BCC)]: https://github.com/iovisor/bcc To develop and run bpftrace and BCC scripts you need to install the corresponding packages. See [installing bpftrace] and [installing BCC] for more information. For development there exist a [bpftrace Reference Guide], a [BCC Reference Guide], and a [bcc Python Developer Tutorial]. [installing bpftrace]: https://github.com/iovisor/bpftrace/blob/master/INSTALL.md [installing BCC]: https://github.com/iovisor/bcc/blob/master/INSTALL.md [bpftrace Reference Guide]: https://github.com/iovisor/bpftrace/blob/master/docs/reference_guide.md [BCC Reference Guide]: https://github.com/iovisor/bcc/blob/master/docs/reference_guide.md [bcc Python Developer Tutorial]: https://github.com/iovisor/bcc/blob/master/docs/tutorial_bcc_python_developer.md ## Examples The bpftrace examples contain a relative path to the `bitcoind` binary. By default, the scripts should be run from the repository-root and assume a self-compiled `bitcoind` binary. The paths in the examples can be changed, for example, to point to release builds if needed. See the [Bitcoin Core USDT documentation] on how to list available tracepoints in your `bitcoind` binary. [Bitcoin Core USDT documentation]: ../../doc/tracing.md#listing-available-tracepoints **WARNING: eBPF programs require root privileges to be loaded into a Linux kernel VM. This means the bpftrace and BCC examples must be executed with root privileges. Make sure to carefully review any scripts that you run with root privileges first!** ### log_p2p_traffic.bt A bpftrace script logging information about inbound and outbound P2P network messages. Based on the `net:inbound_message` and `net:outbound_message` tracepoints. By default, `bpftrace` limits strings to 64 bytes due to the limited stack size in the eBPF VM. For example, Tor v3 addresses exceed the string size limit which results in the port being cut off during logging. The string size limit can be increased with the `BPFTRACE_STRLEN` environment variable (`BPFTRACE_STRLEN=70` works fine). ``` $ bpftrace contrib/tracing/log_p2p_traffic.bt ``` Output ``` outbound 'ping' msg to peer 11 (outbound-full-relay, [2a02:b10c:f747:1:ef:fake:ipv6:addr]:8333) with 8 bytes inbound 'pong' msg from peer 11 (outbound-full-relay, [2a02:b10c:f747:1:ef:fake:ipv6:addr]:8333) with 8 bytes inbound 'inv' msg from peer 16 (outbound-full-relay, XX.XX.XXX.121:8333) with 37 bytes outbound 'getdata' msg to peer 16 (outbound-full-relay, XX.XX.XXX.121:8333) with 37 bytes inbound 'tx' msg from peer 16 (outbound-full-relay, XX.XX.XXX.121:8333) with 222 bytes outbound 'inv' msg to peer 9 (outbound-full-relay, faketorv3addressa2ufa6odvoi3s77j4uegey0xb10csyfyve2t33curbyd.onion:8333) with 37 bytes outbound 'inv' msg to peer 7 (outbound-full-relay, XX.XX.XXX.242:8333) with 37 bytes … ``` ### p2p_monitor.py A BCC Python script using curses for an interactive P2P message monitor. Based on the `net:inbound_message` and `net:outbound_message` tracepoints. Inbound and outbound traffic is listed for each peer together with information about the connection. Peers can be selected individually to view recent P2P messages. ``` $ python3 contrib/tracing/p2p_monitor.py ./src/bitcoind ``` Lists selectable peers and traffic and connection information. ``` P2P Message Monitor Navigate with UP/DOWN or J/K and select a peer with ENTER or SPACE to see individual P2P messages PEER OUTBOUND INBOUND TYPE ADDR 0 46 398 byte 61 1407590 byte block-relay-only XX.XX.XXX.196:8333 11 1156 253570 byte 3431 2394924 byte outbound-full-relay XXX.X.XX.179:8333 13 3425 1809620 byte 1236 305458 byte inbound XXX.X.X.X:60380 16 1046 241633 byte 1589 1199220 byte outbound-full-relay 4faketorv2pbfu7x.onion:8333 19 577 181679 byte 390 148951 byte outbound-full-relay kfake4vctorjv2o2.onion:8333 20 11 1248 byte 13 1283 byte block-relay-only [2600:fake:64d9:b10c:4436:aaaa:fe:bb]:8333 21 11 1248 byte 13 1299 byte block-relay-only XX.XXX.X.155:8333 22 5 103 byte 1 102 byte feeler XX.XX.XXX.173:8333 23 11 1248 byte 12 1255 byte block-relay-only XX.XXX.XXX.220:8333 24 3 103 byte 1 102 byte feeler XXX.XXX.XXX.64:8333 … ``` Showing recent P2P messages between our node and a selected peer. ``` ---------------------------------------------------------------------- | PEER 16 (4faketorv2pbfu7x.onion:8333) | | OUR NODE outbound-full-relay PEER | | <--- sendcmpct (9 bytes) | | inv (37 byte) ---> | | <--- ping (8 bytes) | | pong (8 byte) ---> | | inv (37 byte) ---> | | <--- addr (31 bytes) | | inv (37 byte) ---> | | <--- getheaders (1029 bytes) | | headers (1 byte) ---> | | <--- feefilter (8 bytes) | | <--- pong (8 bytes) | | <--- headers (82 bytes) | | <--- addr (30003 bytes) | | inv (1261 byte) ---> | | … | ``` ### log_raw_p2p_msgs.py A BCC Python script showcasing eBPF and USDT limitations when passing data larger than about 32kb. Based on the `net:inbound_message` and `net:outbound_message` tracepoints. Bitcoin P2P messages can be larger than 32kb (e.g. `tx`, `block`, ...). The eBPF VM's stack is limited to 512 bytes, and we can't allocate more than about 32kb for a P2P message in the eBPF VM. The **message data is cut off** when the message is larger than MAX_MSG_DATA_LENGTH (see script). This can be detected in user-space by comparing the data length to the message length variable. The message is cut off when the data length is smaller than the message length. A warning is included with the printed message data. Data is submitted to user-space (i.e. to this script) via a ring buffer. The throughput of the ring buffer is limited. Each p2p_message is about 32kb in size. In- or outbound messages submitted to the ring buffer in rapid succession fill the ring buffer faster than it can be read. Some messages are lost. BCC prints: `Possibly lost 2 samples` on lost messages. ``` $ python3 contrib/tracing/log_raw_p2p_msgs.py ./src/bitcoind ``` ``` Logging raw P2P messages. Messages larger that about 32kb will be cut off! Some messages might be lost! outbound msg 'inv' from peer 4 (outbound-full-relay, XX.XXX.XX.4:8333) with 253 bytes: 0705000000be2245c8f844c9f763748e1a7… … Warning: incomplete message (only 32568 out of 53552 bytes)! inbound msg 'tx' from peer 32 (outbound-full-relay, XX.XXX.XXX.43:8333) with 53552 bytes: 020000000001fd3c01939c85ad6756ed9fc… … Possibly lost 2 samples ``` ### connectblock_benchmark.bt A `bpftrace` script to benchmark the `ConnectBlock()` function during, for example, a blockchain re-index. Based on the `validation:block_connected` USDT tracepoint. The script takes three positional arguments. The first two arguments, the start, and end height indicate between which blocks the benchmark should be run. The third acts as a duration threshold in milliseconds. When the `ConnectBlock()` function takes longer than the threshold, information about the block, is printed. For more details, see the header comment in the script. The following command can be used to benchmark, for example, `ConnectBlock()` between height 20000 and 38000 on SigNet while logging all blocks that take longer than 25ms to connect. ``` $ bpftrace contrib/tracing/connectblock_benchmark.bt 20000 38000 25 ``` In a different terminal, starting Bitcoin Core in SigNet mode and with re-indexing enabled. ``` $ ./src/bitcoind -signet -reindex ``` This produces the following output. ``` Attaching 5 probes... ConnectBlock Benchmark between height 20000 and 38000 inclusive Logging blocks taking longer than 25 ms to connect. Starting Connect Block Benchmark between height 20000 and 38000. BENCH 39 blk/s 59 tx/s 59 inputs/s 20 sigops/s (height 20038) Block 20492 (000000f555653bb05e2f3c6e79925e01a20dd57033f4dc7c354b46e34735d32b) 20 tx 2319 ins 2318 sigops took 38 ms BENCH 1840 blk/s 2117 tx/s 4478 inputs/s 2471 sigops/s (height 21879) BENCH 1816 blk/s 4972 tx/s 4982 inputs/s 125 sigops/s (height 23695) BENCH 2095 blk/s 2890 tx/s 2910 inputs/s 152 sigops/s (height 25790) BENCH 1684 blk/s 3979 tx/s 4053 inputs/s 288 sigops/s (height 27474) BENCH 1155 blk/s 3216 tx/s 3252 inputs/s 115 sigops/s (height 28629) BENCH 1797 blk/s 2488 tx/s 2503 inputs/s 111 sigops/s (height 30426) BENCH 1849 blk/s 6318 tx/s 6569 inputs/s 12189 sigops/s (height 32275) BENCH 946 blk/s 20209 tx/s 20775 inputs/s 83809 sigops/s (height 33221) Block 33406 (0000002adfe4a15cfcd53bd890a89bbae836e5bb7f38bac566f61ad4548c87f6) 25 tx 2045 ins 2090 sigops took 29 ms Block 33687 (00000073231307a9828e5607ceb8156b402efe56747271a4442e75eb5b77cd36) 52 tx 1797 ins 1826 sigops took 26 ms BENCH 582 blk/s 21581 tx/s 27673 inputs/s 60345 sigops/s (height 33803) BENCH 1035 blk/s 19735 tx/s 19776 inputs/s 51355 sigops/s (height 34838) Block 35625 (0000006b00b347390c4768ea9df2655e9ff4b120f29d78594a2a702f8a02c997) 20 tx 3374 ins 3371 sigops took 49 ms BENCH 887 blk/s 17857 tx/s 22191 inputs/s 24404 sigops/s (height 35725) Block 35937 (000000d816d13d6e39b471cd4368db60463a764ba1f29168606b04a22b81ea57) 75 tx 3943 ins 3940 sigops took 61 ms BENCH 823 blk/s 16298 tx/s 21031 inputs/s 18440 sigops/s (height 36548) Block 36583 (000000c3e260556dbf42968aae3f904dba8b8c1ff96a6f6e3aa5365d2e3ad317) 24 tx 2198 ins 2194 sigops took 34 ms Block 36700 (000000b3b173de9e65a3cfa738d976af6347aaf83fa17ab3f2a4d2ede3ddfac4) 73 tx 1615 ins 1611 sigops took 31 ms Block 36832 (0000007859578c02c1ac37dabd1b9ec19b98f350b56935f5dd3a41e9f79f836e) 34 tx 1440 ins 1436 sigops took 26 ms BENCH 613 blk/s 16718 tx/s 25074 inputs/s 23022 sigops/s (height 37161) Block 37870 (000000f5c1086291ba2d943fb0c3bc82e71c5ee341ee117681d1456fbf6c6c38) 25 tx 1517 ins 1514 sigops took 29 ms BENCH 811 blk/s 16031 tx/s 20921 inputs/s 18696 sigops/s (height 37972) Took 14055 ms to connect the blocks between height 20000 and 38000. Histogram of block connection times in milliseconds (ms). @durations: [0] 16838 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| [1] 882 |@@ | [2, 4) 236 | | [4, 8) 23 | | [8, 16) 9 | | [16, 32) 9 | | [32, 64) 4 | | ``` ### log_utxocache_flush.py A BCC Python script to log the UTXO cache flushes. Based on the `utxocache:flush` tracepoint. ```bash $ python3 contrib/tracing/log_utxocache_flush.py ./src/bitcoind ``` ``` Logging utxocache flushes. Ctrl-C to end... Duration (µs) Mode Coins Count Memory Usage Prune 730451 IF_NEEDED 22990 3323.54 kB True 637657 ALWAYS 122320 17124.80 kB False 81349 ALWAYS 0 1383.49 kB False ``` ### log_utxos.bt A `bpftrace` script to log information about the coins that are added, spent, or uncached from the UTXO set. Based on the `utxocache:add`, `utxocache:spend` and `utxocache:uncache` tracepoints. ```bash $ bpftrace contrib/tracing/log_utxos.bt ``` This should produce an output similar to the following. If you see bpftrace warnings like `Lost 24 events`, the eBPF perf ring-buffer is filled faster than it is being read. You can increase the ring-buffer size by setting the ENV variable `BPFTRACE_PERF_RB_PAGES` (default 64) at a cost of higher memory usage. See the [bpftrace reference guide] for more information. [bpftrace reference guide]: https://github.com/iovisor/bpftrace/blob/master/docs/reference_guide.md#98-bpftrace_perf_rb_pages ```bash Attaching 4 probes... OP Outpoint Value Height Coinbase Added 6ba9ad857e1ef2eb2a2c94f06813c414c7ab273e3d6bd7ad64e000315a887e7c:1 10000 2094512 No Spent fa7dc4db56637a151f6649d8f26732956d1c5424c82aae400a83d02b2cc2c87b:0 182264897 2094512 No Added eeb2f099b1af6a2a12e6ddd2eeb16fc5968582241d7f08ba202d28b60ac264c7:0 10000 2094512 No Added eeb2f099b1af6a2a12e6ddd2eeb16fc5968582241d7f08ba202d28b60ac264c7:1 182254756 2094512 No Added a0c7f4ec9cccef2d89672a624a4e6c8237a17572efdd4679eea9e9ee70d2db04:0 10072679 2094513 Yes Spent 25e0df5cc1aeb1b78e6056bf403e5e8b7e41f138060ca0a50a50134df0549a5e:2 540 2094508 No Spent 42f383c04e09c26a2378272ec33aa0c1bf4883ca5ab739e8b7e06be5a5787d61:1 3848399 2007724 No Added f85e3b4b89270863a389395cc9a4123e417ab19384cef96533c6649abd6b0561:0 3788399 2094513 No Added f85e3b4b89270863a389395cc9a4123e417ab19384cef96533c6649abd6b0561:2 540 2094513 No Spent a05880b8c77971ed0b9f73062c7c4cdb0ff3856ab14cbf8bc481ed571cd34b83:1 5591281046 2094511 No Added eb689865f7d957938978d6207918748f74e6aa074f47874724327089445b0960:0 5589696005 2094513 No Added eb689865f7d957938978d6207918748f74e6aa074f47874724327089445b0960:1 1565556 2094513 No ``` ### mempool_monitor.py A BCC Python script producing mempool statistics and an event log. Based on the `mempool:added`, `mempool:removed`, `mempool:replaced`, and `mempool:rejected` tracepoints. Statistics include incidence and rate for each event type since the script was started (`total`) as well as during the last minute (`1 min`) and ten minutes (`10 min`). The event log shows mempool events in real time, each entry comprising a timestamp along with all event data available via the event's tracepoint. ```console $ python3 contrib/tracing/mempool_monitor.py ./src/bitcoind ``` ``` Mempool Monitor Press CTRL-C to stop. ┌─Event count───────────────────────┐ ┌─Event rate──────────────────────────┐ │ Event total 1 min 10 min │ │ Event total 1 min 10 min │ │ added 1425tx 201tx 1425tx │ │ added 4.7tx/s 3.4tx/s 4.7tx/s │ │ removed 35tx 4tx 35tx │ │ removed 0.1tx/s 0.1tx/s 0.1tx/s │ │ replaced 35tx 4tx 35tx │ │ replaced 0.1tx/s 0.1tx/s 0.1tx/s │ │ rejected 0tx 0tx 0tx │ │ rejected 0.0tx/s 0.0tx/s 0.0tx/s │ └───────────────────────────────────┘ └─────────────────────────────────────┘ ┌─Event log────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ 13:10:30Z added f9064ca5bfc87cdd191faa42bf697217cd920b2b94838c1f1192e4f06c4fd217 with feerate 8.92 sat/vB (981 sat, 110 vbytes) │ │ 13:10:30Z added 53ffa3afbe57b1bfe423e1755ca2b52c5b6cb4aa91b8b7ee9cb694953f47f234 with feerate 5.00 sat/vB (550 sat, 110 vbytes) │ │ 13:10:30Z added 4177df5e19465eb5e53c3f8b6830a293f57474921bc6c2ae89375e0986e1f0f9 with feerate 2.98 sat/vB (429 sat, 144 vbytes) │ │ 13:10:30Z added 931a10d83f0a268768da75dc4b9e199f2f055f12979ae5491cc304ee10f890ea with feerate 3.55 sat/vB (500 sat, 141 vbytes) │ │ 13:10:30Z added 4cf32b295723cc4ab73f2a2e51d4bb276c0042760a4c00a3eb9595b8ebb24721 with feerate 89.21 sat/vB (12668 sat, 142 vbytes) │ │ 13:10:31Z replaced d1eecf9d662121322f4f31f0c2267a752d14bb3956e6016ba96e87f47890e1db with feerate 27.12 sat/vB received 23.3 seconds ago (7213 sat, 266 vbytes) with c412db908│ │ 9b7ed53f3e5e36d2819dd291278b59ccaabaeb17fd37c3d87fdcd57 with feerate 28.12 sat/vB (8351 sat, 297 vbytes) │ │ 13:10:31Z added c412db9089b7ed53f3e5e36d2819dd291278b59ccaabaeb17fd37c3d87fdcd57 with feerate 28.12 sat/vB (8351 sat, 297 vbytes) │ │ 13:10:31Z added b8388a5bdc421b11460bdf477d5a85a1a39c2784e7dd7bffabe688740424ea57 with feerate 25.21 sat/vB (3554 sat, 141 vbytes) │ │ 13:10:31Z added 4ddb88bc90a122cd9eae8a664e73bdf5bebe75f3ef901241b4a251245854a98e with feerate 24.15 sat/vB (5072 sat, 210 vbytes) │ │ 13:10:31Z added 19101e4161bca5271ad5d03e7747f2faec7793b274dc2f3c4cf516b7cef1aac3 with feerate 7.06 sat/vB (1080 sat, 153 vbytes) │ │ 13:10:31Z removed d1eecf9d662121322f4f31f0c2267a752d14bb3956e6016ba96e87f47890e1db with feerate 27.12 sat/vB (7213 sat, 266 vbytes): replaced │ │ 13:10:31Z added 6c511c60d9b95b9eff81df6ecba5c86780f513fe62ce3ad6be2c5340d957025a with feerate 4.00 sat/vB (440 sat, 110 vbytes) │ │ 13:10:31Z added 44d66f7f004bd52c46be4dff3067cab700e51c7866a84282bd8aab560a5bfb79 with feerate 3.15 sat/vB (448 sat, 142 vbytes) │ │ 13:10:31Z added b17b7c9ec5acfbbf12f0eeef8e29826fad3105bb95eef7a47d2f1f22b4784643 with feerate 4.10 sat/vB (1348 sat, 329 vbytes) │ │ 13:10:31Z added b7a4ad93554e57454e8a8049bfc0bd803fa962bd3f0a08926aa72e7cb23e2276 with feerate 1.01 sat/vB (205 sat, 202 vbytes) │ │ 13:10:32Z added c78e87be86c828137a6e7e00a177c03b52202ce4c39029b99904c2a094b9da87 with feerate 11.00 sat/vB (1562 sat, 142 vbytes) │ │ │ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ ```
0
bitcoin/contrib
bitcoin/contrib/tracing/p2p_monitor.py
#!/usr/bin/env python3 # Copyright (c) 2021 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """ Interactive bitcoind P2P network traffic monitor utilizing USDT and the net:inbound_message and net:outbound_message tracepoints. """ # This script demonstrates what USDT for Bitcoin Core can enable. It uses BCC # (https://github.com/iovisor/bcc) to load a sandboxed eBPF program into the # Linux kernel (root privileges are required). The eBPF program attaches to two # statically defined tracepoints. The tracepoint 'net:inbound_message' is called # when a new P2P message is received, and 'net:outbound_message' is called on # outbound P2P messages. The eBPF program submits the P2P messages to # this script via a BPF ring buffer. import sys import curses from curses import wrapper, panel from bcc import BPF, USDT # BCC: The C program to be compiled to an eBPF program (by BCC) and loaded into # a sandboxed Linux kernel VM. program = """ #include <uapi/linux/ptrace.h> // Tor v3 addresses are 62 chars + 6 chars for the port (':12345'). // I2P addresses are 60 chars + 6 chars for the port (':12345'). #define MAX_PEER_ADDR_LENGTH 62 + 6 #define MAX_PEER_CONN_TYPE_LENGTH 20 #define MAX_MSG_TYPE_LENGTH 20 struct p2p_message { u64 peer_id; char peer_addr[MAX_PEER_ADDR_LENGTH]; char peer_conn_type[MAX_PEER_CONN_TYPE_LENGTH]; char msg_type[MAX_MSG_TYPE_LENGTH]; u64 msg_size; }; // Two BPF perf buffers for pushing data (here P2P messages) to user space. BPF_PERF_OUTPUT(inbound_messages); BPF_PERF_OUTPUT(outbound_messages); int trace_inbound_message(struct pt_regs *ctx) { struct p2p_message msg = {}; bpf_usdt_readarg(1, ctx, &msg.peer_id); bpf_usdt_readarg_p(2, ctx, &msg.peer_addr, MAX_PEER_ADDR_LENGTH); bpf_usdt_readarg_p(3, ctx, &msg.peer_conn_type, MAX_PEER_CONN_TYPE_LENGTH); bpf_usdt_readarg_p(4, ctx, &msg.msg_type, MAX_MSG_TYPE_LENGTH); bpf_usdt_readarg(5, ctx, &msg.msg_size); inbound_messages.perf_submit(ctx, &msg, sizeof(msg)); return 0; }; int trace_outbound_message(struct pt_regs *ctx) { struct p2p_message msg = {}; bpf_usdt_readarg(1, ctx, &msg.peer_id); bpf_usdt_readarg_p(2, ctx, &msg.peer_addr, MAX_PEER_ADDR_LENGTH); bpf_usdt_readarg_p(3, ctx, &msg.peer_conn_type, MAX_PEER_CONN_TYPE_LENGTH); bpf_usdt_readarg_p(4, ctx, &msg.msg_type, MAX_MSG_TYPE_LENGTH); bpf_usdt_readarg(5, ctx, &msg.msg_size); outbound_messages.perf_submit(ctx, &msg, sizeof(msg)); return 0; }; """ class Message: """ A P2P network message. """ msg_type = "" size = 0 data = bytes() inbound = False def __init__(self, msg_type, size, inbound): self.msg_type = msg_type self.size = size self.inbound = inbound class Peer: """ A P2P network peer. """ id = 0 address = "" connection_type = "" last_messages = list() total_inbound_msgs = 0 total_inbound_bytes = 0 total_outbound_msgs = 0 total_outbound_bytes = 0 def __init__(self, id, address, connection_type): self.id = id self.address = address self.connection_type = connection_type self.last_messages = list() def add_message(self, message): self.last_messages.append(message) if len(self.last_messages) > 25: self.last_messages.pop(0) if message.inbound: self.total_inbound_bytes += message.size self.total_inbound_msgs += 1 else: self.total_outbound_bytes += message.size self.total_outbound_msgs += 1 def main(bitcoind_path): peers = dict() bitcoind_with_usdts = USDT(path=str(bitcoind_path)) # attaching the trace functions defined in the BPF program to the tracepoints bitcoind_with_usdts.enable_probe( probe="inbound_message", fn_name="trace_inbound_message") bitcoind_with_usdts.enable_probe( probe="outbound_message", fn_name="trace_outbound_message") bpf = BPF(text=program, usdt_contexts=[bitcoind_with_usdts]) # BCC: perf buffer handle function for inbound_messages def handle_inbound(_, data, size): """ Inbound message handler. Called each time a message is submitted to the inbound_messages BPF table.""" event = bpf["inbound_messages"].event(data) if event.peer_id not in peers: peer = Peer(event.peer_id, event.peer_addr.decode( "utf-8"), event.peer_conn_type.decode("utf-8")) peers[peer.id] = peer peers[event.peer_id].add_message( Message(event.msg_type.decode("utf-8"), event.msg_size, True)) # BCC: perf buffer handle function for outbound_messages def handle_outbound(_, data, size): """ Outbound message handler. Called each time a message is submitted to the outbound_messages BPF table.""" event = bpf["outbound_messages"].event(data) if event.peer_id not in peers: peer = Peer(event.peer_id, event.peer_addr.decode( "utf-8"), event.peer_conn_type.decode("utf-8")) peers[peer.id] = peer peers[event.peer_id].add_message( Message(event.msg_type.decode("utf-8"), event.msg_size, False)) # BCC: add handlers to the inbound and outbound perf buffers bpf["inbound_messages"].open_perf_buffer(handle_inbound) bpf["outbound_messages"].open_perf_buffer(handle_outbound) wrapper(loop, bpf, peers) def loop(screen, bpf, peers): screen.nodelay(1) cur_list_pos = 0 win = curses.newwin(30, 70, 2, 7) win.erase() win.border(ord("|"), ord("|"), ord("-"), ord("-"), ord("-"), ord("-"), ord("-"), ord("-")) info_panel = panel.new_panel(win) info_panel.hide() ROWS_AVALIABLE_FOR_LIST = curses.LINES - 5 scroll = 0 while True: try: # BCC: poll the perf buffers for new events or timeout after 50ms bpf.perf_buffer_poll(timeout=50) ch = screen.getch() if (ch == curses.KEY_DOWN or ch == ord("j")) and cur_list_pos < len( peers.keys()) -1 and info_panel.hidden(): cur_list_pos += 1 if cur_list_pos >= ROWS_AVALIABLE_FOR_LIST: scroll += 1 if (ch == curses.KEY_UP or ch == ord("k")) and cur_list_pos > 0 and info_panel.hidden(): cur_list_pos -= 1 if scroll > 0: scroll -= 1 if ch == ord('\n') or ch == ord(' '): if info_panel.hidden(): info_panel.show() else: info_panel.hide() screen.erase() render(screen, peers, cur_list_pos, scroll, ROWS_AVALIABLE_FOR_LIST, info_panel) curses.panel.update_panels() screen.refresh() except KeyboardInterrupt: exit() def render(screen, peers, cur_list_pos, scroll, ROWS_AVALIABLE_FOR_LIST, info_panel): """ renders the list of peers and details panel This code is unrelated to USDT, BCC and BPF. """ header_format = "%6s %-20s %-20s %-22s %-67s" row_format = "%6s %-5d %9d byte %-5d %9d byte %-22s %-67s" screen.addstr(0, 1, (" P2P Message Monitor "), curses.A_REVERSE) screen.addstr( 1, 0, (" Navigate with UP/DOWN or J/K and select a peer with ENTER or SPACE to see individual P2P messages"), curses.A_NORMAL) screen.addstr(3, 0, header_format % ("PEER", "OUTBOUND", "INBOUND", "TYPE", "ADDR"), curses.A_BOLD | curses.A_UNDERLINE) peer_list = sorted(peers.keys())[scroll:ROWS_AVALIABLE_FOR_LIST+scroll] for i, peer_id in enumerate(peer_list): peer = peers[peer_id] screen.addstr(i + 4, 0, row_format % (peer.id, peer.total_outbound_msgs, peer.total_outbound_bytes, peer.total_inbound_msgs, peer.total_inbound_bytes, peer.connection_type, peer.address), curses.A_REVERSE if i + scroll == cur_list_pos else curses.A_NORMAL) if i + scroll == cur_list_pos: info_window = info_panel.window() info_window.erase() info_window.border( ord("|"), ord("|"), ord("-"), ord("-"), ord("-"), ord("-"), ord("-"), ord("-")) info_window.addstr( 1, 1, f"PEER {peer.id} ({peer.address})".center(68), curses.A_REVERSE | curses.A_BOLD) info_window.addstr( 2, 1, f" OUR NODE{peer.connection_type:^54}PEER ", curses.A_BOLD) for i, msg in enumerate(peer.last_messages): if msg.inbound: info_window.addstr( i + 3, 1, "%68s" % (f"<--- {msg.msg_type} ({msg.size} bytes) "), curses.A_NORMAL) else: info_window.addstr( i + 3, 1, " %s (%d byte) --->" % (msg.msg_type, msg.size), curses.A_NORMAL) if __name__ == "__main__": if len(sys.argv) < 2: print("USAGE:", sys.argv[0], "path/to/bitcoind") exit() path = sys.argv[1] main(path)
0
bitcoin/contrib
bitcoin/contrib/tracing/log_utxocache_flush.py
#!/usr/bin/env python3 # Copyright (c) 2021-2022 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. import sys import ctypes from bcc import BPF, USDT """Example logging Bitcoin Core utxo set cache flushes utilizing the utxocache:flush tracepoint.""" # USAGE: ./contrib/tracing/log_utxocache_flush.py path/to/bitcoind # BCC: The C program to be compiled to an eBPF program (by BCC) and loaded into # a sandboxed Linux kernel VM. program = """ # include <uapi/linux/ptrace.h> struct data_t { u64 duration; u32 mode; u64 coins_count; u64 coins_mem_usage; bool is_flush_for_prune; }; // BPF perf buffer to push the data to user space. BPF_PERF_OUTPUT(flush); int trace_flush(struct pt_regs *ctx) { struct data_t data = {}; bpf_usdt_readarg(1, ctx, &data.duration); bpf_usdt_readarg(2, ctx, &data.mode); bpf_usdt_readarg(3, ctx, &data.coins_count); bpf_usdt_readarg(4, ctx, &data.coins_mem_usage); bpf_usdt_readarg(5, ctx, &data.is_flush_for_prune); flush.perf_submit(ctx, &data, sizeof(data)); return 0; } """ FLUSH_MODES = [ 'NONE', 'IF_NEEDED', 'PERIODIC', 'ALWAYS' ] class Data(ctypes.Structure): # define output data structure corresponding to struct data_t _fields_ = [ ("duration", ctypes.c_uint64), ("mode", ctypes.c_uint32), ("coins_count", ctypes.c_uint64), ("coins_mem_usage", ctypes.c_uint64), ("is_flush_for_prune", ctypes.c_bool) ] def print_event(event): print("%-15d %-10s %-15d %-15s %-8s" % ( event.duration, FLUSH_MODES[event.mode], event.coins_count, "%.2f kB" % (event.coins_mem_usage/1000), event.is_flush_for_prune )) def main(bitcoind_path): bitcoind_with_usdts = USDT(path=str(bitcoind_path)) # attaching the trace functions defined in the BPF program # to the tracepoints bitcoind_with_usdts.enable_probe( probe="flush", fn_name="trace_flush") b = BPF(text=program, usdt_contexts=[bitcoind_with_usdts]) def handle_flush(_, data, size): """ Coins Flush handler. Called each time coin caches and indexes are flushed.""" event = ctypes.cast(data, ctypes.POINTER(Data)).contents print_event(event) b["flush"].open_perf_buffer(handle_flush) print("Logging utxocache flushes. Ctrl-C to end...") print("%-15s %-10s %-15s %-15s %-8s" % ("Duration (µs)", "Mode", "Coins Count", "Memory Usage", "Flush for Prune")) while True: try: b.perf_buffer_poll() except KeyboardInterrupt: exit(0) if __name__ == "__main__": if len(sys.argv) < 2: print("USAGE: ", sys.argv[0], "path/to/bitcoind") exit(1) path = sys.argv[1] main(path)
0
bitcoin/contrib
bitcoin/contrib/tracing/log_p2p_traffic.bt
#!/usr/bin/env bpftrace BEGIN { printf("Logging P2P traffic\n") } usdt:./src/bitcoind:net:inbound_message { $peer_id = (int64) arg0; $peer_addr = str(arg1); $peer_type = str(arg2); $msg_type = str(arg3); $msg_len = arg4; printf("inbound '%s' msg from peer %d (%s, %s) with %d bytes\n", $msg_type, $peer_id, $peer_type, $peer_addr, $msg_len); } usdt:./src/bitcoind:net:outbound_message { $peer_id = (int64) arg0; $peer_addr = str(arg1); $peer_type = str(arg2); $msg_type = str(arg3); $msg_len = arg4; printf("outbound '%s' msg to peer %d (%s, %s) with %d bytes\n", $msg_type, $peer_id, $peer_type, $peer_addr, $msg_len); }
0
bitcoin/contrib
bitcoin/contrib/signet/README.md
Contents ======== This directory contains tools related to Signet, both for running a Signet yourself and for using one. getcoins.py =========== A script to call a faucet to get Signet coins. Syntax: `getcoins.py [-h|--help] [-c|--cmd=<bitcoin-cli path>] [-f|--faucet=<faucet URL>] [-a|--addr=<signet bech32 address>] [-p|--password=<faucet password>] [--] [<bitcoin-cli args>]` * `--cmd` lets you customize the bitcoin-cli path. By default it will look for it in the PATH * `--faucet` lets you specify which faucet to use; the faucet is assumed to be compatible with https://github.com/kallewoof/bitcoin-faucet * `--addr` lets you specify a Signet address; by default, the address must be a bech32 address. This and `--cmd` above complement each other (i.e. you do not need `bitcoin-cli` if you use `--addr`) * `--password` lets you specify a faucet password; this is handy if you are in a classroom and set up your own faucet for your students; (above faucet does not limit by IP when password is enabled) If using the default network, invoking the script with no arguments should be sufficient under normal circumstances, but if multiple people are behind the same IP address, the faucet will by default only accept one claim per day. See `--password` above. miner ===== You will first need to pick a difficulty target. Since signet chains are primarily protected by a signature rather than proof of work, there is no need to spend as much energy as possible mining, however you may wish to choose to spend more time than the absolute minimum. The calibrate subcommand can be used to pick a target appropriate for your hardware, eg: cd src/ MINER="../contrib/signet/miner" GRIND="./bitcoin-util grind" $MINER calibrate --grind-cmd="$GRIND" nbits=1e00f403 for 25s average mining time It defaults to estimating an nbits value resulting in 25s average time to find a block, but the --seconds parameter can be used to pick a different target, or the --nbits parameter can be used to estimate how long it will take for a given difficulty. To mine the first block in your custom chain, you can run: CLI="./bitcoin-cli -conf=mysignet.conf" ADDR=$($CLI -signet getnewaddress) NBITS=1e00f403 $MINER --cli="$CLI" generate --grind-cmd="$GRIND" --address="$ADDR" --nbits=$NBITS This will mine a single block with a backdated timestamp designed to allow 100 blocks to be mined as quickly as possible, so that it is possible to do transactions. Adding the --ongoing parameter will then cause the signet miner to create blocks indefinitely. It will pick the time between blocks so that difficulty is adjusted to match the provided --nbits value. $MINER --cli="$CLI" generate --grind-cmd="$GRIND" --address="$ADDR" --nbits=$NBITS --ongoing Other options ------------- The --debug and --quiet options are available to control how noisy the signet miner's output is. Note that the --debug, --quiet and --cli parameters must all appear before the subcommand (generate, calibrate, etc) if used. Instead of specifying --ongoing, you can specify --max-blocks=N to mine N blocks and stop. The --set-block-time option is available to manually move timestamps forward or backward (subject to the rules that blocktime must be greater than mediantime, and dates can't be more than two hours in the future). It can only be used when mining a single block (ie, not when using --ongoing or --max-blocks greater than 1). Instead of using a single address, a ranged descriptor may be provided via the --descriptor parameter, with the reward for the block at height H being sent to the H'th address generated from the descriptor. Instead of calculating a specific nbits value, --min-nbits can be specified instead, in which case the minimum signet difficulty will be targeted. Signet's minimum difficulty corresponds to --nbits=1e0377ae. By default, the signet miner mines blocks at fixed intervals with minimal variation. If you want blocks to appear more randomly, as they do in mainnet, specify the --poisson option. Using the --multiminer parameter allows mining to be distributed amongst multiple miners. For example, if you have 3 miners and want to share blocks between them, specify --multiminer=1/3 on one, --multiminer=2/3 on another, and --multiminer=3/3 on the last one. If you want one to do 10% of blocks and two others to do 45% each, --multiminer=1-10/100 on the first, and --multiminer=11-55 and --multiminer=56-100 on the others. Note that which miner mines which block is determined by the previous block hash, so occasional runs of one miner doing many blocks in a row is to be expected. When --multiminer is used, if a miner is down and does not mine a block within five minutes of when it is due, the other miners will automatically act as redundant backups ensuring the chain does not halt. The --backup-delay parameter can be used to change how long a given miner waits, allowing one to be the primary backup (after five minutes) and another to be the secondary backup (after six minutes, eg). The --standby-delay parameter can be used to make a backup miner that only mines if a block doesn't arrive on time. This can be combined with --multiminer if desired. Setting --standby-delay also prevents the first block from being mined immediately. Advanced usage -------------- The process generate follows internally is to get a block template, convert that into a PSBT, sign the PSBT, move the signature from the signed PSBT into the block template's coinbase, grind proof of work for the block, and then submit the block to the network. These steps can instead be done explicitly: $CLI -signet getblocktemplate '{"rules": ["signet","segwit"]}' | $MINER --cli="$CLI" genpsbt --address="$ADDR" | $CLI -signet -stdin walletprocesspsbt | jq -r .psbt | $MINER --cli="$CLI" solvepsbt --grind-cmd="$GRIND" | $CLI -signet -stdin submitblock This is intended to allow you to replace part of the pipeline for further experimentation (eg, to sign the block with a hardware wallet).
0
bitcoin/contrib
bitcoin/contrib/signet/getcoins.py
#!/usr/bin/env python3 # Copyright (c) 2020-2022 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. import argparse import io import requests import subprocess import sys import xml.etree.ElementTree DEFAULT_GLOBAL_FAUCET = 'https://signetfaucet.com/claim' DEFAULT_GLOBAL_CAPTCHA = 'https://signetfaucet.com/captcha' GLOBAL_FIRST_BLOCK_HASH = '00000086d6b2636cb2a392d45edc4ec544a10024d30141c9adf4bfd9de533b53' # braille unicode block BASE = 0x2800 BIT_PER_PIXEL = [ [0x01, 0x08], [0x02, 0x10], [0x04, 0x20], [0x40, 0x80], ] BW = 2 BH = 4 # imagemagick or compatible fork (used for converting SVG) CONVERT = 'convert' class PPMImage: ''' Load a PPM image (Pillow-ish API). ''' def __init__(self, f): if f.readline() != b'P6\n': raise ValueError('Invalid ppm format: header') line = f.readline() (width, height) = (int(x) for x in line.rstrip().split(b' ')) if f.readline() != b'255\n': raise ValueError('Invalid ppm format: color depth') data = f.read(width * height * 3) stride = width * 3 self.size = (width, height) self._grid = [[tuple(data[stride * y + 3 * x:stride * y + 3 * (x + 1)]) for x in range(width)] for y in range(height)] def getpixel(self, pos): return self._grid[pos[1]][pos[0]] def print_image(img, threshold=128): '''Print black-and-white image to terminal in braille unicode characters.''' x_blocks = (img.size[0] + BW - 1) // BW y_blocks = (img.size[1] + BH - 1) // BH for yb in range(y_blocks): line = [] for xb in range(x_blocks): ch = BASE for y in range(BH): for x in range(BW): try: val = img.getpixel((xb * BW + x, yb * BH + y)) except IndexError: pass else: if val[0] < threshold: ch |= BIT_PER_PIXEL[y][x] line.append(chr(ch)) print(''.join(line)) parser = argparse.ArgumentParser(description='Script to get coins from a faucet.', epilog='You may need to start with double-dash (--) when providing bitcoin-cli arguments.') parser.add_argument('-c', '--cmd', dest='cmd', default='bitcoin-cli', help='bitcoin-cli command to use') parser.add_argument('-f', '--faucet', dest='faucet', default=DEFAULT_GLOBAL_FAUCET, help='URL of the faucet') parser.add_argument('-g', '--captcha', dest='captcha', default=DEFAULT_GLOBAL_CAPTCHA, help='URL of the faucet captcha, or empty if no captcha is needed') parser.add_argument('-a', '--addr', dest='addr', default='', help='Bitcoin address to which the faucet should send') parser.add_argument('-p', '--password', dest='password', default='', help='Faucet password, if any') parser.add_argument('-n', '--amount', dest='amount', default='0.001', help='Amount to request (0.001-0.1, default is 0.001)') parser.add_argument('-i', '--imagemagick', dest='imagemagick', default=CONVERT, help='Path to imagemagick convert utility') parser.add_argument('bitcoin_cli_args', nargs='*', help='Arguments to pass on to bitcoin-cli (default: -signet)') args = parser.parse_args() if args.bitcoin_cli_args == []: args.bitcoin_cli_args = ['-signet'] def bitcoin_cli(rpc_command_and_params): argv = [args.cmd] + args.bitcoin_cli_args + rpc_command_and_params try: return subprocess.check_output(argv).strip().decode() except FileNotFoundError: raise SystemExit(f"The binary {args.cmd} could not be found") except subprocess.CalledProcessError: cmdline = ' '.join(argv) raise SystemExit(f"-----\nError while calling {cmdline} (see output above).") if args.faucet.lower() == DEFAULT_GLOBAL_FAUCET: # Get the hash of the block at height 1 of the currently active signet chain curr_signet_hash = bitcoin_cli(['getblockhash', '1']) if curr_signet_hash != GLOBAL_FIRST_BLOCK_HASH: raise SystemExit('The global faucet cannot be used with a custom Signet network. Please use the global signet or setup your custom faucet to use this functionality.\n') else: # For custom faucets, don't request captcha by default. if args.captcha == DEFAULT_GLOBAL_CAPTCHA: args.captcha = '' if args.addr == '': # get address for receiving coins args.addr = bitcoin_cli(['getnewaddress', 'faucet', 'bech32']) data = {'address': args.addr, 'password': args.password, 'amount': args.amount} # Store cookies # for debugging: print(session.cookies.get_dict()) session = requests.Session() if args.captcha != '': # Retrieve a captcha try: res = session.get(args.captcha) res.raise_for_status() except requests.exceptions.RequestException as e: raise SystemExit(f"Unexpected error when contacting faucet: {e}") # Size limitation svg = xml.etree.ElementTree.fromstring(res.content) if svg.attrib.get('width') != '150' or svg.attrib.get('height') != '50': raise SystemExit("Captcha size doesn't match expected dimensions 150x50") # Convert SVG image to PPM, and load it try: rv = subprocess.run([args.imagemagick, 'svg:-', '-depth', '8', 'ppm:-'], input=res.content, check=True, capture_output=True) except FileNotFoundError: raise SystemExit(f"The binary {args.imagemagick} could not be found. Please make sure ImageMagick (or a compatible fork) is installed and that the correct path is specified.") img = PPMImage(io.BytesIO(rv.stdout)) # Terminal interaction print_image(img) print(f"Captcha from URL {args.captcha}") data['captcha'] = input('Enter captcha: ') try: res = session.post(args.faucet, data=data) except Exception: raise SystemExit(f"Unexpected error when contacting faucet: {sys.exc_info()[0]}") # Display the output as per the returned status code if res: # When the return code is in between 200 and 400 i.e. successful print(res.text) elif res.status_code == 404: print('The specified faucet URL does not exist. Please check for any server issues/typo.') elif res.status_code == 429: print('The script does not allow for repeated transactions as the global faucet is rate-limitied to 1 request/IP/day. You can access the faucet website to get more coins manually') else: print(f'Returned Error Code {res.status_code}\n{res.text}\n') print('Please check the provided arguments for their validity and/or any possible typo.')
0
bitcoin/contrib
bitcoin/contrib/signet/miner
#!/usr/bin/env python3 # Copyright (c) 2020 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. import argparse import json import logging import math import os import re import struct import sys import time import subprocess PATH_BASE_CONTRIB_SIGNET = os.path.abspath(os.path.dirname(os.path.realpath(__file__))) PATH_BASE_TEST_FUNCTIONAL = os.path.abspath(os.path.join(PATH_BASE_CONTRIB_SIGNET, "..", "..", "test", "functional")) sys.path.insert(0, PATH_BASE_TEST_FUNCTIONAL) from test_framework.blocktools import get_witness_script, script_BIP34_coinbase_height # noqa: E402 from test_framework.messages import CBlock, CBlockHeader, COutPoint, CTransaction, CTxIn, CTxInWitness, CTxOut, from_binary, from_hex, ser_string, ser_uint256, tx_from_hex # noqa: E402 from test_framework.psbt import PSBT, PSBTMap, PSBT_GLOBAL_UNSIGNED_TX, PSBT_IN_FINAL_SCRIPTSIG, PSBT_IN_FINAL_SCRIPTWITNESS, PSBT_IN_NON_WITNESS_UTXO, PSBT_IN_SIGHASH_TYPE # noqa: E402 from test_framework.script import CScriptOp # noqa: E402 logging.basicConfig( format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO, datefmt='%Y-%m-%d %H:%M:%S') SIGNET_HEADER = b"\xec\xc7\xda\xa2" PSBT_SIGNET_BLOCK = b"\xfc\x06signetb" # proprietary PSBT global field holding the block being signed RE_MULTIMINER = re.compile(r"^(\d+)(-(\d+))?/(\d+)$") def create_coinbase(height, value, spk): cb = CTransaction() cb.vin = [CTxIn(COutPoint(0, 0xffffffff), script_BIP34_coinbase_height(height), 0xffffffff)] cb.vout = [CTxOut(value, spk)] return cb def signet_txs(block, challenge): # assumes signet solution has not been added yet so does not need # to be removed txs = block.vtx[:] txs[0] = CTransaction(txs[0]) txs[0].vout[-1].scriptPubKey += CScriptOp.encode_op_pushdata(SIGNET_HEADER) hashes = [] for tx in txs: tx.rehash() hashes.append(ser_uint256(tx.sha256)) mroot = block.get_merkle_root(hashes) sd = b"" sd += struct.pack("<i", block.nVersion) sd += ser_uint256(block.hashPrevBlock) sd += ser_uint256(mroot) sd += struct.pack("<I", block.nTime) to_spend = CTransaction() to_spend.nVersion = 0 to_spend.nLockTime = 0 to_spend.vin = [CTxIn(COutPoint(0, 0xFFFFFFFF), b"\x00" + CScriptOp.encode_op_pushdata(sd), 0)] to_spend.vout = [CTxOut(0, challenge)] to_spend.rehash() spend = CTransaction() spend.nVersion = 0 spend.nLockTime = 0 spend.vin = [CTxIn(COutPoint(to_spend.sha256, 0), b"", 0)] spend.vout = [CTxOut(0, b"\x6a")] return spend, to_spend def do_createpsbt(block, signme, spendme): psbt = PSBT() psbt.g = PSBTMap( {PSBT_GLOBAL_UNSIGNED_TX: signme.serialize(), PSBT_SIGNET_BLOCK: block.serialize() } ) psbt.i = [ PSBTMap( {PSBT_IN_NON_WITNESS_UTXO: spendme.serialize(), PSBT_IN_SIGHASH_TYPE: bytes([1,0,0,0])}) ] psbt.o = [ PSBTMap() ] return psbt.to_base64() def do_decode_psbt(b64psbt): psbt = PSBT.from_base64(b64psbt) assert len(psbt.tx.vin) == 1 assert len(psbt.tx.vout) == 1 assert PSBT_SIGNET_BLOCK in psbt.g.map scriptSig = psbt.i[0].map.get(PSBT_IN_FINAL_SCRIPTSIG, b"") scriptWitness = psbt.i[0].map.get(PSBT_IN_FINAL_SCRIPTWITNESS, b"\x00") return from_binary(CBlock, psbt.g.map[PSBT_SIGNET_BLOCK]), ser_string(scriptSig) + scriptWitness def finish_block(block, signet_solution, grind_cmd): block.vtx[0].vout[-1].scriptPubKey += CScriptOp.encode_op_pushdata(SIGNET_HEADER + signet_solution) block.vtx[0].rehash() block.hashMerkleRoot = block.calc_merkle_root() if grind_cmd is None: block.solve() else: headhex = CBlockHeader.serialize(block).hex() cmd = grind_cmd.split(" ") + [headhex] newheadhex = subprocess.run(cmd, stdout=subprocess.PIPE, input=b"", check=True).stdout.strip() newhead = from_hex(CBlockHeader(), newheadhex.decode('utf8')) block.nNonce = newhead.nNonce block.rehash() return block def generate_psbt(tmpl, reward_spk, *, blocktime=None): signet_spk = tmpl["signet_challenge"] signet_spk_bin = bytes.fromhex(signet_spk) cbtx = create_coinbase(height=tmpl["height"], value=tmpl["coinbasevalue"], spk=reward_spk) cbtx.vin[0].nSequence = 2**32-2 cbtx.rehash() block = CBlock() block.nVersion = tmpl["version"] block.hashPrevBlock = int(tmpl["previousblockhash"], 16) block.nTime = tmpl["curtime"] if blocktime is None else blocktime if block.nTime < tmpl["mintime"]: block.nTime = tmpl["mintime"] block.nBits = int(tmpl["bits"], 16) block.nNonce = 0 block.vtx = [cbtx] + [tx_from_hex(t["data"]) for t in tmpl["transactions"]] witnonce = 0 witroot = block.calc_witness_merkle_root() cbwit = CTxInWitness() cbwit.scriptWitness.stack = [ser_uint256(witnonce)] block.vtx[0].wit.vtxinwit = [cbwit] block.vtx[0].vout.append(CTxOut(0, bytes(get_witness_script(witroot, witnonce)))) signme, spendme = signet_txs(block, signet_spk_bin) return do_createpsbt(block, signme, spendme) def get_reward_address(args, height): if args.address is not None: return args.address if '*' not in args.descriptor: addr = json.loads(args.bcli("deriveaddresses", args.descriptor))[0] args.address = addr return addr remove = [k for k in args.derived_addresses.keys() if k+20 <= height] for k in remove: del args.derived_addresses[k] addr = args.derived_addresses.get(height, None) if addr is None: addrs = json.loads(args.bcli("deriveaddresses", args.descriptor, "[%d,%d]" % (height, height+20))) addr = addrs[0] for k, a in enumerate(addrs): args.derived_addresses[height+k] = a return addr def get_reward_addr_spk(args, height): assert args.address is not None or args.descriptor is not None if hasattr(args, "reward_spk"): return args.address, args.reward_spk reward_addr = get_reward_address(args, height) reward_spk = bytes.fromhex(json.loads(args.bcli("getaddressinfo", reward_addr))["scriptPubKey"]) if args.address is not None: # will always be the same, so cache args.reward_spk = reward_spk return reward_addr, reward_spk def do_genpsbt(args): tmpl = json.load(sys.stdin) _, reward_spk = get_reward_addr_spk(args, tmpl["height"]) psbt = generate_psbt(tmpl, reward_spk) print(psbt) def do_solvepsbt(args): block, signet_solution = do_decode_psbt(sys.stdin.read()) block = finish_block(block, signet_solution, args.grind_cmd) print(block.serialize().hex()) def nbits_to_target(nbits): shift = (nbits >> 24) & 0xff return (nbits & 0x00ffffff) * 2**(8*(shift - 3)) def target_to_nbits(target): tstr = "{0:x}".format(target) if len(tstr) < 6: tstr = ("000000"+tstr)[-6:] if len(tstr) % 2 != 0: tstr = "0" + tstr if int(tstr[0],16) >= 0x8: # avoid "negative" tstr = "00" + tstr fix = int(tstr[:6], 16) sz = len(tstr)//2 if tstr[6:] != "0"*(sz*2-6): fix += 1 return int("%02x%06x" % (sz,fix), 16) def seconds_to_hms(s): if s == 0: return "0s" neg = (s < 0) if neg: s = -s out = "" if s % 60 > 0: out = "%ds" % (s % 60) s //= 60 if s % 60 > 0: out = "%dm%s" % (s % 60, out) s //= 60 if s > 0: out = "%dh%s" % (s, out) if neg: out = "-" + out return out def next_block_delta(last_nbits, last_hash, ultimate_target, do_poisson, max_interval): # strategy: # 1) work out how far off our desired target we are # 2) cap it to a factor of 4 since that's the best we can do in a single retarget period # 3) use that to work out the desired average interval in this retarget period # 4) if doing poisson, use the last hash to pick a uniformly random number in [0,1), and work out a random multiplier to vary the average by # 5) cap the resulting interval between 1 second and 1 hour to avoid extremes INTERVAL = 600.0*2016/2015 # 10 minutes, adjusted for the off-by-one bug current_target = nbits_to_target(last_nbits) retarget_factor = ultimate_target / current_target retarget_factor = max(0.25, min(retarget_factor, 4.0)) avg_interval = INTERVAL * retarget_factor if do_poisson: det_rand = int(last_hash[-8:], 16) * 2**-32 this_interval_variance = -math.log1p(-det_rand) else: this_interval_variance = 1 this_interval = avg_interval * this_interval_variance this_interval = max(1, min(this_interval, max_interval)) return this_interval def next_block_is_mine(last_hash, my_blocks): det_rand = int(last_hash[-16:-8], 16) return my_blocks[0] <= (det_rand % my_blocks[2]) < my_blocks[1] def do_generate(args): if args.max_blocks is not None: if args.ongoing: logging.error("Cannot specify both --ongoing and --max-blocks") return 1 if args.max_blocks < 1: logging.error("N must be a positive integer") return 1 max_blocks = args.max_blocks elif args.ongoing: max_blocks = None else: max_blocks = 1 if args.set_block_time is not None and max_blocks != 1: logging.error("Cannot specify --ongoing or --max-blocks > 1 when using --set-block-time") return 1 if args.set_block_time is not None and args.set_block_time < 0: args.set_block_time = time.time() logging.info("Treating negative block time as current time (%d)" % (args.set_block_time)) if args.min_nbits: if args.nbits is not None: logging.error("Cannot specify --nbits and --min-nbits") return 1 args.nbits = "1e0377ae" logging.info("Using nbits=%s" % (args.nbits)) if args.set_block_time is None: if args.nbits is None or len(args.nbits) != 8: logging.error("Must specify --nbits (use calibrate command to determine value)") return 1 if args.multiminer is None: my_blocks = (0,1,1) else: if not args.ongoing: logging.error("Cannot specify --multiminer without --ongoing") return 1 m = RE_MULTIMINER.match(args.multiminer) if m is None: logging.error("--multiminer argument must be k/m or j-k/m") return 1 start,_,stop,total = m.groups() if stop is None: stop = start start, stop, total = map(int, (start, stop, total)) if stop < start or start <= 0 or total < stop or total == 0: logging.error("Inconsistent values for --multiminer") return 1 my_blocks = (start-1, stop, total) if args.max_interval < 960: logging.error("--max-interval must be at least 960 (16 minutes)") return 1 ultimate_target = nbits_to_target(int(args.nbits,16)) mined_blocks = 0 bestheader = {"hash": None} lastheader = None while max_blocks is None or mined_blocks < max_blocks: # current status? bci = json.loads(args.bcli("getblockchaininfo")) if bestheader["hash"] != bci["bestblockhash"]: bestheader = json.loads(args.bcli("getblockheader", bci["bestblockhash"])) if lastheader is None: lastheader = bestheader["hash"] elif bestheader["hash"] != lastheader: next_delta = next_block_delta(int(bestheader["bits"], 16), bestheader["hash"], ultimate_target, args.poisson, args.max_interval) next_delta += bestheader["time"] - time.time() next_is_mine = next_block_is_mine(bestheader["hash"], my_blocks) logging.info("Received new block at height %d; next in %s (%s)", bestheader["height"], seconds_to_hms(next_delta), ("mine" if next_is_mine else "backup")) lastheader = bestheader["hash"] # when is the next block due to be mined? now = time.time() if args.set_block_time is not None: logging.debug("Setting start time to %d", args.set_block_time) mine_time = args.set_block_time action_time = now is_mine = True elif bestheader["height"] == 0: time_delta = next_block_delta(int(bestheader["bits"], 16), bci["bestblockhash"], ultimate_target, args.poisson, args.max_interval) time_delta *= 100 # 100 blocks logging.info("Backdating time for first block to %d minutes ago" % (time_delta/60)) mine_time = now - time_delta action_time = now is_mine = True else: time_delta = next_block_delta(int(bestheader["bits"], 16), bci["bestblockhash"], ultimate_target, args.poisson, args.max_interval) mine_time = bestheader["time"] + time_delta is_mine = next_block_is_mine(bci["bestblockhash"], my_blocks) action_time = mine_time if not is_mine: action_time += args.backup_delay if args.standby_delay > 0: action_time += args.standby_delay elif mined_blocks == 0: # for non-standby, always mine immediately on startup, # even if the next block shouldn't be ours action_time = now # don't want fractional times so round down mine_time = int(mine_time) action_time = int(action_time) # can't mine a block 2h in the future; 1h55m for some safety action_time = max(action_time, mine_time - 6900) # ready to go? otherwise sleep and check for new block if now < action_time: sleep_for = min(action_time - now, 60) if mine_time < now: # someone else might have mined the block, # so check frequently, so we don't end up late # mining the next block if it's ours sleep_for = min(20, sleep_for) minestr = "mine" if is_mine else "backup" logging.debug("Sleeping for %s, next block due in %s (%s)" % (seconds_to_hms(sleep_for), seconds_to_hms(mine_time - now), minestr)) time.sleep(sleep_for) continue # gbt tmpl = json.loads(args.bcli("getblocktemplate", '{"rules":["signet","segwit"]}')) if tmpl["previousblockhash"] != bci["bestblockhash"]: logging.warning("GBT based off unexpected block (%s not %s), retrying", tmpl["previousblockhash"], bci["bestblockhash"]) time.sleep(1) continue logging.debug("GBT template: %s", tmpl) if tmpl["mintime"] > mine_time: logging.info("Updating block time from %d to %d", mine_time, tmpl["mintime"]) mine_time = tmpl["mintime"] if mine_time > now: logging.error("GBT mintime is in the future: %d is %d seconds later than %d", mine_time, (mine_time-now), now) return 1 # address for reward reward_addr, reward_spk = get_reward_addr_spk(args, tmpl["height"]) # mine block logging.debug("Mining block delta=%s start=%s mine=%s", seconds_to_hms(mine_time-bestheader["time"]), mine_time, is_mine) mined_blocks += 1 psbt = generate_psbt(tmpl, reward_spk, blocktime=mine_time) input_stream = os.linesep.join([psbt, "true", "ALL"]).encode('utf8') psbt_signed = json.loads(args.bcli("-stdin", "walletprocesspsbt", input=input_stream)) if not psbt_signed.get("complete",False): logging.debug("Generated PSBT: %s" % (psbt,)) sys.stderr.write("PSBT signing failed\n") return 1 block, signet_solution = do_decode_psbt(psbt_signed["psbt"]) block = finish_block(block, signet_solution, args.grind_cmd) # submit block r = args.bcli("-stdin", "submitblock", input=block.serialize().hex().encode('utf8')) # report bstr = "block" if is_mine else "backup block" next_delta = next_block_delta(block.nBits, block.hash, ultimate_target, args.poisson, args.max_interval) next_delta += block.nTime - time.time() next_is_mine = next_block_is_mine(block.hash, my_blocks) logging.debug("Block hash %s payout to %s", block.hash, reward_addr) logging.info("Mined %s at height %d; next in %s (%s)", bstr, tmpl["height"], seconds_to_hms(next_delta), ("mine" if next_is_mine else "backup")) if r != "": logging.warning("submitblock returned %s for height %d hash %s", r, tmpl["height"], block.hash) lastheader = block.hash def do_calibrate(args): if args.nbits is not None and args.seconds is not None: sys.stderr.write("Can only specify one of --nbits or --seconds\n") return 1 if args.nbits is not None and len(args.nbits) != 8: sys.stderr.write("Must specify 8 hex digits for --nbits\n") return 1 TRIALS = 600 # gets variance down pretty low TRIAL_BITS = 0x1e3ea75f # takes about 5m to do 600 trials header = CBlockHeader() header.nBits = TRIAL_BITS targ = nbits_to_target(header.nBits) start = time.time() count = 0 for i in range(TRIALS): header.nTime = i header.nNonce = 0 headhex = header.serialize().hex() cmd = args.grind_cmd.split(" ") + [headhex] newheadhex = subprocess.run(cmd, stdout=subprocess.PIPE, input=b"", check=True).stdout.strip() avg = (time.time() - start) * 1.0 / TRIALS if args.nbits is not None: want_targ = nbits_to_target(int(args.nbits,16)) want_time = avg*targ/want_targ else: want_time = args.seconds if args.seconds is not None else 25 want_targ = int(targ*(avg/want_time)) print("nbits=%08x for %ds average mining time" % (target_to_nbits(want_targ), want_time)) return 0 def bitcoin_cli(basecmd, args, **kwargs): cmd = basecmd + ["-signet"] + args logging.debug("Calling bitcoin-cli: %r", cmd) out = subprocess.run(cmd, stdout=subprocess.PIPE, **kwargs, check=True).stdout if isinstance(out, bytes): out = out.decode('utf8') return out.strip() def main(): parser = argparse.ArgumentParser() parser.add_argument("--cli", default="bitcoin-cli", type=str, help="bitcoin-cli command") parser.add_argument("--debug", action="store_true", help="Print debugging info") parser.add_argument("--quiet", action="store_true", help="Only print warnings/errors") cmds = parser.add_subparsers(help="sub-commands") genpsbt = cmds.add_parser("genpsbt", help="Generate a block PSBT for signing") genpsbt.set_defaults(fn=do_genpsbt) solvepsbt = cmds.add_parser("solvepsbt", help="Solve a signed block PSBT") solvepsbt.set_defaults(fn=do_solvepsbt) generate = cmds.add_parser("generate", help="Mine blocks") generate.set_defaults(fn=do_generate) generate.add_argument("--ongoing", action="store_true", help="Keep mining blocks") generate.add_argument("--max-blocks", default=None, type=int, help="Max blocks to mine (default=1)") generate.add_argument("--set-block-time", default=None, type=int, help="Set block time (unix timestamp)") generate.add_argument("--nbits", default=None, type=str, help="Target nBits (specify difficulty)") generate.add_argument("--min-nbits", action="store_true", help="Target minimum nBits (use min difficulty)") generate.add_argument("--poisson", action="store_true", help="Simulate randomised block times") generate.add_argument("--multiminer", default=None, type=str, help="Specify which set of blocks to mine (eg: 1-40/100 for the first 40%%, 2/3 for the second 3rd)") generate.add_argument("--backup-delay", default=300, type=int, help="Seconds to delay before mining blocks reserved for other miners (default=300)") generate.add_argument("--standby-delay", default=0, type=int, help="Seconds to delay before mining blocks (default=0)") generate.add_argument("--max-interval", default=1800, type=int, help="Maximum interblock interval (seconds)") calibrate = cmds.add_parser("calibrate", help="Calibrate difficulty") calibrate.set_defaults(fn=do_calibrate) calibrate.add_argument("--nbits", type=str, default=None) calibrate.add_argument("--seconds", type=int, default=None) for sp in [genpsbt, generate]: sp.add_argument("--address", default=None, type=str, help="Address for block reward payment") sp.add_argument("--descriptor", default=None, type=str, help="Descriptor for block reward payment") for sp in [solvepsbt, generate, calibrate]: sp.add_argument("--grind-cmd", default=None, type=str, required=(sp==calibrate), help="Command to grind a block header for proof-of-work") args = parser.parse_args(sys.argv[1:]) args.bcli = lambda *a, input=b"", **kwargs: bitcoin_cli(args.cli.split(" "), list(a), input=input, **kwargs) if hasattr(args, "address") and hasattr(args, "descriptor"): if args.address is None and args.descriptor is None: sys.stderr.write("Must specify --address or --descriptor\n") return 1 elif args.address is not None and args.descriptor is not None: sys.stderr.write("Only specify one of --address or --descriptor\n") return 1 args.derived_addresses = {} if args.debug: logging.getLogger().setLevel(logging.DEBUG) elif args.quiet: logging.getLogger().setLevel(logging.WARNING) else: logging.getLogger().setLevel(logging.INFO) if hasattr(args, "fn"): return args.fn(args) else: logging.error("Must specify command") return 1 if __name__ == "__main__": main()
0
bitcoin/contrib
bitcoin/contrib/macdeploy/detached-sig-create.sh
#!/bin/sh # Copyright (c) 2014-2022 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. export LC_ALL=C set -e ROOTDIR=dist BUNDLE="${ROOTDIR}/Bitcoin-Qt.app" BINARY="${BUNDLE}/Contents/MacOS/Bitcoin-Qt" SIGNAPPLE=signapple TEMPDIR=sign.temp ARCH=$(${SIGNAPPLE} info ${BINARY} | head -n 1 | cut -d " " -f 1) OUT="signature-osx-${ARCH}.tar.gz" OUTROOT=osx/dist if [ -z "$1" ]; then echo "usage: $0 <signapple args>" echo "example: $0 <path to key>" exit 1 fi rm -rf ${TEMPDIR} mkdir -p ${TEMPDIR} ${SIGNAPPLE} sign -f --detach "${TEMPDIR}/${OUTROOT}" "$@" "${BUNDLE}" tar -C "${TEMPDIR}" -czf "${OUT}" . rm -rf "${TEMPDIR}" echo "Created ${OUT}"
0
bitcoin/contrib
bitcoin/contrib/macdeploy/LICENSE
GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: <program> Copyright (C) <year> <name of author> This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.
0
bitcoin/contrib
bitcoin/contrib/macdeploy/README.md
# MacOS Deployment The `macdeployqtplus` script should not be run manually. Instead, after building as usual: ```bash make deploy ``` When complete, it will have produced `Bitcoin-Core.zip`. ## SDK Extraction ### Step 1: Obtaining `Xcode.app` A free Apple Developer Account is required to proceed. Our macOS SDK can be extracted from [Xcode_15.xip](https://download.developer.apple.com/Developer_Tools/Xcode_15/Xcode_15.xip). Alternatively, after logging in to your account go to 'Downloads', then 'More' and search for [`Xcode 15`](https://developer.apple.com/download/all/?q=Xcode%2015). An Apple ID and cookies enabled for the hostname are needed to download this. The `sha256sum` of the downloaded XIP archive should be `4daaed2ef2253c9661779fa40bfff50655dc7ec45801aba5a39653e7bcdde48e`. To extract the `.xip` on Linux: ```bash # Install/clone tools needed for extracting Xcode.app apt install cpio git clone https://github.com/bitcoin-core/apple-sdk-tools.git # Unpack the .xip and place the resulting Xcode.app in your current # working directory python3 apple-sdk-tools/extract_xcode.py -f Xcode_15.xip | cpio -d -i ``` On macOS: ```bash xip -x Xcode_15.xip ``` ### Step 2: Generating the SDK tarball from `Xcode.app` To generate the SDK, run the script [`gen-sdk`](./gen-sdk) with the path to `Xcode.app` (extracted in the previous stage) as the first argument. ```bash ./contrib/macdeploy/gen-sdk '/path/to/Xcode.app' ``` The generated archive should be: `Xcode-15.0-15A240d-extracted-SDK-with-libcxx-headers.tar.gz`. The `sha256sum` should be `c0c2e7bb92c1fee0c4e9f3a485e4530786732d6c6dd9e9f418c282aa6892f55d`. ## Deterministic macOS App Notes macOS Applications are created in Linux by combining a recent `clang` and the Apple `binutils` (`ld`, `ar`, etc). Apple uses `clang` extensively for development and has upstreamed the necessary functionality so that a vanilla clang can take advantage. It supports the use of `-F`, `-target`, `-mmacosx-version-min`, and `-isysroot`, which are all necessary when building for macOS. Apple's version of `binutils` (called `cctools`) contains lots of functionality missing in the FSF's `binutils`. In addition to extra linker options for frameworks and sysroots, several other tools are needed as well such as `install_name_tool`, `lipo`, and `nmedit`. These do not build under Linux, so they have been patched to do so. The work here was used as a starting point: [mingwandroid/toolchain4](https://github.com/mingwandroid/toolchain4). In order to build a working toolchain, the following source packages are needed from Apple: `cctools`, `dyld`, and `ld64`. These tools inject timestamps by default, which produce non-deterministic binaries. The `ZERO_AR_DATE` environment variable is used to disable that. This version of `cctools` has been patched to use the current version of `clang`'s headers and its `libLTO.so` rather than those from `llvmgcc`, as it was originally done in `toolchain4`. To complicate things further, all builds must target an Apple SDK. These SDKs are free to download, but not redistributable. See the SDK Extraction notes above for how to obtain it. The Guix process builds 2 sets of files: Linux tools, then Apple binaries which are created using these tools. The build process has been designed to avoid including the SDK's files in Guix's outputs. All interim tarballs are fully deterministic and may be freely redistributed. As of OS X 10.9 Mavericks, using an Apple-blessed key to sign binaries is a requirement in order to satisfy the new Gatekeeper requirements. Because this private key cannot be shared, we'll have to be a bit creative in order for the build process to remain somewhat deterministic. Here's how it works: - Builders use Guix to create an unsigned release. This outputs an unsigned ZIP which users may choose to bless and run. It also outputs an unsigned app structure in the form of a tarball. - The Apple keyholder uses this unsigned app to create a detached signature, using the script that is also included there. Detached signatures are available from this [repository](https://github.com/bitcoin-core/bitcoin-detached-sigs). - Builders feed the unsigned app + detached signature back into Guix. It uses the pre-built tools to recombine the pieces into a deterministic ZIP.
0
bitcoin/contrib
bitcoin/contrib/macdeploy/macdeployqtplus
#!/usr/bin/env python3 # # Copyright (C) 2011 Patrick "p2k" Schneider <me@p2k-network.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # import sys, re, os, platform, shutil, stat, subprocess, os.path from argparse import ArgumentParser from pathlib import Path from subprocess import PIPE, run from typing import Optional # This is ported from the original macdeployqt with modifications class FrameworkInfo(object): def __init__(self): self.frameworkDirectory = "" self.frameworkName = "" self.frameworkPath = "" self.binaryDirectory = "" self.binaryName = "" self.binaryPath = "" self.version = "" self.installName = "" self.deployedInstallName = "" self.sourceFilePath = "" self.destinationDirectory = "" self.sourceResourcesDirectory = "" self.sourceVersionContentsDirectory = "" self.sourceContentsDirectory = "" self.destinationResourcesDirectory = "" self.destinationVersionContentsDirectory = "" def __eq__(self, other): if self.__class__ == other.__class__: return self.__dict__ == other.__dict__ else: return False def __str__(self): return f""" Framework name: {self.frameworkName} Framework directory: {self.frameworkDirectory} Framework path: {self.frameworkPath} Binary name: {self.binaryName} Binary directory: {self.binaryDirectory} Binary path: {self.binaryPath} Version: {self.version} Install name: {self.installName} Deployed install name: {self.deployedInstallName} Source file Path: {self.sourceFilePath} Deployed Directory (relative to bundle): {self.destinationDirectory} """ def isDylib(self): return self.frameworkName.endswith(".dylib") def isQtFramework(self): if self.isDylib(): return self.frameworkName.startswith("libQt") else: return self.frameworkName.startswith("Qt") reOLine = re.compile(r'^(.+) \(compatibility version [0-9.]+, current version [0-9.]+\)$') bundleFrameworkDirectory = "Contents/Frameworks" bundleBinaryDirectory = "Contents/MacOS" @classmethod def fromOtoolLibraryLine(cls, line: str) -> Optional['FrameworkInfo']: # Note: line must be trimmed if line == "": return None # Don't deploy system libraries if line.startswith("/System/Library/") or line.startswith("@executable_path") or line.startswith("/usr/lib/"): return None m = cls.reOLine.match(line) if m is None: raise RuntimeError(f"otool line could not be parsed: {line}") path = m.group(1) info = cls() info.sourceFilePath = path info.installName = path if path.endswith(".dylib"): dirname, filename = os.path.split(path) info.frameworkName = filename info.frameworkDirectory = dirname info.frameworkPath = path info.binaryDirectory = dirname info.binaryName = filename info.binaryPath = path info.version = "-" info.installName = path info.deployedInstallName = f"@executable_path/../Frameworks/{info.binaryName}" info.sourceFilePath = path info.destinationDirectory = cls.bundleFrameworkDirectory else: parts = path.split("/") i = 0 # Search for the .framework directory for part in parts: if part.endswith(".framework"): break i += 1 if i == len(parts): raise RuntimeError(f"Could not find .framework or .dylib in otool line: {line}") info.frameworkName = parts[i] info.frameworkDirectory = "/".join(parts[:i]) info.frameworkPath = os.path.join(info.frameworkDirectory, info.frameworkName) info.binaryName = parts[i+3] info.binaryDirectory = "/".join(parts[i+1:i+3]) info.binaryPath = os.path.join(info.binaryDirectory, info.binaryName) info.version = parts[i+2] info.deployedInstallName = f"@executable_path/../Frameworks/{os.path.join(info.frameworkName, info.binaryPath)}" info.destinationDirectory = os.path.join(cls.bundleFrameworkDirectory, info.frameworkName, info.binaryDirectory) info.sourceResourcesDirectory = os.path.join(info.frameworkPath, "Resources") info.sourceContentsDirectory = os.path.join(info.frameworkPath, "Contents") info.sourceVersionContentsDirectory = os.path.join(info.frameworkPath, "Versions", info.version, "Contents") info.destinationResourcesDirectory = os.path.join(cls.bundleFrameworkDirectory, info.frameworkName, "Resources") info.destinationVersionContentsDirectory = os.path.join(cls.bundleFrameworkDirectory, info.frameworkName, "Versions", info.version, "Contents") return info class ApplicationBundleInfo(object): def __init__(self, path: str): self.path = path # for backwards compatibility reasons, this must remain as Bitcoin-Qt self.binaryPath = os.path.join(path, "Contents", "MacOS", "Bitcoin-Qt") if not os.path.exists(self.binaryPath): raise RuntimeError(f"Could not find bundle binary for {path}") self.resourcesPath = os.path.join(path, "Contents", "Resources") self.pluginPath = os.path.join(path, "Contents", "PlugIns") class DeploymentInfo(object): def __init__(self): self.qtPath = None self.pluginPath = None self.deployedFrameworks = [] def detectQtPath(self, frameworkDirectory: str): parentDir = os.path.dirname(frameworkDirectory) if os.path.exists(os.path.join(parentDir, "translations")): # Classic layout, e.g. "/usr/local/Trolltech/Qt-4.x.x" self.qtPath = parentDir else: self.qtPath = os.getenv("QTDIR", None) if self.qtPath is not None: pluginPath = os.path.join(self.qtPath, "plugins") if os.path.exists(pluginPath): self.pluginPath = pluginPath def usesFramework(self, name: str) -> bool: for framework in self.deployedFrameworks: if framework.endswith(".framework"): if framework.startswith(f"{name}."): return True elif framework.endswith(".dylib"): if framework.startswith(f"lib{name}."): return True return False def getFrameworks(binaryPath: str, verbose: int) -> list[FrameworkInfo]: if verbose: print(f"Inspecting with otool: {binaryPath}") otoolbin=os.getenv("OTOOL", "otool") otool = run([otoolbin, "-L", binaryPath], stdout=PIPE, stderr=PIPE, text=True) if otool.returncode != 0: sys.stderr.write(otool.stderr) sys.stderr.flush() raise RuntimeError(f"otool failed with return code {otool.returncode}") otoolLines = otool.stdout.split("\n") otoolLines.pop(0) # First line is the inspected binary if ".framework" in binaryPath or binaryPath.endswith(".dylib"): otoolLines.pop(0) # Frameworks and dylibs list themselves as a dependency. libraries = [] for line in otoolLines: line = line.replace("@loader_path", os.path.dirname(binaryPath)) info = FrameworkInfo.fromOtoolLibraryLine(line.strip()) if info is not None: if verbose: print("Found framework:") print(info) libraries.append(info) return libraries def runInstallNameTool(action: str, *args): installnametoolbin=os.getenv("INSTALL_NAME_TOOL", "install_name_tool") run([installnametoolbin, "-"+action] + list(args), check=True) def changeInstallName(oldName: str, newName: str, binaryPath: str, verbose: int): if verbose: print("Using install_name_tool:") print(" in", binaryPath) print(" change reference", oldName) print(" to", newName) runInstallNameTool("change", oldName, newName, binaryPath) def changeIdentification(id: str, binaryPath: str, verbose: int): if verbose: print("Using install_name_tool:") print(" change identification in", binaryPath) print(" to", id) runInstallNameTool("id", id, binaryPath) def runStrip(binaryPath: str, verbose: int): stripbin=os.getenv("STRIP", "strip") if verbose: print("Using strip:") print(" stripped", binaryPath) run([stripbin, "-x", binaryPath], check=True) def copyFramework(framework: FrameworkInfo, path: str, verbose: int) -> Optional[str]: if framework.sourceFilePath.startswith("Qt"): #standard place for Nokia Qt installer's frameworks fromPath = f"/Library/Frameworks/{framework.sourceFilePath}" else: fromPath = framework.sourceFilePath toDir = os.path.join(path, framework.destinationDirectory) toPath = os.path.join(toDir, framework.binaryName) if framework.isDylib(): if not os.path.exists(fromPath): raise RuntimeError(f"No file at {fromPath}") if os.path.exists(toPath): return None # Already there if not os.path.exists(toDir): os.makedirs(toDir) shutil.copy2(fromPath, toPath) if verbose: print("Copied:", fromPath) print(" to:", toPath) else: to_dir = os.path.join(path, "Contents", "Frameworks", framework.frameworkName) if os.path.exists(to_dir): return None # Already there from_dir = framework.frameworkPath if not os.path.exists(from_dir): raise RuntimeError(f"No directory at {from_dir}") shutil.copytree(from_dir, to_dir, symlinks=True) if verbose: print("Copied:", from_dir) print(" to:", to_dir) headers_link = os.path.join(to_dir, "Headers") if os.path.exists(headers_link): os.unlink(headers_link) headers_dir = os.path.join(to_dir, framework.binaryDirectory, "Headers") if os.path.exists(headers_dir): shutil.rmtree(headers_dir) permissions = os.stat(toPath) if not permissions.st_mode & stat.S_IWRITE: os.chmod(toPath, permissions.st_mode | stat.S_IWRITE) return toPath def deployFrameworks(frameworks: list[FrameworkInfo], bundlePath: str, binaryPath: str, strip: bool, verbose: int, deploymentInfo: Optional[DeploymentInfo] = None) -> DeploymentInfo: if deploymentInfo is None: deploymentInfo = DeploymentInfo() while len(frameworks) > 0: framework = frameworks.pop(0) deploymentInfo.deployedFrameworks.append(framework.frameworkName) print("Processing", framework.frameworkName, "...") # Get the Qt path from one of the Qt frameworks if deploymentInfo.qtPath is None and framework.isQtFramework(): deploymentInfo.detectQtPath(framework.frameworkDirectory) if framework.installName.startswith("@executable_path") or framework.installName.startswith(bundlePath): print(framework.frameworkName, "already deployed, skipping.") continue # install_name_tool the new id into the binary changeInstallName(framework.installName, framework.deployedInstallName, binaryPath, verbose) # Copy framework to app bundle. deployedBinaryPath = copyFramework(framework, bundlePath, verbose) # Skip the rest if already was deployed. if deployedBinaryPath is None: continue if strip: runStrip(deployedBinaryPath, verbose) # install_name_tool it a new id. changeIdentification(framework.deployedInstallName, deployedBinaryPath, verbose) # Check for framework dependencies dependencies = getFrameworks(deployedBinaryPath, verbose) for dependency in dependencies: changeInstallName(dependency.installName, dependency.deployedInstallName, deployedBinaryPath, verbose) # Deploy framework if necessary. if dependency.frameworkName not in deploymentInfo.deployedFrameworks and dependency not in frameworks: frameworks.append(dependency) return deploymentInfo def deployFrameworksForAppBundle(applicationBundle: ApplicationBundleInfo, strip: bool, verbose: int) -> DeploymentInfo: frameworks = getFrameworks(applicationBundle.binaryPath, verbose) if len(frameworks) == 0: print(f"Warning: Could not find any external frameworks to deploy in {applicationBundle.path}.") return DeploymentInfo() else: return deployFrameworks(frameworks, applicationBundle.path, applicationBundle.binaryPath, strip, verbose) def deployPlugins(appBundleInfo: ApplicationBundleInfo, deploymentInfo: DeploymentInfo, strip: bool, verbose: int): plugins = [] if deploymentInfo.pluginPath is None: return for dirpath, dirnames, filenames in os.walk(deploymentInfo.pluginPath): pluginDirectory = os.path.relpath(dirpath, deploymentInfo.pluginPath) if pluginDirectory not in ['styles', 'platforms']: continue for pluginName in filenames: pluginPath = os.path.join(pluginDirectory, pluginName) if pluginName.split('.')[0] not in ['libqminimal', 'libqcocoa', 'libqmacstyle']: continue plugins.append((pluginDirectory, pluginName)) for pluginDirectory, pluginName in plugins: print("Processing plugin", os.path.join(pluginDirectory, pluginName), "...") sourcePath = os.path.join(deploymentInfo.pluginPath, pluginDirectory, pluginName) destinationDirectory = os.path.join(appBundleInfo.pluginPath, pluginDirectory) if not os.path.exists(destinationDirectory): os.makedirs(destinationDirectory) destinationPath = os.path.join(destinationDirectory, pluginName) shutil.copy2(sourcePath, destinationPath) if verbose: print("Copied:", sourcePath) print(" to:", destinationPath) if strip: runStrip(destinationPath, verbose) dependencies = getFrameworks(destinationPath, verbose) for dependency in dependencies: changeInstallName(dependency.installName, dependency.deployedInstallName, destinationPath, verbose) # Deploy framework if necessary. if dependency.frameworkName not in deploymentInfo.deployedFrameworks: deployFrameworks([dependency], appBundleInfo.path, destinationPath, strip, verbose, deploymentInfo) ap = ArgumentParser(description="""Improved version of macdeployqt. Outputs a ready-to-deploy app in a folder "dist" and optionally wraps it in a .zip file. Note, that the "dist" folder will be deleted before deploying on each run. Optionally, Qt translation files (.qm) can be added to the bundle.""") ap.add_argument("app_bundle", nargs=1, metavar="app-bundle", help="application bundle to be deployed") ap.add_argument("appname", nargs=1, metavar="appname", help="name of the app being deployed") ap.add_argument("-verbose", nargs="?", const=True, help="Output additional debugging information") ap.add_argument("-no-plugins", dest="plugins", action="store_false", default=True, help="skip plugin deployment") ap.add_argument("-no-strip", dest="strip", action="store_false", default=True, help="don't run 'strip' on the binaries") ap.add_argument("-translations-dir", nargs=1, metavar="path", default=None, help="Path to Qt's translations. Base translations will automatically be added to the bundle's resources.") ap.add_argument("-zip", nargs="?", const="", metavar="zip", help="create a .zip containing the app bundle") config = ap.parse_args() verbose = config.verbose # ------------------------------------------------ app_bundle = config.app_bundle[0] appname = config.appname[0] if not os.path.exists(app_bundle): sys.stderr.write(f"Error: Could not find app bundle \"{app_bundle}\"\n") sys.exit(1) # ------------------------------------------------ if os.path.exists("dist"): print("+ Removing existing dist folder +") shutil.rmtree("dist") if os.path.exists(appname + ".zip"): print("+ Removing existing .zip +") os.unlink(appname + ".zip") # ------------------------------------------------ target = os.path.join("dist", "Bitcoin-Qt.app") print("+ Copying source bundle +") if verbose: print(app_bundle, "->", target) os.mkdir("dist") shutil.copytree(app_bundle, target, symlinks=True) applicationBundle = ApplicationBundleInfo(target) # ------------------------------------------------ print("+ Deploying frameworks +") try: deploymentInfo = deployFrameworksForAppBundle(applicationBundle, config.strip, verbose) if deploymentInfo.qtPath is None: deploymentInfo.qtPath = os.getenv("QTDIR", None) if deploymentInfo.qtPath is None: sys.stderr.write("Warning: Could not detect Qt's path, skipping plugin deployment!\n") config.plugins = False except RuntimeError as e: sys.stderr.write(f"Error: {str(e)}\n") sys.exit(1) # ------------------------------------------------ if config.plugins: print("+ Deploying plugins +") try: deployPlugins(applicationBundle, deploymentInfo, config.strip, verbose) except RuntimeError as e: sys.stderr.write(f"Error: {str(e)}\n") sys.exit(1) # ------------------------------------------------ if config.translations_dir: if not Path(config.translations_dir[0]).exists(): sys.stderr.write(f"Error: Could not find translation dir \"{config.translations_dir[0]}\"\n") sys.exit(1) print("+ Adding Qt translations +") translations = Path(config.translations_dir[0]) regex = re.compile('qt_[a-z]*(.qm|_[A-Z]*.qm)') lang_files = [x for x in translations.iterdir() if regex.match(x.name)] for file in lang_files: if verbose: print(file.as_posix(), "->", os.path.join(applicationBundle.resourcesPath, file.name)) shutil.copy2(file.as_posix(), os.path.join(applicationBundle.resourcesPath, file.name)) # ------------------------------------------------ print("+ Installing qt.conf +") qt_conf="""[Paths] Translations=Resources Plugins=PlugIns """ with open(os.path.join(applicationBundle.resourcesPath, "qt.conf"), "wb") as f: f.write(qt_conf.encode()) # ------------------------------------------------ if platform.system() == "Darwin": subprocess.check_call(f"codesign --deep --force --sign - {target}", shell=True) # ------------------------------------------------ if config.zip is not None: shutil.make_archive('{}'.format(appname), format='zip', root_dir='dist', base_dir='Bitcoin-Qt.app') # ------------------------------------------------ print("+ Done +") sys.exit(0)
0
bitcoin/contrib
bitcoin/contrib/macdeploy/gen-sdk
#!/usr/bin/env python3 import argparse import plistlib import pathlib import sys import tarfile import gzip import os import contextlib # monkey-patch Python 3.8 and older to fix wrong TAR header handling # see https://github.com/bitcoin/bitcoin/pull/24534 # and https://github.com/python/cpython/pull/18080 for more info if sys.version_info < (3, 9): _old_create_header = tarfile.TarInfo._create_header def _create_header(info, format, encoding, errors): buf = _old_create_header(info, format, encoding, errors) # replace devmajor/devminor with binary zeroes buf = buf[:329] + bytes(16) + buf[345:] # recompute checksum chksum = tarfile.calc_chksums(buf)[0] buf = buf[:-364] + bytes("%06o\0" % chksum, "ascii") + buf[-357:] return buf tarfile.TarInfo._create_header = staticmethod(_create_header) @contextlib.contextmanager def cd(path): """Context manager that restores PWD even if an exception was raised.""" old_pwd = os.getcwd() os.chdir(str(path)) try: yield finally: os.chdir(old_pwd) def run(): parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('xcode_app', metavar='XCODEAPP', nargs=1) parser.add_argument("-o", metavar='OUTSDKTGZ', nargs=1, dest='out_sdktgz', required=False) args = parser.parse_args() xcode_app = pathlib.Path(args.xcode_app[0]).resolve() assert xcode_app.is_dir(), "The supplied Xcode.app path '{}' either does not exist or is not a directory".format(xcode_app) xcode_app_plist = xcode_app.joinpath("Contents/version.plist") with xcode_app_plist.open('rb') as fp: pl = plistlib.load(fp) xcode_version = pl['CFBundleShortVersionString'] xcode_build_id = pl['ProductBuildVersion'] print("Found Xcode (version: {xcode_version}, build id: {xcode_build_id})".format(xcode_version=xcode_version, xcode_build_id=xcode_build_id)) sdk_dir = xcode_app.joinpath("Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk") sdk_plist = sdk_dir.joinpath("System/Library/CoreServices/SystemVersion.plist") with sdk_plist.open('rb') as fp: pl = plistlib.load(fp) sdk_version = pl['ProductVersion'] sdk_build_id = pl['ProductBuildVersion'] print("Found MacOSX SDK (version: {sdk_version}, build id: {sdk_build_id})".format(sdk_version=sdk_version, sdk_build_id=sdk_build_id)) out_name = "Xcode-{xcode_version}-{xcode_build_id}-extracted-SDK-with-libcxx-headers".format(xcode_version=xcode_version, xcode_build_id=xcode_build_id) if args.out_sdktgz: out_sdktgz_path = pathlib.Path(args.out_sdktgz_path) else: # Construct our own out_sdktgz if not specified on the command line out_sdktgz_path = pathlib.Path("./{}.tar.gz".format(out_name)) def tarfp_add_with_base_change(tarfp, dir_to_add, alt_base_dir): """Add all files in dir_to_add to tarfp, but prepent alt_base_dir to the files' names e.g. if the only file under /root/bazdir is /root/bazdir/qux, invoking: tarfp_add_with_base_change(tarfp, "foo/bar", "/root/bazdir") would result in the following members being added to tarfp: foo/bar/ -> corresponding to /root/bazdir foo/bar/qux -> corresponding to /root/bazdir/qux """ def change_tarinfo_base(tarinfo): if tarinfo.name and tarinfo.name.startswith("./"): tarinfo.name = str(pathlib.Path(alt_base_dir, tarinfo.name)) if tarinfo.linkname and tarinfo.linkname.startswith("./"): tarinfo.linkname = str(pathlib.Path(alt_base_dir, tarinfo.linkname)) # make metadata deterministic tarinfo.mtime = 0 tarinfo.uid, tarinfo.uname = 0, '' tarinfo.gid, tarinfo.gname = 0, '' # don't use isdir() as there are also executable files present tarinfo.mode = 0o0755 if tarinfo.mode & 0o0100 else 0o0644 return tarinfo with cd(dir_to_add): # recursion already adds entries in sorted order tarfp.add(".", recursive=True, filter=change_tarinfo_base) print("Creating output .tar.gz file...") with out_sdktgz_path.open("wb") as fp: with gzip.GzipFile(fileobj=fp, mode='wb', compresslevel=9, mtime=0) as gzf: with tarfile.open(mode="w", fileobj=gzf, format=tarfile.GNU_FORMAT) as tarfp: print("Adding MacOSX SDK {} files...".format(sdk_version)) tarfp_add_with_base_change(tarfp, sdk_dir, out_name) print("Done! Find the resulting gzipped tarball at:") print(out_sdktgz_path.resolve()) if __name__ == '__main__': run()
0
bitcoin/contrib
bitcoin/contrib/debian/copyright
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Bitcoin Upstream-Contact: Satoshi Nakamoto <satoshin@gmx.com> irc://#bitcoin-core-dev@libera.chat Source: https://github.com/bitcoin/bitcoin Files: * Copyright: 2009-2023, Bitcoin Core Developers License: Expat Comment: The Bitcoin Core Developers encompasses all contributors to the project, listed in the release notes or the git log. Files: debian/* Copyright: 2010-2011, Jonas Smedegaard <dr@jones.dk> 2011, Matt Corallo <matt@bluematt.me> License: GPL-2+ Files: src/qt/res/icons/add.png src/qt/res/icons/address-book.png src/qt/res/icons/chevron.png src/qt/res/icons/edit.png src/qt/res/icons/editcopy.png src/qt/res/icons/editpaste.png src/qt/res/icons/export.png src/qt/res/icons/eye.png src/qt/res/icons/history.png src/qt/res/icons/lock_*.png src/qt/res/icons/overview.png src/qt/res/icons/receive.png src/qt/res/icons/remove.png src/qt/res/icons/send.png src/qt/res/icons/synced.png src/qt/res/icons/transaction*.png src/qt/res/icons/tx_output.png src/qt/res/icons/warning.png Copyright: Stephen Hutchings (and more) http://typicons.com License: Expat Comment: Site: https://github.com/stephenhutchings/typicons.font Files: src/qt/res/icons/connect*.png src/qt/res/src/connect-*.svg src/qt/res/icons/network_disabled.png src/qt/res/src/network_disabled.svg Copyright: Marco Falke Luke Dashjr License: Expat Comment: Inspired by Stephen Hutchings' Typicons Files: src/qt/res/icons/tx_mined.png src/qt/res/src/mine.svg src/qt/res/icons/fontbigger.png src/qt/res/icons/fontsmaller.png src/qt/res/icons/hd_disabled.png src/qt/res/src/hd_disabled.svg src/qt/res/icons/hd_enabled.png src/qt/res/src/hd_enabled.svg Copyright: Jonas Schnelli License: Expat Files: src/qt/res/icons/clock*.png src/qt/res/icons/eye_*.png src/qt/res/icons/tx_in*.png src/qt/res/src/clock_*.svg src/qt/res/src/tx_*.svg Copyright: Stephen Hutchings, Jonas Schnelli License: Expat Comment: Modifications of Stephen Hutchings' Typicons Files: src/qt/res/icons/bitcoin.* share/pixmaps/bitcoin* src/qt/res/src/bitcoin.svg Copyright: Bitboy, Jonas Schnelli License: public-domain Comment: Site: https://bitcointalk.org/?topic=1756.0 Files: src/qt/res/icons/proxy.png src/qt/res/src/proxy.svg Copyright: Cristian Mircea Messel License: public-domain Files: src/qt/res/fonts/RobotoMono-Bold.ttf License: Apache-2.0 Comment: Site: https://fonts.google.com/specimen/Roboto+Mono License: Expat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: . The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. . THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Comment: On Debian systems the GNU General Public License (GPL) version 2 is located in '/usr/share/common-licenses/GPL-2'. . You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. License: GPL-3+ Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 3 or any later version published by the Free Software Foundation. Comment: On Debian systems the GNU General Public License (GPL) version 3 is located in '/usr/share/common-licenses/GPL-3'. . You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. License: public-domain This work is in the public domain. License: Apache-2.0 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.
0
bitcoin/contrib
bitcoin/contrib/shell/realpath.bash
#!/usr/bin/env bash # Based on realpath.sh written by Michael Kropat # Found at: https://github.com/mkropat/sh-realpath/blob/65512368b8155b176b67122aa395ac580d9acc5b/realpath.sh bash_realpath() { canonicalize_path "$(resolve_symlinks "$1")" } resolve_symlinks() { _resolve_symlinks "$1" } _resolve_symlinks() { _assert_no_path_cycles "$@" || return local dir_context path if path=$(readlink -- "$1"); then dir_context=$(dirname -- "$1") _resolve_symlinks "$(_prepend_dir_context_if_necessary "$dir_context" "$path")" "$@" else printf '%s\n' "$1" fi } _prepend_dir_context_if_necessary() { if [ "$1" = . ]; then printf '%s\n' "$2" else _prepend_path_if_relative "$1" "$2" fi } _prepend_path_if_relative() { case "$2" in /* ) printf '%s\n' "$2" ;; * ) printf '%s\n' "$1/$2" ;; esac } _assert_no_path_cycles() { local target path target=$1 shift for path in "$@"; do if [ "$path" = "$target" ]; then return 1 fi done } canonicalize_path() { if [ -d "$1" ]; then _canonicalize_dir_path "$1" else _canonicalize_file_path "$1" fi } _canonicalize_dir_path() { (cd "$1" 2>/dev/null && pwd -P) } _canonicalize_file_path() { local dir file dir=$(dirname -- "$1") file=$(basename -- "$1") (cd "$dir" 2>/dev/null && printf '%s/%s\n' "$(pwd -P)" "$file") }
0
bitcoin/contrib
bitcoin/contrib/shell/git-utils.bash
#!/usr/bin/env bash git_root() { git rev-parse --show-toplevel 2> /dev/null } git_head_version() { local recent_tag if recent_tag="$(git describe --exact-match HEAD 2> /dev/null)"; then echo "${recent_tag#v}" else git rev-parse --short=12 HEAD fi }
0
bitcoin/contrib/completions
bitcoin/contrib/completions/bash/bitcoind.bash
# bash programmable completion for bitcoind(1) and bitcoin-qt(1) # Copyright (c) 2012-2022 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. _bitcoind() { local cur prev words=() cword local bitcoind # save and use original argument to invoke bitcoind for -help # it might not be in $PATH bitcoind="$1" COMPREPLY=() _get_comp_words_by_ref -n = cur prev words cword case "$cur" in -conf=*|-pid=*|-loadblock=*|-rpccookiefile=*|-wallet=*) cur="${cur#*=}" _filedir return 0 ;; -datadir=*) cur="${cur#*=}" _filedir -d return 0 ;; -*=*) # prevent nonsense completions return 0 ;; *) # only parse -help if sensible if [[ -z "$cur" || "$cur" =~ ^- ]]; then local helpopts helpopts=$($bitcoind -help 2>&1 | awk '$1 ~ /^-/ { sub(/=.*/, "="); print $1 }' ) COMPREPLY=( $( compgen -W "$helpopts" -- "$cur" ) ) fi # Prevent space if an argument is desired if [[ $COMPREPLY == *= ]]; then compopt -o nospace fi return 0 ;; esac } && complete -F _bitcoind bitcoind bitcoin-qt # Local variables: # mode: shell-script # sh-basic-offset: 4 # sh-indent-comment: t # indent-tabs-mode: nil # End: # ex: ts=4 sw=4 et filetype=sh
0
bitcoin/contrib/completions
bitcoin/contrib/completions/bash/bitcoin-tx.bash
# bash programmable completion for bitcoin-tx(1) # Copyright (c) 2016-2022 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. _bitcoin_tx() { local cur prev words=() cword local bitcoin_tx # save and use original argument to invoke bitcoin-tx for -help # it might not be in $PATH bitcoin_tx="$1" COMPREPLY=() _get_comp_words_by_ref -n =: cur prev words cword case "$cur" in load=*:*) cur="${cur#load=*:}" _filedir return 0 ;; *=*) # prevent attempts to complete other arguments return 0 ;; esac if [[ "$cword" == 1 || ( "$prev" != "-create" && "$prev" == -* ) ]]; then # only options (or an uncompletable hex-string) allowed # parse bitcoin-tx -help for options local helpopts helpopts=$($bitcoin_tx -help | sed -e '/^ -/ p' -e d ) COMPREPLY=( $( compgen -W "$helpopts" -- "$cur" ) ) else # only commands are allowed # parse -help for commands local helpcmds helpcmds=$($bitcoin_tx -help | sed -e '1,/Commands:/d' -e 's/=.*/=/' -e '/^ [a-z]/ p' -e d ) COMPREPLY=( $( compgen -W "$helpcmds" -- "$cur" ) ) fi # Prevent space if an argument is desired if [[ $COMPREPLY == *= ]]; then compopt -o nospace fi return 0 } && complete -F _bitcoin_tx bitcoin-tx # Local variables: # mode: shell-script # sh-basic-offset: 4 # sh-indent-comment: t # indent-tabs-mode: nil # End: # ex: ts=4 sw=4 et filetype=sh
0
bitcoin/contrib/completions
bitcoin/contrib/completions/bash/bitcoin-cli.bash
# bash programmable completion for bitcoin-cli(1) # Copyright (c) 2012-2022 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # call $bitcoin-cli for RPC _bitcoin_rpc() { # determine already specified args necessary for RPC local rpcargs=() for i in ${COMP_LINE}; do case "$i" in -conf=*|-datadir=*|-regtest|-rpc*|-testnet) rpcargs=( "${rpcargs[@]}" "$i" ) ;; esac done $bitcoin_cli "${rpcargs[@]}" "$@" } _bitcoin_cli() { local cur prev words=() cword local bitcoin_cli # save and use original argument to invoke bitcoin-cli for -help, help and RPC # as bitcoin-cli might not be in $PATH bitcoin_cli="$1" COMPREPLY=() _get_comp_words_by_ref -n = cur prev words cword if ((cword > 5)); then case ${words[cword-5]} in sendtoaddress) COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) return 0 ;; esac fi if ((cword > 4)); then case ${words[cword-4]} in importaddress|listtransactions|setban) COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) return 0 ;; signrawtransactionwithkey|signrawtransactionwithwallet) COMPREPLY=( $( compgen -W "ALL NONE SINGLE ALL|ANYONECANPAY NONE|ANYONECANPAY SINGLE|ANYONECANPAY" -- "$cur" ) ) return 0 ;; esac fi if ((cword > 3)); then case ${words[cword-3]} in addmultisigaddress) return 0 ;; getbalance|gettxout|importaddress|importpubkey|importprivkey|listreceivedbyaddress|listsinceblock) COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) return 0 ;; esac fi if ((cword > 2)); then case ${words[cword-2]} in addnode) COMPREPLY=( $( compgen -W "add remove onetry" -- "$cur" ) ) return 0 ;; setban) COMPREPLY=( $( compgen -W "add remove" -- "$cur" ) ) return 0 ;; fundrawtransaction|getblock|getblockheader|getmempoolancestors|getmempooldescendants|getrawtransaction|gettransaction|listreceivedbyaddress|sendrawtransaction) COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) return 0 ;; esac fi case "$prev" in backupwallet|dumpwallet|importwallet) _filedir return 0 ;; getaddednodeinfo|getrawmempool|lockunspent) COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) return 0 ;; getbalance|getnewaddress|listtransactions|sendmany) return 0 ;; esac case "$cur" in -conf=*) cur="${cur#*=}" _filedir return 0 ;; -datadir=*) cur="${cur#*=}" _filedir -d return 0 ;; -*=*) # prevent nonsense completions return 0 ;; *) local helpopts commands # only parse -help if senseful if [[ -z "$cur" || "$cur" =~ ^- ]]; then helpopts=$($bitcoin_cli -help 2>&1 | awk '$1 ~ /^-/ { sub(/=.*/, "="); print $1 }' ) fi # only parse help if senseful if [[ -z "$cur" || "$cur" =~ ^[a-z] ]]; then commands=$(_bitcoin_rpc help 2>/dev/null | awk '$1 ~ /^[a-z]/ { print $1; }') fi COMPREPLY=( $( compgen -W "$helpopts $commands" -- "$cur" ) ) # Prevent space if an argument is desired if [[ $COMPREPLY == *= ]]; then compopt -o nospace fi return 0 ;; esac } && complete -F _bitcoin_cli bitcoin-cli # Local variables: # mode: shell-script # sh-basic-offset: 4 # sh-indent-comment: t # indent-tabs-mode: nil # End: # ex: ts=4 sw=4 et filetype=sh
0