├── .gitignore ├── CMakeLists.txt ├── cmake-bitcoin └── CMakeLists.txt ├── cmake-bitcoind └── CMakeLists.txt ├── cmake-bitcoinr └── CMakeLists.txt ├── cmake-modules ├── FindBerkeleyDB.cmake ├── FindCUDA.cmake ├── FindCUDA │ ├── make2cmake.cmake │ ├── parse_cubin.cmake │ └── run_nvcc.cmake └── FindOpenCL.cmake ├── cmake-rpcminer └── CMakeLists.txt ├── gpl-2.0.txt ├── license.txt ├── readme.txt └── src ├── base58.h ├── bignum.h ├── build-msw.txt ├── build-osx.txt ├── build-unix.txt ├── coding.txt ├── cryptopp ├── License.txt ├── Readme.txt ├── config.h ├── cpu.cpp ├── cpu.h ├── cryptlib.h ├── iterhash.h ├── misc.h ├── obj ├── pch.h ├── secblock.h ├── sha.cpp ├── sha.h ├── simple.h ├── smartptr.h └── stdcpp.h ├── cuda ├── bitcoinminercuda.cpp ├── bitcoinminercuda.cu ├── bitcoinminercuda.h └── cudashared.h ├── db.cpp ├── db.h ├── gpl-2.0.txt ├── gpucommon ├── gpucommon.cpp ├── gpucommon.h └── gpurunner.h ├── headers.h ├── init.cpp ├── init.h ├── irc.cpp ├── irc.h ├── json ├── LICENSE.txt ├── json_spirit.h ├── json_spirit_error_position.h ├── json_spirit_reader.cpp ├── json_spirit_reader.h ├── json_spirit_reader_template.h ├── json_spirit_stream_reader.h ├── json_spirit_utils.h ├── json_spirit_value.cpp ├── json_spirit_value.h ├── json_spirit_writer.cpp ├── json_spirit_writer.h └── json_spirit_writer_template.h ├── key.h ├── license.txt ├── locale ├── de │ └── LC_MESSAGES │ │ ├── bitcoin.mo │ │ └── bitcoin.po ├── es │ └── LC_MESSAGES │ │ ├── bitcoin.mo │ │ └── bitcoin.po ├── fr │ └── LC_MESSAGES │ │ ├── bitcoin.mo │ │ └── bitcoin.po ├── it │ └── LC_MESSAGES │ │ ├── bitcoin.mo │ │ └── bitcoin.po ├── nl │ └── LC_MESSAGES │ │ ├── bitcoin.mo │ │ └── bitcoin.po ├── pt │ └── LC_MESSAGES │ │ ├── bitcoin.mo │ │ └── bitcoin.po ├── readme.txt └── ru │ └── LC_MESSAGES │ ├── bitcoin.mo │ └── bitcoin.po ├── main.cpp ├── main.h ├── makefile.mingw ├── makefile.osx ├── makefile.unix ├── makefile.vc ├── minercommon ├── base64.c ├── base64.h └── minerheaders.h ├── net.cpp ├── net.h ├── noui.h ├── obj └── nogui ├── opencl ├── bitcoinmineropencl.cl ├── bitcoinmineropencl.cpp ├── bitcoinmineropencl.h └── openclshared.h ├── rc ├── addressbook16.bmp ├── addressbook16mask.bmp ├── addressbook20.bmp ├── addressbook20mask.bmp ├── bitcoin-bc.ico ├── bitcoin.ico ├── check.ico ├── favicon.ico ├── send16.bmp ├── send16mask.bmp ├── send16masknoshadow.bmp ├── send20.bmp └── send20mask.bmp ├── remote ├── cuda │ ├── bitcoinminercuda.cpp │ ├── bitcoinminercuda.cu │ ├── bitcoinminercuda.h │ └── cudashared.h ├── opencl │ ├── bitcoinmineropencl.cpp │ ├── bitcoinmineropencl.h │ ├── openclshared.h │ └── remotebitcoinmineropencl.cl ├── remoteminer.cpp ├── remoteminer.h ├── remoteminerclient.cpp ├── remoteminerclient.h ├── remoteminermessage.cpp ├── remoteminermessage.h ├── remoteminerthread.h ├── remoteminerthreadcpu.cpp ├── remoteminerthreadcpu.h ├── remoteminerthreadgpu.cpp ├── remoteminerthreadgpu.h └── timestats.h ├── remoteminermain.cpp ├── rpc.cpp ├── rpc.h ├── rpcminer ├── hex.cpp ├── hex.h ├── httprequest.cpp ├── httprequest.h ├── rpcminerclient.cpp ├── rpcminerclient.h ├── rpcminermain.cpp ├── rpcminerthread.h ├── rpcminerthreadcpu.cpp ├── rpcminerthreadcpu.h ├── rpcminerthreadgpu.cpp ├── rpcminerthreadgpu.h ├── rpcrequest.cpp └── rpcrequest.h ├── script.cpp ├── script.h ├── serialize.h ├── setup.nsi ├── sha256.cpp ├── strlcpy.h ├── ui.cpp ├── ui.h ├── ui.rc ├── uibase.cpp ├── uibase.h ├── uint256.h ├── uiproject.fbp ├── util.cpp ├── util.h ├── winstdint.h └── xpm ├── about.xpm ├── addressbook16.xpm ├── addressbook20.xpm ├── bitcoin16.xpm ├── bitcoin20.xpm ├── bitcoin32.xpm ├── bitcoin48.xpm ├── bitcoin80.xpm ├── check.xpm ├── send16.xpm ├── send16noshadow.xpm └── send20.xpm /.gitignore: -------------------------------------------------------------------------------- 1 | CMakeCache.txt 2 | CMakeFiles/ 3 | Makefile 4 | cmake-bitcoinr/CMakeFiles/ 5 | cmake-bitcoinr/Makefile 6 | cmake-bitcoinr/bitcoinr 7 | cmake-bitcoinr/cmake_install.cmake 8 | cmake-bitcoind/bitcoind 9 | cmake_install.cmake 10 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.8) 2 | 3 | PROJECT(bitcoin) 4 | 5 | OPTION(BITCOIN_ENABLE_CUDA "Enable CUDA miner" OFF) 6 | OPTION(BITCOIN_ENABLE_OPENCL "Enable OpenCL miner" OFF) 7 | OPTION(BITCOIN_ENABLE_REMOTE_SERVER "Enable remote miner server" ON) 8 | OPTION(BITCOIN_BUILD_GUI "Build Server GUI (bitcoin)" OFF) 9 | OPTION(BITCOIN_BUILD_DAEMON "Build Server Daemon (bitcoind)" ON) 10 | OPTION(BITCOIN_BUILD_REMOTE_MINER "Build remote miner (bitcoinr)" ON) 11 | OPTION(BITCOIN_BUILD_RPC_MINER "Build RPC miner (rpcminer)" OFF) 12 | 13 | IF(NOT BITCOIN_ENABLE_CUDA AND NOT BITCOIN_ENABLE_OPENCL) 14 | OPTION(BITCOIN_4WAYSSE2 "Enable 4 Way SSE2 CPU mining" OFF) 15 | ENDIF(NOT BITCOIN_ENABLE_CUDA AND NOT BITCOIN_ENABLE_OPENCL) 16 | 17 | SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake-modules/" ${CMAKE_MODULE_PATH}) 18 | 19 | SET(BITCOIN_BASE_SRC 20 | ${CMAKE_SOURCE_DIR}/src/db.cpp 21 | ${CMAKE_SOURCE_DIR}/src/init.cpp 22 | ${CMAKE_SOURCE_DIR}/src/irc.cpp 23 | ${CMAKE_SOURCE_DIR}/src/main.cpp 24 | ${CMAKE_SOURCE_DIR}/src/net.cpp 25 | ${CMAKE_SOURCE_DIR}/src/rpc.cpp 26 | ${CMAKE_SOURCE_DIR}/src/script.cpp 27 | ${CMAKE_SOURCE_DIR}/src/sha256.cpp 28 | ${CMAKE_SOURCE_DIR}/src/util.cpp 29 | ${CMAKE_SOURCE_DIR}/src/cryptopp/cpu.cpp 30 | ${CMAKE_SOURCE_DIR}/src/cryptopp/sha.cpp 31 | ${CMAKE_SOURCE_DIR}/src/gpucommon/gpucommon.cpp 32 | ${CMAKE_SOURCE_DIR}/src/json/json_spirit_reader.cpp 33 | ${CMAKE_SOURCE_DIR}/src/json/json_spirit_value.cpp 34 | ${CMAKE_SOURCE_DIR}/src/json/json_spirit_writer.cpp 35 | ${CMAKE_SOURCE_DIR}/src/minercommon/base64.c 36 | ${CMAKE_SOURCE_DIR}/src/remote/remoteminer.cpp 37 | ${CMAKE_SOURCE_DIR}/src/remote/remoteminermessage.cpp 38 | ) 39 | 40 | IF(WIN32) 41 | SET(BITCOIN_BASE_SRC ${BITCOIN_BASE_SRC} ${CMAKE_SOURCE_DIR}/src/ui.rc) 42 | ENDIF(WIN32) 43 | 44 | SET(BITCOIN_GUI_SRC 45 | ${CMAKE_SOURCE_DIR}/src/ui.cpp 46 | ${CMAKE_SOURCE_DIR}/src/uibase.cpp 47 | ) 48 | 49 | SET(BITCOIN_CUDA_SRC 50 | ${CMAKE_SOURCE_DIR}/src/cuda/bitcoinminercuda.cpp 51 | ${CMAKE_SOURCE_DIR}/src/cuda/bitcoinminercuda.cu 52 | ) 53 | 54 | SET(BITCOIN_OPENCL_SRC 55 | ${CMAKE_SOURCE_DIR}/src/opencl/bitcoinmineropencl.cpp 56 | ) 57 | 58 | 59 | 60 | IF(BITOIN_ENABLE_CUDA AND BITCOIN_ENABLE_OPENCL) 61 | MESSAGE(FATAL_ERROR "You can only enable CUDA or OpenCL, not both") 62 | ENDIF(BITOIN_ENABLE_CUDA AND BITCOIN_ENABLE_OPENCL) 63 | 64 | IF(NOT BITCOIN_BUILD_GUI AND NOT BITCOIN_BUILD_DAEMON AND NOT BITCOIN_BUILD_REMOTE_MINER AND NOT BITCOIN_BUILD_RPC_MINER) 65 | MESSAGE(FATAL_ERROR "Nothing to build. You must build the GUI, Daemon, Remote Miner, or RPC Miner.") 66 | ENDIF(NOT BITCOIN_BUILD_GUI AND NOT BITCOIN_BUILD_DAEMON AND NOT BITCOIN_BUILD_REMOTE_MINER AND NOT BITCOIN_BUILD_RPC_MINER) 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | # Find all the libraries we will need (Boost, wxWidgets, BDB, OpenSSL, and optionally CUDA or OpenCL) 75 | 76 | # Use Boot module built into CMake 77 | SET(Boost_USE_STATIC_LIBS ON) 78 | SET(Boost_USE_MULTITHREADED ON) 79 | FIND_PACKAGE(Boost REQUIRED date_time filesystem program_options regex system thread) 80 | 81 | IF(Boost_FOUND) 82 | INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) 83 | ENDIF(Boost_FOUND) 84 | 85 | # Use wxWidgets module built into CMake 86 | IF(BITCOIN_BUILD_GUI) 87 | SET(wxWidgets_USE_DEBUG OFF) 88 | SET(wxWidgets_USE_UNICODE ON) 89 | SET(wxWidgets_USE_UNIVERSAL ON) 90 | SET(wxWidgets_USE_STATIC ON) 91 | 92 | FIND_PACKAGE(wxWidgets REQUIRED base core adv html) 93 | 94 | IF(wxWidgets_FOUND) 95 | INCLUDE_DIRECTORIES(${wxWidgets_INCLUDE_DIRS}) 96 | ENDIF(wxWidgets_FOUND) 97 | ENDIF(BITCOIN_BUILD_GUI) 98 | 99 | # Use OpenSSL module built into CMake 100 | FIND_PACKAGE(OpenSSL REQUIRED) 101 | 102 | IF(OPENSSL_FOUND) 103 | INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) 104 | ENDIF(OPENSSL_FOUND) 105 | 106 | # Use BDB local module 107 | FIND_PACKAGE(BerkeleyDB) 108 | 109 | IF(DB_INCLUDE_DIR) 110 | INCLUDE_DIRECTORIES(${DB_INCLUDE_DIR}) 111 | ELSE(DB_INCLUDE_DIR) 112 | MESSAGE(FATAL_ERROR "Could not locate BerkeleyDB") 113 | ENDIF(DB_INCLUDE_DIR) 114 | 115 | # Use fixed CUDA local module (2.8.2 standard one won't work in Windows when declaring WIN32) 116 | IF(BITCOIN_ENABLE_CUDA) 117 | FIND_PACKAGE(CUDA REQUIRED) 118 | IF(CUDA_FOUND) 119 | INCLUDE_DIRECTORIES(${CUDA_INCLUDE_DIRS}) 120 | ENDIF(CUDA_FOUND) 121 | ENDIF(BITCOIN_ENABLE_CUDA) 122 | 123 | # Use OpenCL local module 124 | IF(BITCOIN_ENABLE_OPENCL) 125 | FIND_PACKAGE(OpenCL REQUIRED) 126 | IF(OpenCL_FOUND) 127 | INCLUDE_DIRECTORIES(${OPENCL_INCLUDE_DIR}) 128 | ENDIF(OpenCL_FOUND) 129 | ENDIF(BITCOIN_ENABLE_OPENCL) 130 | 131 | IF(BITCOIN_BUILD_GUI) 132 | ADD_SUBDIRECTORY(cmake-bitcoin) 133 | ENDIF(BITCOIN_BUILD_GUI) 134 | 135 | IF(BITCOIN_BUILD_DAEMON) 136 | ADD_SUBDIRECTORY(cmake-bitcoind) 137 | ENDIF(BITCOIN_BUILD_DAEMON) 138 | 139 | IF(BITCOIN_BUILD_REMOTE_MINER) 140 | ADD_SUBDIRECTORY(cmake-bitcoinr) 141 | ENDIF(BITCOIN_BUILD_REMOTE_MINER) 142 | 143 | IF(BITCOIN_BUILD_RPC_MINER) 144 | ADD_SUBDIRECTORY(cmake-rpcminer) 145 | ENDIF(BITCOIN_BUILD_RPC_MINER) 146 | -------------------------------------------------------------------------------- /cmake-bitcoin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | ADD_DEFINITIONS(-DGUI) 3 | IF(WIN32) 4 | ADD_DEFINITIONS(-D__WXMSW__) 5 | ENDIF(WIN32) 6 | 7 | IF(BITCOIN_ENABLE_CUDA) 8 | ADD_DEFINITIONS(-D_BITCOIN_MINER_CUDA_) 9 | CUDA_ADD_EXECUTABLE(bitcoin WIN32 ${BITCOIN_BASE_SRC} ${BITCOIN_GUI_SRC} ${BITCOIN_CUDA_SRC}) 10 | ELSE(BITCOIN_ENABLE_CUDA) 11 | IF(BITCOIN_ENABLE_OPENCL) 12 | ADD_DEFINITIONS(-D_BITCOIN_MINER_OPENCL_) 13 | ADD_EXECUTABLE(bitcoin WIN32 ${BITCOIN_BASE_SRC} ${BITCOIN_GUI_SRC} ${BITCOIN_OPENCL_SRC}) 14 | ELSE(BITCOIN_ENABLE_OPENCL) 15 | ADD_EXECUTABLE(bitcoin WIN32 ${BITCOIN_BASE_SRC} ${BITCOIN_GUI_SRC}) 16 | ENDIF(BITCOIN_ENABLE_OPENCL) 17 | ENDIF(BITCOIN_ENABLE_CUDA) 18 | 19 | IF(BITCOIN_ENABLE_REMOTE_SERVER) 20 | ADD_DEFINITIONS(-D_BITCOIN_MINER_REMOTE_) 21 | IF(WIN32) 22 | ADD_DEFINITIONS(-DFD_SETSIZE=1024) 23 | ENDIF(WIN32) 24 | ENDIF(BITCOIN_ENABLE_REMOTE_SERVER) 25 | 26 | TARGET_LINK_LIBRARIES(bitcoin ${Boost_LIBRARIES} ${wxWidgets_LIBRARIES} ${OPENSSL_LIBRARIES} ${DB_LIBRARIES}) 27 | IF(BITCOIN_ENABLE_CUDA) 28 | TARGET_LINK_LIBRARIES(bitcoin ${CUDA_LIBRARIES}) 29 | ENDIF(BITCOIN_ENABLE_CUDA) 30 | IF(BITCOIN_ENABLE_OPENCL) 31 | TARGET_LINK_LIBRARIES(bitcoin ${OPENCL_LIBRARY}) 32 | ENDIF(BITCOIN_ENABLE_OPENCL) 33 | IF(WIN32) 34 | TARGET_LINK_LIBRARIES(bitcoin winmm.lib shlwapi.lib) 35 | ENDIF(WIN32) 36 | -------------------------------------------------------------------------------- /cmake-bitcoind/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | IF(WIN32) 3 | ADD_DEFINITIONS(-D__WXMSW__) 4 | ENDIF(WIN32) 5 | 6 | IF(BITCOIN_ENABLE_CUDA) 7 | ADD_DEFINITIONS(-D_BITCOIN_MINER_CUDA_) 8 | CUDA_ADD_EXECUTABLE(bitcoind ${BITCOIN_BASE_SRC} ${BITCOIN_CUDA_SRC}) 9 | ELSE(BITCOIN_ENABLE_CUDA) 10 | IF(BITCOIN_ENABLE_OPENCL) 11 | ADD_DEFINITIONS(-D_BITCOIN_MINER_OPENCL_) 12 | ADD_EXECUTABLE(bitcoind ${BITCOIN_BASE_SRC} ${BITCOIN_OPENCL_SRC}) 13 | ELSE(BITCOIN_ENABLE_OPENCL) 14 | ADD_EXECUTABLE(bitcoind ${BITCOIN_BASE_SRC}) 15 | ENDIF(BITCOIN_ENABLE_OPENCL) 16 | ENDIF(BITCOIN_ENABLE_CUDA) 17 | 18 | IF(BITCOIN_ENABLE_REMOTE_SERVER) 19 | ADD_DEFINITIONS(-D_BITCOIN_MINER_REMOTE_) 20 | IF(WIN32) 21 | ADD_DEFINITIONS(-DFD_SETSIZE=1024) 22 | ENDIF(WIN32) 23 | ENDIF(BITCOIN_ENABLE_REMOTE_SERVER) 24 | 25 | TARGET_LINK_LIBRARIES(bitcoind ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${DB_LIBRARIES}) 26 | IF(BITCOIN_ENABLE_CUDA) 27 | TARGET_LINK_LIBRARIES(bitcoind ${CUDA_LIBRARIES}) 28 | ENDIF(BITCOIN_ENABLE_CUDA) 29 | IF(BITCOIN_ENABLE_OPENCL) 30 | TARGET_LINK_LIBRARIES(bitcoind ${OPENCL_LIBRARY}) 31 | ENDIF(BITCOIN_ENABLE_OPENCL) 32 | IF(WIN32) 33 | TARGET_LINK_LIBRARIES(bitcoind winmm.lib shlwapi.lib) 34 | ENDIF(WIN32) 35 | -------------------------------------------------------------------------------- /cmake-bitcoinr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | IF(WIN32) 3 | ADD_DEFINITIONS(-D__WXMSW__) 4 | ENDIF(WIN32) 5 | 6 | # omit buffer security checkes, increases hashing speed, only available with >= MSVC2005 7 | IF(MSVC80 OR MSVC90 OR MSVC10) 8 | ADD_DEFINITIONS(/GS-) 9 | ENDIF(MSVC80 OR MSVC90 OR MSVC10) 10 | 11 | IF(BITCOIN_4WAYSSE2) 12 | ADD_DEFINITIONS(-DFOURWAYSSE2) 13 | IF(MSVC) 14 | ADD_DEFINITIONS(/arch:SSE2) 15 | ENDIF(MSVC) 16 | ENDIF(BITCOIN_4WAYSSE2) 17 | 18 | SET(BITCOIN_REMOTE_MINER_SRC 19 | ${CMAKE_SOURCE_DIR}/src/remoteminermain.cpp 20 | ${CMAKE_SOURCE_DIR}/src/cryptopp/cpu.cpp 21 | ${CMAKE_SOURCE_DIR}/src/cryptopp/sha.cpp 22 | ${CMAKE_SOURCE_DIR}/src/json/json_spirit_reader.cpp 23 | ${CMAKE_SOURCE_DIR}/src/json/json_spirit_value.cpp 24 | ${CMAKE_SOURCE_DIR}/src/json/json_spirit_writer.cpp 25 | ${CMAKE_SOURCE_DIR}/src/minercommon/base64.c 26 | ${CMAKE_SOURCE_DIR}/src/remote/remoteminerclient.cpp 27 | ${CMAKE_SOURCE_DIR}/src/remote/remoteminermessage.cpp 28 | ${CMAKE_SOURCE_DIR}/src/remote/remoteminerthreadcpu.cpp 29 | ) 30 | 31 | SET(BITCOIN_REMOTE_MINER_CUDA_SRC 32 | ${CMAKE_SOURCE_DIR}/src/remote/remoteminerthreadgpu.cpp 33 | ${CMAKE_SOURCE_DIR}/src/remote/cuda/bitcoinminercuda.cpp 34 | ${CMAKE_SOURCE_DIR}/src/remote/cuda/bitcoinminercuda.cu 35 | ) 36 | 37 | SET(BITCOIN_REMOTE_MINER_OPENCL_SRC 38 | ${CMAKE_SOURCE_DIR}/src/remote/remoteminerthreadgpu.cpp 39 | ${CMAKE_SOURCE_DIR}/src/remote/opencl/bitcoinmineropencl.cpp 40 | ) 41 | 42 | IF(BITCOIN_ENABLE_CUDA) 43 | ADD_DEFINITIONS(-D_BITCOIN_MINER_CUDA_) 44 | CUDA_ADD_EXECUTABLE(bitcoinr WIN32 ${BITCOIN_REMOTE_MINER_SRC} ${BITCOIN_REMOTE_MINER_CUDA_SRC}) 45 | ELSE(BITCOIN_ENABLE_CUDA) 46 | IF(BITCOIN_ENABLE_OPENCL) 47 | ADD_DEFINITIONS(-D_BITCOIN_MINER_OPENCL_) 48 | ADD_EXECUTABLE(bitcoinr ${BITCOIN_REMOTE_MINER_SRC} ${BITCOIN_REMOTE_MINER_OPENCL_SRC}) 49 | ELSE(BITCOIN_ENABLE_OPENCL) 50 | ADD_EXECUTABLE(bitcoinr ${BITCOIN_REMOTE_MINER_SRC}) 51 | ENDIF(BITCOIN_ENABLE_OPENCL) 52 | ENDIF(BITCOIN_ENABLE_CUDA) 53 | 54 | TARGET_LINK_LIBRARIES(bitcoinr ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES}) 55 | IF(WIN32) 56 | TARGET_LINK_LIBRARIES(bitcoinr winmm.lib shlwapi.lib) 57 | ELSE(WIN32) 58 | TARGET_LINK_LIBRARIES(bitcoinr pthread) 59 | ENDIF(WIN32) 60 | 61 | IF(BITCOIN_ENABLE_CUDA) 62 | TARGET_LINK_LIBRARIES(bitcoinr ${CUDA_LIBRARIES}) 63 | ENDIF(BITCOIN_ENABLE_CUDA) 64 | 65 | IF(BITCOIN_ENABLE_OPENCL) 66 | TARGET_LINK_LIBRARIES(bitcoinr ${OPENCL_LIBRARY}) 67 | ENDIF(BITCOIN_ENABLE_OPENCL) 68 | -------------------------------------------------------------------------------- /cmake-modules/FindBerkeleyDB.cmake: -------------------------------------------------------------------------------- 1 | # -*- cmake -*- 2 | 3 | # - Find BerkeleyDB 4 | # Find the BerkeleyDB includes and library 5 | # This module defines 6 | # DB_INCLUDE_DIR, where to find db.h, etc. 7 | # DB_LIBRARIES, the libraries needed to use BerkeleyDB. 8 | # DB_FOUND, If false, do not try to use BerkeleyDB. 9 | # also defined, but not for general use are 10 | # DB_LIBRARY, where to find the BerkeleyDB library. 11 | 12 | FIND_PATH(DB_INCLUDE_DIR db.h 13 | /usr/local/include/db4 14 | /usr/local/include 15 | /usr/include/db4 16 | /usr/include 17 | ) 18 | 19 | SET(DB_NAMES ${DB_NAMES} db) 20 | FIND_LIBRARY(DB_LIBRARY 21 | NAMES ${DB_NAMES} 22 | PATHS /usr/lib /usr/local/lib 23 | ) 24 | 25 | IF (DB_LIBRARY AND DB_INCLUDE_DIR) 26 | SET(DB_LIBRARIES ${DB_LIBRARY}) 27 | SET(DB_FOUND "YES") 28 | ELSE (DB_LIBRARY AND DB_INCLUDE_DIR) 29 | SET(DB_FOUND "NO") 30 | ENDIF (DB_LIBRARY AND DB_INCLUDE_DIR) 31 | 32 | 33 | IF (DB_FOUND) 34 | IF (NOT DB_FIND_QUIETLY) 35 | MESSAGE(STATUS "Found BerkeleyDB: ${DB_LIBRARIES}") 36 | ENDIF (NOT DB_FIND_QUIETLY) 37 | ELSE (DB_FOUND) 38 | IF (DB_FIND_REQUIRED) 39 | MESSAGE(FATAL_ERROR "Could not find BerkeleyDB library") 40 | ENDIF (DB_FIND_REQUIRED) 41 | ENDIF (DB_FOUND) 42 | 43 | # Deprecated declarations. 44 | SET (NATIVE_DB_INCLUDE_PATH ${DB_INCLUDE_DIR} ) 45 | GET_FILENAME_COMPONENT (NATIVE_DB_LIB_PATH ${DB_LIBRARY} PATH) 46 | 47 | MARK_AS_ADVANCED( 48 | DB_LIBRARY 49 | DB_INCLUDE_DIR 50 | ) 51 | -------------------------------------------------------------------------------- /cmake-modules/FindCUDA/make2cmake.cmake: -------------------------------------------------------------------------------- 1 | # James Bigler, NVIDIA Corp (nvidia.com - jbigler) 2 | # Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html 3 | # 4 | # Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved. 5 | # 6 | # Copyright (c) 2007-2009 7 | # Scientific Computing and Imaging Institute, University of Utah 8 | # 9 | # This code is licensed under the MIT License. See the FindCUDA.cmake script 10 | # for the text of the license. 11 | 12 | # The MIT License 13 | # 14 | # License for the specific language governing rights and limitations under 15 | # Permission is hereby granted, free of charge, to any person obtaining a 16 | # copy of this software and associated documentation files (the "Software"), 17 | # to deal in the Software without restriction, including without limitation 18 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, 19 | # and/or sell copies of the Software, and to permit persons to whom the 20 | # Software is furnished to do so, subject to the following conditions: 21 | # 22 | # The above copyright notice and this permission notice shall be included 23 | # in all copies or substantial portions of the Software. 24 | # 25 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 26 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 28 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 30 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 31 | # DEALINGS IN THE SOFTWARE. 32 | # 33 | 34 | ####################################################################### 35 | # This converts a file written in makefile syntax into one that can be included 36 | # by CMake. 37 | 38 | file(READ ${input_file} depend_text) 39 | 40 | if (${depend_text} MATCHES ".+") 41 | 42 | # message("FOUND DEPENDS") 43 | 44 | # Remember, four backslashes is escaped to one backslash in the string. 45 | string(REGEX REPLACE "\\\\ " " " depend_text ${depend_text}) 46 | 47 | # This works for the nvcc -M generated dependency files. 48 | string(REGEX REPLACE "^.* : " "" depend_text ${depend_text}) 49 | string(REGEX REPLACE "[ \\\\]*\n" ";" depend_text ${depend_text}) 50 | 51 | set(dependency_list "") 52 | 53 | foreach(file ${depend_text}) 54 | 55 | string(REGEX REPLACE "^ +" "" file ${file}) 56 | 57 | if(NOT IS_DIRECTORY ${file}) 58 | # If softlinks start to matter, we should change this to REALPATH. For now we need 59 | # to flatten paths, because nvcc can generate stuff like /bin/../include instead of 60 | # just /include. 61 | get_filename_component(file_absolute "${file}" ABSOLUTE) 62 | list(APPEND dependency_list "${file_absolute}") 63 | endif(NOT IS_DIRECTORY ${file}) 64 | 65 | endforeach(file) 66 | 67 | else() 68 | # message("FOUND NO DEPENDS") 69 | endif() 70 | 71 | # Remove the duplicate entries and sort them. 72 | list(REMOVE_DUPLICATES dependency_list) 73 | list(SORT dependency_list) 74 | 75 | foreach(file ${dependency_list}) 76 | set(cuda_nvcc_depend "${cuda_nvcc_depend} \"${file}\"\n") 77 | endforeach() 78 | 79 | file(WRITE ${output_file} "# Generated by: make2cmake.cmake\nSET(CUDA_NVCC_DEPEND\n ${cuda_nvcc_depend})\n\n") 80 | -------------------------------------------------------------------------------- /cmake-modules/FindCUDA/parse_cubin.cmake: -------------------------------------------------------------------------------- 1 | # James Bigler, NVIDIA Corp (nvidia.com - jbigler) 2 | # Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html 3 | # 4 | # Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved. 5 | # 6 | # Copyright (c) 2007-2009 7 | # Scientific Computing and Imaging Institute, University of Utah 8 | # 9 | # This code is licensed under the MIT License. See the FindCUDA.cmake script 10 | # for the text of the license. 11 | 12 | # The MIT License 13 | # 14 | # License for the specific language governing rights and limitations under 15 | # Permission is hereby granted, free of charge, to any person obtaining a 16 | # copy of this software and associated documentation files (the "Software"), 17 | # to deal in the Software without restriction, including without limitation 18 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, 19 | # and/or sell copies of the Software, and to permit persons to whom the 20 | # Software is furnished to do so, subject to the following conditions: 21 | # 22 | # The above copyright notice and this permission notice shall be included 23 | # in all copies or substantial portions of the Software. 24 | # 25 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 26 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 28 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 30 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 31 | # DEALINGS IN THE SOFTWARE. 32 | # 33 | 34 | ####################################################################### 35 | # Parses a .cubin file produced by nvcc and reports statistics about the file. 36 | 37 | 38 | file(READ ${input_file} file_text) 39 | 40 | if (${file_text} MATCHES ".+") 41 | 42 | # Remember, four backslashes is escaped to one backslash in the string. 43 | string(REGEX REPLACE ";" "\\\\;" file_text ${file_text}) 44 | string(REGEX REPLACE "\ncode" ";code" file_text ${file_text}) 45 | 46 | list(LENGTH file_text len) 47 | 48 | foreach(line ${file_text}) 49 | 50 | # Only look at "code { }" blocks. 51 | if(line MATCHES "^code") 52 | 53 | # Break into individual lines. 54 | string(REGEX REPLACE "\n" ";" line ${line}) 55 | 56 | foreach(entry ${line}) 57 | 58 | # Extract kernel names. 59 | if (${entry} MATCHES "[^g]name = ([^ ]+)") 60 | string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry}) 61 | 62 | # Check to see if the kernel name starts with "_" 63 | set(skip FALSE) 64 | # if (${entry} MATCHES "^_") 65 | # Skip the rest of this block. 66 | # message("Skipping ${entry}") 67 | # set(skip TRUE) 68 | # else (${entry} MATCHES "^_") 69 | message("Kernel: ${entry}") 70 | # endif (${entry} MATCHES "^_") 71 | 72 | endif(${entry} MATCHES "[^g]name = ([^ ]+)") 73 | 74 | # Skip the rest of the block if necessary 75 | if(NOT skip) 76 | 77 | # Registers 78 | if (${entry} MATCHES "reg([ ]+)=([ ]+)([^ ]+)") 79 | string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry}) 80 | message("Registers: ${entry}") 81 | endif() 82 | 83 | # Local memory 84 | if (${entry} MATCHES "lmem([ ]+)=([ ]+)([^ ]+)") 85 | string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry}) 86 | message("Local: ${entry}") 87 | endif() 88 | 89 | # Shared memory 90 | if (${entry} MATCHES "smem([ ]+)=([ ]+)([^ ]+)") 91 | string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry}) 92 | message("Shared: ${entry}") 93 | endif() 94 | 95 | if (${entry} MATCHES "^}") 96 | message("") 97 | endif() 98 | 99 | endif(NOT skip) 100 | 101 | 102 | endforeach(entry) 103 | 104 | endif(line MATCHES "^code") 105 | 106 | endforeach(line) 107 | 108 | else() 109 | # message("FOUND NO DEPENDS") 110 | endif() 111 | 112 | 113 | -------------------------------------------------------------------------------- /cmake-modules/FindOpenCL.cmake: -------------------------------------------------------------------------------- 1 | set(ENV_ATISTREAMSDKROOT $ENV{ATISTREAMSDKROOT}) 2 | if(ENV_ATISTREAMSDKROOT) 3 | find_path( 4 | OPENCL_INCLUDE_DIR 5 | NAMES CL/cl.h OpenCL/cl.h 6 | PATHS $ENV{ATISTREAMSDKROOT}/include 7 | NO_DEFAULT_PATH 8 | ) 9 | 10 | if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") 11 | if(CMAKE_SIZEOF_VOID_P EQUAL 4) 12 | set( 13 | OPENCL_LIB_SEARCH_PATH 14 | ${OPENCL_LIB_SEARCH_PATH} 15 | $ENV{ATISTREAMSDKROOT}/lib/x86 16 | ) 17 | else(CMAKE_SIZEOF_VOID_P EQUAL 4) 18 | set( 19 | OPENCL_LIB_SEARCH_PATH 20 | ${OPENCL_LIB_SEARCH_PATH} 21 | $ENV{ATISTREAMSDKROOT}/lib/x86_64 22 | ) 23 | endif(CMAKE_SIZEOF_VOID_P EQUAL 4) 24 | endif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") 25 | find_library( 26 | OPENCL_LIBRARY 27 | NAMES OpenCL 28 | PATHS ${OPENCL_LIB_SEARCH_PATH} 29 | NO_DEFAULT_PATH 30 | ) 31 | else(ENV_ATISTREAMSDKROOT) 32 | find_path( 33 | OPENCL_INCLUDE_DIR 34 | NAMES CL/cl.h OpenCL/cl.h 35 | ) 36 | 37 | find_library( 38 | OPENCL_LIBRARY 39 | NAMES OpenCL 40 | ) 41 | endif(ENV_ATISTREAMSDKROOT) 42 | 43 | include(FindPackageHandleStandardArgs) 44 | find_package_handle_standard_args( 45 | OPENCL 46 | DEFAULT_MSG 47 | OPENCL_LIBRARY OPENCL_INCLUDE_DIR 48 | ) 49 | 50 | if(OPENCL_FOUND) 51 | set(OPENCL_LIBRARIES ${OPENCL_LIBRARY}) 52 | else(OPENCL_FOUND) 53 | set(OPENCL_LIBRARIES) 54 | endif(OPENCL_FOUND) 55 | 56 | mark_as_advanced( 57 | OPENCL_INCLUDE_DIR 58 | OPENCL_LIBRARY 59 | ) 60 | -------------------------------------------------------------------------------- /cmake-rpcminer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | IF(WIN32) 3 | ADD_DEFINITIONS(-D__WXMSW__) 4 | ENDIF(WIN32) 5 | 6 | # omit buffer security checkes, increases hashing speed, only available with >= MSVC2005 7 | IF(MSVC80 OR MSVC90 OR MSVC10) 8 | ADD_DEFINITIONS(/GS-) 9 | ENDIF(MSVC80 OR MSVC90 OR MSVC10) 10 | 11 | IF(BITCOIN_4WAYSSE2) 12 | ADD_DEFINITIONS(-DFOURWAYSSE2) 13 | IF(MSVC) 14 | ADD_DEFINITIONS(/arch:SSE2) 15 | ENDIF(MSVC) 16 | ENDIF(BITCOIN_4WAYSSE2) 17 | 18 | FIND_PACKAGE(CURL) 19 | 20 | IF(CURL_FOUND) 21 | INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS}) 22 | ENDIF(CURL_FOUND) 23 | 24 | SET(BITCOIN_RPC_MINER_SRC 25 | ${CMAKE_SOURCE_DIR}/src/sha256.cpp 26 | ${CMAKE_SOURCE_DIR}/src/rpcminer/hex.cpp 27 | ${CMAKE_SOURCE_DIR}/src/rpcminer/httprequest.cpp 28 | ${CMAKE_SOURCE_DIR}/src/rpcminer/rpcminerclient.cpp 29 | ${CMAKE_SOURCE_DIR}/src/rpcminer/rpcminermain.cpp 30 | ${CMAKE_SOURCE_DIR}/src/rpcminer/rpcminerthreadcpu.cpp 31 | ${CMAKE_SOURCE_DIR}/src/rpcminer/rpcrequest.cpp 32 | ${CMAKE_SOURCE_DIR}/src/json/json_spirit_reader.cpp 33 | ${CMAKE_SOURCE_DIR}/src/json/json_spirit_value.cpp 34 | ${CMAKE_SOURCE_DIR}/src/json/json_spirit_writer.cpp 35 | ${CMAKE_SOURCE_DIR}/src/minercommon/base64.c 36 | ${CMAKE_SOURCE_DIR}/src/cryptopp/cpu.cpp 37 | ${CMAKE_SOURCE_DIR}/src/cryptopp/sha.cpp 38 | ) 39 | 40 | SET(BITCOIN_RPC_MINER_CUDA_SRC 41 | ${CMAKE_SOURCE_DIR}/src/rpcminer/rpcminerthreadgpu.cpp 42 | ${CMAKE_SOURCE_DIR}/src/cuda/bitcoinminercuda.cpp 43 | ${CMAKE_SOURCE_DIR}/src/cuda/bitcoinminercuda.cu 44 | ) 45 | 46 | SET(BITCOIN_RPC_MINER_OPENCL_SRC 47 | ${CMAKE_SOURCE_DIR}/src/rpcminer/rpcminerthreadgpu.cpp 48 | ${CMAKE_SOURCE_DIR}/src/opencl/bitcoinmineropencl.cpp 49 | ) 50 | 51 | IF(BITCOIN_ENABLE_CUDA) 52 | ADD_DEFINITIONS(-D_BITCOIN_MINER_CUDA_) 53 | CUDA_ADD_EXECUTABLE(rpcminer WIN32 ${BITCOIN_RPC_MINER_SRC} ${BITCOIN_RPC_MINER_CUDA_SRC}) 54 | ELSE(BITCOIN_ENABLE_CUDA) 55 | IF(BITCOIN_ENABLE_OPENCL) 56 | ADD_DEFINITIONS(-D_BITCOIN_MINER_OPENCL_) 57 | ADD_EXECUTABLE(rpcminer ${BITCOIN_RPC_MINER_SRC} ${BITCOIN_RPC_MINER_OPENCL_SRC}) 58 | ELSE(BITCOIN_ENABLE_OPENCL) 59 | ADD_EXECUTABLE(rpcminer ${BITCOIN_RPC_MINER_SRC}) 60 | ENDIF(BITCOIN_ENABLE_OPENCL) 61 | ENDIF(BITCOIN_ENABLE_CUDA) 62 | 63 | TARGET_LINK_LIBRARIES(rpcminer ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${CURL_LIBRARIES}) 64 | IF(WIN32) 65 | TARGET_LINK_LIBRARIES(rpcminer winmm.lib shlwapi.lib) 66 | ELSE(WIN32) 67 | TARGET_LINK_LIBRARIES(rpcminer pthread) 68 | ENDIF(WIN32) 69 | 70 | IF(BITCOIN_ENABLE_CUDA) 71 | TARGET_LINK_LIBRARIES(rpcminer ${CUDA_LIBRARIES}) 72 | ENDIF(BITCOIN_ENABLE_CUDA) 73 | 74 | IF(BITCOIN_ENABLE_OPENCL) 75 | TARGET_LINK_LIBRARIES(rpcminer ${OPENCL_LIBRARY}) 76 | ENDIF(BITCOIN_ENABLE_OPENCL) -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Portions of this software Copyright (c) 2009-2010 Satoshi Nakamoto 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | ****************************************************************************** 22 | 23 | Portions of this software Copyright (C) 2010-2011 puddinpop 24 | 25 | This program is free software; you can redistribute it and/or modify 26 | it under the terms of the GNU General Public License as published by 27 | the Free Software Foundation; either version 2 of the License, or 28 | (at your option) any later version. 29 | 30 | This program is distributed in the hope that it will be useful, 31 | but WITHOUT ANY WARRANTY; without even the implied warranty of 32 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 33 | GNU General Public License for more details. 34 | 35 | You should have received a copy of the GNU General Public License along 36 | with this program; if not, write to the Free Software Foundation, Inc., 37 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -------------------------------------------------------------------------------- /src/build-msw.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2010 Satoshi Nakamoto 2 | Distributed under the MIT/X11 software license, see the accompanying 3 | file license.txt or http://www.opensource.org/licenses/mit-license.php. 4 | This product includes software developed by the OpenSSL Project for use in 5 | the OpenSSL Toolkit (http://www.openssl.org/). This product includes 6 | cryptographic software written by Eric Young (eay@cryptsoft.com). 7 | 8 | 9 | WINDOWS BUILD NOTES 10 | =================== 11 | 12 | Compilers Supported 13 | ------------------- 14 | MinGW GCC (recommended) 15 | http://tdm-gcc.tdragon.net/ has an easy installer. Go back a few versions 16 | for a little older gcc like gcc 4.4.?. 17 | 18 | MSVC 8.0 (2005) SP1 has been tested. Note: MSVC 7.0 and up have a habit of 19 | linking to runtime DLLs that are not installed on XP by default. 20 | 21 | 22 | Dependencies 23 | ------------ 24 | Libraries you need to download separately and build: 25 | 26 | default path download 27 | wxWidgets-2.9 \wxwidgets http://www.wxwidgets.org/downloads/ 28 | OpenSSL \openssl http://www.openssl.org/source/ 29 | Berkeley DB \db http://www.oracle.com/technology/software/products/berkeley-db/index.html 30 | Boost \boost http://www.boost.org/users/download/ 31 | 32 | Their licenses: 33 | wxWidgets LGPL 2.1 with very liberal exceptions 34 | OpenSSL Old BSD license with the problematic advertising requirement 35 | Berkeley DB New BSD license with additional requirement that linked software must be free open source 36 | Boost MIT-like license 37 | 38 | Versions used in this release: 39 | MinGW GCC 3.4.5 40 | wxWidgets 2.9.0 41 | OpenSSL 0.9.8k 42 | Berkeley DB 4.7.25.NC 43 | Boost 1.42.1 44 | 45 | 46 | Notes 47 | ----- 48 | The UI layout is edited with wxFormBuilder. The project file is 49 | uiproject.fbp. It generates uibase.cpp and uibase.h, which define base 50 | classes that do the rote work of constructing all the UI elements. 51 | 52 | The release is built with GCC and then "strip bitcoin.exe" to strip the debug 53 | symbols, which reduces the executable size by about 90%. 54 | 55 | 56 | wxWidgets 57 | --------- 58 | cd \wxwidgets\build\msw 59 | make -f makefile.gcc 60 | or 61 | nmake -f makefile.vc 62 | 63 | 64 | OpenSSL 65 | ------- 66 | If you want to exclude unused optional algorithms, a few patches are required. 67 | (instructions for OpenSSL v0.9.8k) 68 | 69 | Edit engines\e_gmp.c and engines\e_capi.c and add this #ifndef around 70 | the openssl/rsa.h include: 71 | #ifndef OPENSSL_NO_RSA 72 | #include 73 | #endif 74 | 75 | Edit ms\mingw32.bat and replace the Configure line's parameters with this 76 | no-everything list. You have to put this in the batch file because batch 77 | files can't take more than nine command line parameters. 78 | perl Configure mingw threads no-rc2 no-rc4 no-rc5 no-idea no-des no-bf no-cast no-aes no-camellia no-seed no-rsa no-dh 79 | 80 | Also REM out the following line in ms\mingw32.bat after the mingw32-make 81 | line. The build fails after it's already finished building libeay32, which 82 | is all we care about, but the failure aborts the script before it runs 83 | dllwrap to generate libeay32.dll. 84 | REM if errorlevel 1 goto end 85 | 86 | Build 87 | cd \openssl 88 | ms\mingw32.bat 89 | 90 | If you're using MSVC, generate the .lib file 91 | lib /machine:i386 /def:ms\libeay32.def /out:out\libeay32.lib 92 | 93 | 94 | Berkeley DB 95 | ----------- 96 | Using MinGW and MSYS: 97 | cd \db\build_unix 98 | sh ../dist/configure --enable-mingw --enable-cxx 99 | make 100 | 101 | 102 | Boost 103 | ----- 104 | download bjam.exe from 105 | http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=72941 106 | cd \boost 107 | bjam toolset=gcc --build-type=complete stage 108 | or 109 | bjam toolset=msvc --build-type=complete stage 110 | -------------------------------------------------------------------------------- /src/build-unix.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2010 Satoshi Nakamoto 2 | Distributed under the MIT/X11 software license, see the accompanying 3 | file license.txt or http://www.opensource.org/licenses/mit-license.php. 4 | This product includes software developed by the OpenSSL Project for use in 5 | the OpenSSL Toolkit (http://www.openssl.org/). This product includes 6 | cryptographic software written by Eric Young (eay@cryptsoft.com). 7 | 8 | 9 | UNIX BUILD NOTES 10 | ================ 11 | 12 | Dependencies 13 | ------------ 14 | sudo apt-get install build-essential 15 | sudo apt-get install libgtk2.0-dev 16 | sudo apt-get install libssl-dev 17 | sudo apt-get install libdb4.7-dev 18 | sudo apt-get install libdb4.7++-dev 19 | Boost 1.40+: sudo apt-get install libboost-all-dev 20 | or Boost 1.37: sudo apt-get install libboost1.37-dev 21 | 22 | If using Boost 1.37, append -mt to the boost libraries in the makefile. 23 | 24 | We're using wxWidgets 2.9.0, which uses UTF-8. Don't try 2.8, it won't work. 25 | The build hasn't been updated to work with wxWidgets 2.9.1 yet. 26 | 27 | You need to download wxWidgets from http://www.wxwidgets.org/downloads/ 28 | and build it yourself. See the build instructions and configure parameters 29 | below. 30 | 31 | Licenses of statically linked libraries: 32 | wxWidgets LGPL 2.1 with very liberal exceptions 33 | Berkeley DB New BSD license with additional requirement that linked software must be free open source 34 | Boost MIT-like license 35 | 36 | Versions used in this release: 37 | GCC 4.3.3 38 | OpenSSL 0.9.8g 39 | wxWidgets 2.9.0 40 | Berkeley DB 4.7.25.NC 41 | Boost 1.37 42 | 43 | 44 | Notes 45 | ----- 46 | The UI layout is edited with wxFormBuilder. The project file is 47 | uiproject.fbp. It generates uibase.cpp and uibase.h, which define base 48 | classes that do the rote work of constructing all the UI elements. 49 | 50 | The release is built with GCC and then "strip bitcoin" to strip the debug 51 | symbols, which reduces the executable size by about 90%. 52 | 53 | 54 | wxWidgets 55 | --------- 56 | cd /usr/local 57 | tar -xzvf wxWidgets-2.9.0.tar.gz 58 | cd wxWidgets-2.9.0 59 | mkdir buildgtk 60 | cd buildgtk 61 | ../configure --with-gtk --enable-debug --disable-shared --enable-monolithic 62 | make 63 | sudo su 64 | make install 65 | ldconfig 66 | 67 | 68 | Berkeley DB 69 | ----------- 70 | You need Berkeley DB 4.7. Don't use 4.8, the database/log0000* files 71 | are incompatible. If you have to build Berkeley DB yourself: 72 | ../dist/configure --enable-cxx 73 | make 74 | 75 | 76 | Boost 77 | ----- 78 | If you need to build Boost yourself: 79 | sudo su 80 | ./bootstrap.sh 81 | ./bjam install 82 | -------------------------------------------------------------------------------- /src/coding.txt: -------------------------------------------------------------------------------- 1 | Please be consistent with the existing coding style. 2 | 3 | Block style: 4 | 5 | bool Function(char* psz, int n) 6 | { 7 | // Comment summarising what this section of code does 8 | for (int i = 0; i < n; i++) 9 | { 10 | // When something fails, return early 11 | if (!Something()) 12 | return false; 13 | ... 14 | } 15 | 16 | // Success return is usually at the end 17 | return true; 18 | } 19 | 20 | - ANSI/Allman block style 21 | - 4 space indenting, no tabs 22 | - No extra spaces inside parenthesis; please don't do ( this ) 23 | - No space after function names, one space after if, for and while 24 | 25 | Variable names begin with the type in lowercase, like nSomeVariable. 26 | Please don't put the first word of the variable name in lowercase like 27 | someVariable. 28 | 29 | Common types: 30 | n integer number: short, unsigned short, int, unsigned int, 31 | int64, uint64, sometimes char if used as a number 32 | d double, float 33 | f flag 34 | hash uint256 35 | p pointer or array, one p for each level of indirection 36 | psz pointer to null terminated string 37 | str string object 38 | v vector or similar list objects 39 | map map or multimap 40 | set set or multiset 41 | bn CBigNum 42 | -------------------------------------------------------------------------------- /src/cryptopp/License.txt: -------------------------------------------------------------------------------- 1 | Compilation Copyright (c) 1995-2009 by Wei Dai. All rights reserved. 2 | This copyright applies only to this software distribution package 3 | as a compilation, and does not imply a copyright on any particular 4 | file in the package. 5 | 6 | The following files are copyrighted by their respective original authors, 7 | and their use is subject to additional licenses included in these files. 8 | 9 | mars.cpp - Copyright 1998 Brian Gladman. 10 | 11 | All other files in this compilation are placed in the public domain by 12 | Wei Dai and other contributors. 13 | 14 | I would like to thank the following authors for placing their works into 15 | the public domain: 16 | 17 | Joan Daemen - 3way.cpp 18 | Leonard Janke - cast.cpp, seal.cpp 19 | Steve Reid - cast.cpp 20 | Phil Karn - des.cpp 21 | Andrew M. Kuchling - md2.cpp, md4.cpp 22 | Colin Plumb - md5.cpp 23 | Seal Woods - rc6.cpp 24 | Chris Morgan - rijndael.cpp 25 | Paulo Baretto - rijndael.cpp, skipjack.cpp, square.cpp 26 | Richard De Moliner - safer.cpp 27 | Matthew Skala - twofish.cpp 28 | Kevin Springle - camellia.cpp, shacal2.cpp, ttmac.cpp, whrlpool.cpp, ripemd.cpp 29 | 30 | Permission to use, copy, modify, and distribute this compilation for 31 | any purpose, including commercial applications, is hereby granted 32 | without fee, subject to the following restrictions: 33 | 34 | 1. Any copy or modification of this compilation in any form, except 35 | in object code form as part of an application software, must include 36 | the above copyright notice and this license. 37 | 38 | 2. Users of this software agree that any modification or extension 39 | they provide to Wei Dai will be considered public domain and not 40 | copyrighted unless it includes an explicit copyright notice. 41 | 42 | 3. Wei Dai makes no warranty or representation that the operation of the 43 | software in this compilation will be error-free, and Wei Dai is under no 44 | obligation to provide any services, by way of maintenance, update, or 45 | otherwise. THE SOFTWARE AND ANY DOCUMENTATION ARE PROVIDED "AS IS" 46 | WITHOUT EXPRESS OR IMPLIED WARRANTY INCLUDING, BUT NOT LIMITED TO, 47 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 48 | PURPOSE. IN NO EVENT WILL WEI DAI OR ANY OTHER CONTRIBUTOR BE LIABLE FOR 49 | DIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN IF 50 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 51 | 52 | 4. Users will not use Wei Dai or any other contributor's name in any 53 | publicity or advertising, without prior written consent in each case. 54 | 55 | 5. Export of this software from the United States may require a 56 | specific license from the United States Government. It is the 57 | responsibility of any person or organization contemplating export 58 | to obtain such a license before exporting. 59 | 60 | 6. Certain parts of this software may be protected by patents. It 61 | is the users' responsibility to obtain the appropriate 62 | licenses before using those parts. 63 | 64 | If this compilation is used in object code form in an application 65 | software, acknowledgement of the author is not required but would be 66 | appreciated. The contribution of any useful modifications or extensions 67 | to Wei Dai is not required but would also be appreciated. 68 | -------------------------------------------------------------------------------- /src/cryptopp/cpu.cpp: -------------------------------------------------------------------------------- 1 | // cpu.cpp - written and placed in the public domain by Wei Dai 2 | 3 | #include "pch.h" 4 | 5 | #ifndef CRYPTOPP_IMPORTS 6 | 7 | #include "cpu.h" 8 | #include "misc.h" 9 | #include 10 | 11 | #ifdef __GNUC__ 12 | #include 13 | #include 14 | #endif 15 | 16 | #ifdef CRYPTOPP_MSVC6PP_OR_LATER 17 | #include 18 | #endif 19 | 20 | NAMESPACE_BEGIN(CryptoPP) 21 | 22 | #ifdef CRYPTOPP_X86_ASM_AVAILABLE 23 | 24 | #ifndef _MSC_VER 25 | typedef void (*SigHandler)(int); 26 | 27 | static jmp_buf s_jmpNoCPUID; 28 | static void SigIllHandlerCPUID(int) 29 | { 30 | longjmp(s_jmpNoCPUID, 1); 31 | } 32 | #endif 33 | 34 | bool CpuId(word32 input, word32 *output) 35 | { 36 | #ifdef _MSC_VER 37 | __try 38 | { 39 | __asm 40 | { 41 | mov eax, input 42 | cpuid 43 | mov edi, output 44 | mov [edi], eax 45 | mov [edi+4], ebx 46 | mov [edi+8], ecx 47 | mov [edi+12], edx 48 | } 49 | } 50 | __except (1) 51 | { 52 | return false; 53 | } 54 | return true; 55 | #else 56 | SigHandler oldHandler = signal(SIGILL, SigIllHandlerCPUID); 57 | if (oldHandler == SIG_ERR) 58 | return false; 59 | 60 | bool result = true; 61 | if (setjmp(s_jmpNoCPUID)) 62 | result = false; 63 | else 64 | { 65 | __asm__ 66 | ( 67 | // save ebx in case -fPIC is being used 68 | #if CRYPTOPP_BOOL_X86 69 | "push %%ebx; cpuid; mov %%ebx, %%edi; pop %%ebx" 70 | #else 71 | "pushq %%rbx; cpuid; mov %%ebx, %%edi; popq %%rbx" 72 | #endif 73 | : "=a" (output[0]), "=D" (output[1]), "=c" (output[2]), "=d" (output[3]) 74 | : "a" (input) 75 | ); 76 | } 77 | 78 | signal(SIGILL, oldHandler); 79 | return result; 80 | #endif 81 | } 82 | 83 | #ifndef _MSC_VER 84 | static jmp_buf s_jmpNoSSE2; 85 | static void SigIllHandlerSSE2(int) 86 | { 87 | longjmp(s_jmpNoSSE2, 1); 88 | } 89 | #endif 90 | 91 | #elif _MSC_VER >= 1400 && CRYPTOPP_BOOL_X64 92 | 93 | bool CpuId(word32 input, word32 *output) 94 | { 95 | __cpuid((int *)output, input); 96 | return true; 97 | } 98 | 99 | #endif 100 | 101 | #ifdef CRYPTOPP_CPUID_AVAILABLE 102 | 103 | static bool TrySSE2() 104 | { 105 | #if CRYPTOPP_BOOL_X64 106 | return true; 107 | #elif defined(_MSC_VER) 108 | __try 109 | { 110 | #if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 111 | AS2(por xmm0, xmm0) // executing SSE2 instruction 112 | #elif CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 113 | __mm128i x = _mm_setzero_si128(); 114 | return _mm_cvtsi128_si32(x) == 0; 115 | #endif 116 | } 117 | __except (1) 118 | { 119 | return false; 120 | } 121 | return true; 122 | #elif defined(__GNUC__) 123 | SigHandler oldHandler = signal(SIGILL, SigIllHandlerSSE2); 124 | if (oldHandler == SIG_ERR) 125 | return false; 126 | 127 | bool result = true; 128 | if (setjmp(s_jmpNoSSE2)) 129 | result = false; 130 | else 131 | { 132 | #if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 133 | __asm __volatile ("por %xmm0, %xmm0"); 134 | #elif CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 135 | __mm128i x = _mm_setzero_si128(); 136 | result = _mm_cvtsi128_si32(x) == 0; 137 | #endif 138 | } 139 | 140 | signal(SIGILL, oldHandler); 141 | return result; 142 | #else 143 | return false; 144 | #endif 145 | } 146 | 147 | bool g_x86DetectionDone = false; 148 | bool g_hasISSE = false, g_hasSSE2 = false, g_hasSSSE3 = false, g_hasMMX = false, g_isP4 = false; 149 | word32 g_cacheLineSize = CRYPTOPP_L1_CACHE_LINE_SIZE; 150 | 151 | void DetectX86Features() 152 | { 153 | word32 cpuid[4], cpuid1[4]; 154 | if (!CpuId(0, cpuid)) 155 | return; 156 | if (!CpuId(1, cpuid1)) 157 | return; 158 | 159 | g_hasMMX = (cpuid1[3] & (1 << 23)) != 0; 160 | if ((cpuid1[3] & (1 << 26)) != 0) 161 | g_hasSSE2 = TrySSE2(); 162 | g_hasSSSE3 = g_hasSSE2 && (cpuid1[2] & (1<<9)); 163 | 164 | if ((cpuid1[3] & (1 << 25)) != 0) 165 | g_hasISSE = true; 166 | else 167 | { 168 | word32 cpuid2[4]; 169 | CpuId(0x080000000, cpuid2); 170 | if (cpuid2[0] >= 0x080000001) 171 | { 172 | CpuId(0x080000001, cpuid2); 173 | g_hasISSE = (cpuid2[3] & (1 << 22)) != 0; 174 | } 175 | } 176 | 177 | std::swap(cpuid[2], cpuid[3]); 178 | if (memcmp(cpuid+1, "GenuineIntel", 12) == 0) 179 | { 180 | g_isP4 = ((cpuid1[0] >> 8) & 0xf) == 0xf; 181 | g_cacheLineSize = 8 * GETBYTE(cpuid1[1], 1); 182 | } 183 | else if (memcmp(cpuid+1, "AuthenticAMD", 12) == 0) 184 | { 185 | CpuId(0x80000005, cpuid); 186 | g_cacheLineSize = GETBYTE(cpuid[2], 0); 187 | } 188 | 189 | if (!g_cacheLineSize) 190 | g_cacheLineSize = CRYPTOPP_L1_CACHE_LINE_SIZE; 191 | 192 | g_x86DetectionDone = true; 193 | } 194 | 195 | #endif 196 | 197 | NAMESPACE_END 198 | 199 | #endif 200 | -------------------------------------------------------------------------------- /src/cryptopp/iterhash.h: -------------------------------------------------------------------------------- 1 | #ifndef CRYPTOPP_ITERHASH_H 2 | #define CRYPTOPP_ITERHASH_H 3 | 4 | #include "secblock.h" 5 | 6 | NAMESPACE_BEGIN(CryptoPP) 7 | 8 | // *** trimmed down dependency from iterhash.h *** 9 | template 10 | class CRYPTOPP_NO_VTABLE IteratedHashWithStaticTransform 11 | { 12 | public: 13 | CRYPTOPP_CONSTANT(DIGESTSIZE = T_DigestSize ? T_DigestSize : T_StateSize) 14 | unsigned int DigestSize() const {return DIGESTSIZE;}; 15 | typedef T_HashWordType HashWordType; 16 | CRYPTOPP_CONSTANT(BLOCKSIZE = T_BlockSize) 17 | 18 | protected: 19 | IteratedHashWithStaticTransform() {this->Init();} 20 | void HashEndianCorrectedBlock(const T_HashWordType *data) {T_Transform::Transform(this->m_state, data);} 21 | void Init() {T_Transform::InitState(this->m_state);} 22 | 23 | T_HashWordType* StateBuf() {return this->m_state;} 24 | FixedSizeAlignedSecBlock m_state; 25 | }; 26 | 27 | NAMESPACE_END 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/cryptopp/obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/cryptopp/obj -------------------------------------------------------------------------------- /src/cryptopp/pch.h: -------------------------------------------------------------------------------- 1 | #ifndef CRYPTOPP_PCH_H 2 | #define CRYPTOPP_PCH_H 3 | 4 | #ifdef CRYPTOPP_GENERATE_X64_MASM 5 | 6 | #include "cpu.h" 7 | 8 | #else 9 | 10 | #include "config.h" 11 | 12 | #ifdef USE_PRECOMPILED_HEADERS 13 | #include "simple.h" 14 | #include "secblock.h" 15 | #include "misc.h" 16 | #include "smartptr.h" 17 | #endif 18 | 19 | #endif 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/cryptopp/sha.h: -------------------------------------------------------------------------------- 1 | #ifndef CRYPTOPP_SHA_H 2 | #define CRYPTOPP_SHA_H 3 | 4 | #include "iterhash.h" 5 | 6 | NAMESPACE_BEGIN(CryptoPP) 7 | 8 | /// SHA-1 9 | class CRYPTOPP_DLL SHA1 : public IteratedHashWithStaticTransform 10 | { 11 | public: 12 | static void CRYPTOPP_API InitState(HashWordType *state); 13 | static void CRYPTOPP_API Transform(word32 *digest, const word32 *data); 14 | static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-1";} 15 | }; 16 | 17 | typedef SHA1 SHA; // for backwards compatibility 18 | 19 | //! implements the SHA-256 standard 20 | class CRYPTOPP_DLL SHA256 : public IteratedHashWithStaticTransform 21 | { 22 | public: 23 | #if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE) 24 | size_t HashMultipleBlocks(const word32 *input, size_t length); 25 | #endif 26 | static void CRYPTOPP_API InitState(HashWordType *state); 27 | static void CRYPTOPP_API Transform(word32 *digest, const word32 *data); 28 | static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-256";} 29 | }; 30 | 31 | //! implements the SHA-224 standard 32 | class CRYPTOPP_DLL SHA224 : public IteratedHashWithStaticTransform 33 | { 34 | public: 35 | #if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE) 36 | size_t HashMultipleBlocks(const word32 *input, size_t length); 37 | #endif 38 | static void CRYPTOPP_API InitState(HashWordType *state); 39 | static void CRYPTOPP_API Transform(word32 *digest, const word32 *data) {SHA256::Transform(digest, data);} 40 | static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-224";} 41 | }; 42 | 43 | //! implements the SHA-512 standard 44 | class CRYPTOPP_DLL SHA512 : public IteratedHashWithStaticTransform 45 | { 46 | public: 47 | static void CRYPTOPP_API InitState(HashWordType *state); 48 | static void CRYPTOPP_API Transform(word64 *digest, const word64 *data); 49 | static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-512";} 50 | }; 51 | 52 | //! implements the SHA-384 standard 53 | class CRYPTOPP_DLL SHA384 : public IteratedHashWithStaticTransform 54 | { 55 | public: 56 | static void CRYPTOPP_API InitState(HashWordType *state); 57 | static void CRYPTOPP_API Transform(word64 *digest, const word64 *data) {SHA512::Transform(digest, data);} 58 | static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-384";} 59 | }; 60 | 61 | NAMESPACE_END 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/cryptopp/simple.h: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/cryptopp/smartptr.h: -------------------------------------------------------------------------------- 1 | #ifndef CRYPTOPP_SMARTPTR_H 2 | #define CRYPTOPP_SMARTPTR_H 3 | 4 | #include "config.h" 5 | #include 6 | 7 | NAMESPACE_BEGIN(CryptoPP) 8 | 9 | template class simple_ptr 10 | { 11 | public: 12 | simple_ptr() : m_p(NULL) {} 13 | ~simple_ptr() {delete m_p;} 14 | T *m_p; 15 | }; 16 | 17 | template class member_ptr 18 | { 19 | public: 20 | explicit member_ptr(T *p = NULL) : m_p(p) {} 21 | 22 | ~member_ptr(); 23 | 24 | const T& operator*() const { return *m_p; } 25 | T& operator*() { return *m_p; } 26 | 27 | const T* operator->() const { return m_p; } 28 | T* operator->() { return m_p; } 29 | 30 | const T* get() const { return m_p; } 31 | T* get() { return m_p; } 32 | 33 | T* release() 34 | { 35 | T *old_p = m_p; 36 | m_p = 0; 37 | return old_p; 38 | } 39 | 40 | void reset(T *p = 0); 41 | 42 | protected: 43 | member_ptr(const member_ptr& rhs); // copy not allowed 44 | void operator=(const member_ptr& rhs); // assignment not allowed 45 | 46 | T *m_p; 47 | }; 48 | 49 | template member_ptr::~member_ptr() {delete m_p;} 50 | template void member_ptr::reset(T *p) {delete m_p; m_p = p;} 51 | 52 | // ******************************************************** 53 | 54 | template class value_ptr : public member_ptr 55 | { 56 | public: 57 | value_ptr(const T &obj) : member_ptr(new T(obj)) {} 58 | value_ptr(T *p = NULL) : member_ptr(p) {} 59 | value_ptr(const value_ptr& rhs) 60 | : member_ptr(rhs.m_p ? new T(*rhs.m_p) : NULL) {} 61 | 62 | value_ptr& operator=(const value_ptr& rhs); 63 | bool operator==(const value_ptr& rhs) 64 | { 65 | return (!this->m_p && !rhs.m_p) || (this->m_p && rhs.m_p && *this->m_p == *rhs.m_p); 66 | } 67 | }; 68 | 69 | template value_ptr& value_ptr::operator=(const value_ptr& rhs) 70 | { 71 | T *old_p = this->m_p; 72 | this->m_p = rhs.m_p ? new T(*rhs.m_p) : NULL; 73 | delete old_p; 74 | return *this; 75 | } 76 | 77 | // ******************************************************** 78 | 79 | template class clonable_ptr : public member_ptr 80 | { 81 | public: 82 | clonable_ptr(const T &obj) : member_ptr(obj.Clone()) {} 83 | clonable_ptr(T *p = NULL) : member_ptr(p) {} 84 | clonable_ptr(const clonable_ptr& rhs) 85 | : member_ptr(rhs.m_p ? rhs.m_p->Clone() : NULL) {} 86 | 87 | clonable_ptr& operator=(const clonable_ptr& rhs); 88 | }; 89 | 90 | template clonable_ptr& clonable_ptr::operator=(const clonable_ptr& rhs) 91 | { 92 | T *old_p = this->m_p; 93 | this->m_p = rhs.m_p ? rhs.m_p->Clone() : NULL; 94 | delete old_p; 95 | return *this; 96 | } 97 | 98 | // ******************************************************** 99 | 100 | template class counted_ptr 101 | { 102 | public: 103 | explicit counted_ptr(T *p = 0); 104 | counted_ptr(const T &r) : m_p(0) {attach(r);} 105 | counted_ptr(const counted_ptr& rhs); 106 | 107 | ~counted_ptr(); 108 | 109 | const T& operator*() const { return *m_p; } 110 | T& operator*() { return *m_p; } 111 | 112 | const T* operator->() const { return m_p; } 113 | T* operator->() { return get(); } 114 | 115 | const T* get() const { return m_p; } 116 | T* get(); 117 | 118 | void attach(const T &p); 119 | 120 | counted_ptr & operator=(const counted_ptr& rhs); 121 | 122 | private: 123 | T *m_p; 124 | }; 125 | 126 | template counted_ptr::counted_ptr(T *p) 127 | : m_p(p) 128 | { 129 | if (m_p) 130 | m_p->m_referenceCount = 1; 131 | } 132 | 133 | template counted_ptr::counted_ptr(const counted_ptr& rhs) 134 | : m_p(rhs.m_p) 135 | { 136 | if (m_p) 137 | m_p->m_referenceCount++; 138 | } 139 | 140 | template counted_ptr::~counted_ptr() 141 | { 142 | if (m_p && --m_p->m_referenceCount == 0) 143 | delete m_p; 144 | } 145 | 146 | template void counted_ptr::attach(const T &r) 147 | { 148 | if (m_p && --m_p->m_referenceCount == 0) 149 | delete m_p; 150 | if (r.m_referenceCount == 0) 151 | { 152 | m_p = r.clone(); 153 | m_p->m_referenceCount = 1; 154 | } 155 | else 156 | { 157 | m_p = const_cast(&r); 158 | m_p->m_referenceCount++; 159 | } 160 | } 161 | 162 | template T* counted_ptr::get() 163 | { 164 | if (m_p && m_p->m_referenceCount > 1) 165 | { 166 | T *temp = m_p->clone(); 167 | m_p->m_referenceCount--; 168 | m_p = temp; 169 | m_p->m_referenceCount = 1; 170 | } 171 | return m_p; 172 | } 173 | 174 | template counted_ptr & counted_ptr::operator=(const counted_ptr& rhs) 175 | { 176 | if (m_p != rhs.m_p) 177 | { 178 | if (m_p && --m_p->m_referenceCount == 0) 179 | delete m_p; 180 | m_p = rhs.m_p; 181 | if (m_p) 182 | m_p->m_referenceCount++; 183 | } 184 | return *this; 185 | } 186 | 187 | // ******************************************************** 188 | 189 | template class vector_member_ptrs 190 | { 191 | public: 192 | vector_member_ptrs(size_t size=0) 193 | : m_size(size), m_ptr(new member_ptr[size]) {} 194 | ~vector_member_ptrs() 195 | {delete [] this->m_ptr;} 196 | 197 | member_ptr& operator[](size_t index) 198 | {assert(indexm_size); return this->m_ptr[index];} 199 | const member_ptr& operator[](size_t index) const 200 | {assert(indexm_size); return this->m_ptr[index];} 201 | 202 | size_t size() const {return this->m_size;} 203 | void resize(size_t newSize) 204 | { 205 | member_ptr *newPtr = new member_ptr[newSize]; 206 | for (size_t i=0; im_size && im_ptr[i].release()); 208 | delete [] this->m_ptr; 209 | this->m_size = newSize; 210 | this->m_ptr = newPtr; 211 | } 212 | 213 | private: 214 | vector_member_ptrs(const vector_member_ptrs &c); // copy not allowed 215 | void operator=(const vector_member_ptrs &x); // assignment not allowed 216 | 217 | size_t m_size; 218 | member_ptr *m_ptr; 219 | }; 220 | 221 | NAMESPACE_END 222 | 223 | #endif 224 | -------------------------------------------------------------------------------- /src/cryptopp/stdcpp.h: -------------------------------------------------------------------------------- 1 | #ifndef CRYPTOPP_STDCPP_H 2 | #define CRYPTOPP_STDCPP_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | 13 | #ifdef _MSC_VER 14 | #include // CodeWarrior doesn't have memory.h 15 | #include 16 | #include 17 | #include 18 | 19 | // re-disable this 20 | #pragma warning(disable: 4231) 21 | #endif 22 | 23 | #if defined(_MSC_VER) && defined(_CRTAPI1) 24 | #define CRYPTOPP_MSVCRT6 25 | #endif 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/cuda/bitcoinminercuda.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifdef _BITCOIN_MINER_CUDA_ 20 | 21 | #define NOMINMAX 22 | 23 | #include "bitcoinminercuda.h" 24 | #include "cudashared.h" 25 | #include "../cryptopp/sha.h" // for CryptoPP::ByteReverse 26 | #include 27 | #include 28 | 29 | CUDARunner::CUDARunner():GPURunner(TYPE_CUDA) 30 | { 31 | m_in=0; 32 | m_devin=0; 33 | m_out=0; 34 | m_devout=0; 35 | 36 | cutilSafeCall(cudaGetDeviceCount(&m_devicecount)); 37 | 38 | if(m_devicecount>0) 39 | { 40 | if(m_deviceindex<0 || m_deviceindex>=m_devicecount) 41 | { 42 | m_deviceindex=cutGetMaxGflopsDeviceId(); 43 | printf("Setting CUDA device to Max GFlops device at index %u\n",m_deviceindex); 44 | } 45 | else 46 | { 47 | printf("Setting CUDA device to device at index %u\n",m_deviceindex); 48 | } 49 | 50 | cudaDeviceProp props; 51 | cudaGetDeviceProperties(&props,m_deviceindex); 52 | 53 | printf("Device info for %s :\nCompute Capability : %d.%d\nClock Rate (hz) : %d\n",props.name,props.major,props.minor,props.clockRate); 54 | 55 | if(props.major>999) 56 | { 57 | printf("CUDA seems to be running in CPU emulation mode\n"); 58 | } 59 | 60 | cutilSafeCall(cudaSetDevice(m_deviceindex)); 61 | 62 | } 63 | else 64 | { 65 | m_deviceindex=-1; 66 | printf("No CUDA capable device detected\n"); 67 | } 68 | } 69 | 70 | CUDARunner::~CUDARunner() 71 | { 72 | DeallocateResources(); 73 | cutilSafeCall(cudaThreadExit()); 74 | } 75 | 76 | void CUDARunner::AllocateResources(const int numb, const int numt) 77 | { 78 | DeallocateResources(); 79 | 80 | m_in=(cuda_in *)malloc(sizeof(cuda_in)); 81 | m_out=(cuda_out *)malloc(numb*numt*sizeof(cuda_out)); 82 | 83 | cutilSafeCall(cudaMalloc((void **)&m_devin,sizeof(cuda_in))); 84 | cutilSafeCall(cudaMalloc((void **)&m_devout,numb*numt*sizeof(cuda_out))); 85 | 86 | printf("Done allocating CUDA resources for (%d,%d)\n",numb,numt); 87 | } 88 | 89 | void CUDARunner::DeallocateResources() 90 | { 91 | if(m_in) 92 | { 93 | free(m_in); 94 | m_in=0; 95 | } 96 | if(m_devin) 97 | { 98 | cutilSafeCall(cudaFree(m_devin)); 99 | m_devin=0; 100 | } 101 | if(m_out) 102 | { 103 | free(m_out); 104 | m_out=0; 105 | } 106 | if(m_devout) 107 | { 108 | cutilSafeCall(cudaFree(m_devout)); 109 | m_devout=0; 110 | } 111 | } 112 | 113 | void CUDARunner::FindBestConfiguration() 114 | { 115 | unsigned long lowb=16; 116 | unsigned long highb=128; 117 | unsigned long lowt=16; 118 | unsigned long hight=256; 119 | unsigned long bestb=16; 120 | unsigned long bestt=16; 121 | int64 besttime=std::numeric_limits::max(); 122 | 123 | if(m_requestedgrid>0 && m_requestedgrid<=65536) 124 | { 125 | lowb=m_requestedgrid; 126 | highb=m_requestedgrid; 127 | } 128 | 129 | if(m_requestedthreads>0 && m_requestedthreads<=65536) 130 | { 131 | lowt=m_requestedthreads; 132 | hight=m_requestedthreads; 133 | } 134 | 135 | for(int numb=lowb; numb<=highb; numb*=2) 136 | { 137 | for(int numt=lowt; numt<=hight; numt*=2) 138 | { 139 | AllocateResources(numb,numt); 140 | // clear out any existing error 141 | cudaError_t err=cudaGetLastError(); 142 | err=cudaSuccess; 143 | 144 | int64 st=GetTimeMillis(); 145 | 146 | for(int it=0; it<128*256*2 && err==0; it+=(numb*numt)) 147 | { 148 | cutilSafeCall(cudaMemcpy(m_devin,m_in,sizeof(cuda_in),cudaMemcpyHostToDevice)); 149 | 150 | cuda_process_helper(m_devin,m_devout,64,6,numb,numt); 151 | 152 | cutilSafeCall(cudaMemcpy(m_out,m_devout,numb*numt*sizeof(cuda_out),cudaMemcpyDeviceToHost)); 153 | 154 | err=cudaGetLastError(); 155 | if(err!=cudaSuccess) 156 | { 157 | printf("CUDA error %d\n",err); 158 | } 159 | } 160 | 161 | int64 et=GetTimeMillis(); 162 | 163 | printf("Finding best configuration step end (%d,%d) %"PRI64d"ms prev best=%"PRI64d"ms\n",numb,numt,et-st,besttime); 164 | 165 | if((et-st) 28 | { 29 | public: 30 | CUDARunner(); 31 | ~CUDARunner(); 32 | 33 | void FindBestConfiguration(); 34 | 35 | const unsigned long RunStep(); 36 | 37 | cuda_in *GetIn() { return m_in; } 38 | 39 | private: 40 | void DeallocateResources(); 41 | void AllocateResources(const int numb, const int numt); 42 | 43 | cuda_in *m_in; 44 | cuda_in *m_devin; 45 | cuda_out *m_out; 46 | cuda_out *m_devout; 47 | 48 | }; 49 | 50 | #endif // _BITCOIN_MINER_CUDA_ 51 | 52 | #endif // _bitcoin_miner_cuda_ 53 | -------------------------------------------------------------------------------- /src/cuda/cudashared.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _cuda_shared_ 20 | #define _cuda_shared_ 21 | 22 | #ifdef _BITCOIN_MINER_CUDA_ 23 | 24 | typedef struct 25 | { 26 | unsigned int m_AH[8]; 27 | unsigned int m_merkle; 28 | unsigned int m_ntime; 29 | unsigned int m_nbits; 30 | unsigned int m_nonce; 31 | }cuda_in; 32 | 33 | typedef struct 34 | { 35 | unsigned int m_bestnonce; 36 | unsigned int m_bestg; 37 | }cuda_out; 38 | 39 | void cuda_process_helper(cuda_in *in, cuda_out *out, const unsigned int loops, const unsigned int bits, const int grid, const int threads); 40 | 41 | #endif // _BITCOIN_MINER_CUDA_ 42 | 43 | #endif // _cuda_shared_ 44 | -------------------------------------------------------------------------------- /src/gpucommon/gpucommon.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _gpu_common_ 20 | #define _gpu_common_ 21 | 22 | #include "../headers.h" 23 | #include "gpurunner.h" 24 | 25 | #include 26 | 27 | int FormatHashBlocks(void* pbuffer, unsigned int len); 28 | unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast); 29 | void SHA256Transform(void* pstate, void* pinput, const void* pinit); 30 | bool ProcessBlock(CNode* pfrom, CBlock* pblock); 31 | 32 | extern CCriticalSection cs_mapTransactions; 33 | 34 | void ThreadBitcoinMinerGPU(void* parg); 35 | void BitcoinMinerGPU(); 36 | 37 | #endif // _gpu_common_ 38 | -------------------------------------------------------------------------------- /src/gpucommon/gpurunner.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _bitcoin_gpu_runner_ 20 | #define _bitcoin_gpu_runner_ 21 | 22 | #include "../minercommon/minerheaders.h" 23 | 24 | template 25 | class GPURunner 26 | { 27 | public: 28 | GPURunner(const int type=TYPE_NONE); 29 | virtual ~GPURunner(); 30 | 31 | typedef STEPTYPE StepType; 32 | 33 | enum Type 34 | { 35 | TYPE_NONE=0, 36 | TYPE_CUDA=1, 37 | TYPE_OPENCL=2 38 | }; 39 | 40 | virtual void FindBestConfiguration()=0; 41 | 42 | const unsigned long GetNumBlocks() const { return m_numb; } 43 | const unsigned long GetNumThreads() const { return m_numt; } 44 | const DEVICECOUNTTYPE GetDeviceCount() const { return m_devicecount; } 45 | 46 | const unsigned int GetStepIterations() const { return (1u << (m_bits-1)); } 47 | const unsigned int GetStepBitShift() const { return m_bits; } 48 | 49 | const int GetType() const { return m_type; } 50 | const int GetDeviceIndex() const { return m_deviceindex; } 51 | 52 | virtual const STEPTYPE RunStep()=0; 53 | 54 | void SetGrid(const int grid) { m_numb=grid; } 55 | void SetThreads(const int threads) { m_numt=threads; } 56 | 57 | protected: 58 | virtual void DeallocateResources()=0; 59 | virtual void AllocateResources(const int numb, const int numt)=0; 60 | 61 | DEVICECOUNTTYPE m_devicecount; 62 | int m_deviceindex; 63 | unsigned long m_requestedgrid; 64 | unsigned long m_requestedthreads; 65 | unsigned long m_numb; 66 | unsigned long m_numt; 67 | int m_mode; 68 | int m_bits; 69 | 70 | private: 71 | int m_type; 72 | 73 | }; 74 | 75 | template 76 | GPURunner::GPURunner(const int type):m_type(type),m_devicecount(0),m_deviceindex(-1),m_numb(16),m_numt(16),m_bits(6),m_requestedgrid(-1),m_requestedthreads(-1)//m_mode(MODE_REGULAR) 77 | { 78 | 79 | if(mapArgs.count("-aggression")>0) 80 | { 81 | std::istringstream istr(mapArgs["-aggression"]); 82 | if((istr >> m_bits)) 83 | { 84 | if(m_bits>32) 85 | { 86 | m_bits=32; 87 | } 88 | else if(m_bits<1) 89 | { 90 | m_bits=1; 91 | } 92 | } 93 | } 94 | 95 | if(mapArgs.count("-gpu")!=0) 96 | { 97 | std::istringstream istr(mapArgs["-gpu"]); 98 | if(!(istr >> m_deviceindex)) 99 | { 100 | m_deviceindex=-1; 101 | } 102 | } 103 | 104 | if(mapArgs.count("-gpugrid")!=0) 105 | { 106 | std::istringstream istr(mapArgs["-gpugrid"]); 107 | if(!(istr >> m_requestedgrid)) 108 | { 109 | m_requestedgrid=-1; 110 | } 111 | } 112 | 113 | if(mapArgs.count("-gputhreads")!=0) 114 | { 115 | std::istringstream istr(mapArgs["-gputhreads"]); 116 | if(!(istr >> m_requestedthreads)) 117 | { 118 | m_requestedthreads=-1; 119 | } 120 | } 121 | 122 | } 123 | 124 | template 125 | GPURunner::~GPURunner() 126 | { 127 | 128 | } 129 | 130 | #endif // _bitcoin_gpu_runner_ 131 | -------------------------------------------------------------------------------- /src/headers.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2010 Satoshi Nakamoto 2 | // Distributed under the MIT/X11 software license, see the accompanying 3 | // file license.txt or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef _bitcoin_headers_h_ 6 | #define _bitcoin_headers_h_ 7 | 8 | #ifdef _MSC_VER 9 | #pragma warning(disable:4786) 10 | #pragma warning(disable:4804) 11 | #pragma warning(disable:4805) 12 | #pragma warning(disable:4717) 13 | #endif 14 | #ifdef _WIN32_WINNT 15 | #undef _WIN32_WINNT 16 | #endif 17 | #define _WIN32_WINNT 0x0500 18 | #ifdef _WIN32_IE 19 | #undef _WIN32_IE 20 | #endif 21 | #define _WIN32_IE 0x0400 22 | #define WIN32_LEAN_AND_MEAN 1 23 | #define __STDC_LIMIT_MACROS // to enable UINT64_MAX from stdint.h 24 | #if (defined(__unix__) || defined(unix)) && !defined(USG) 25 | #include // to get BSD define 26 | #endif 27 | #ifdef __WXMAC_OSX__ 28 | #ifndef BSD 29 | #define BSD 1 30 | #endif 31 | #endif 32 | #ifdef GUI 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #endif 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include 70 | #include 71 | #include 72 | #include 73 | #include 74 | #include 75 | #include 76 | #include 77 | #include 78 | #include 79 | #include 80 | #include 81 | #include 82 | #include 83 | #include 84 | #include 85 | 86 | #ifdef __WXMSW__ 87 | #include 88 | #include 89 | #include 90 | #include 91 | #include 92 | #include 93 | #include 94 | #include 95 | #else 96 | #include 97 | #include 98 | #include 99 | #include 100 | #include 101 | #include 102 | #include 103 | #include 104 | #include 105 | #include 106 | #include 107 | #include 108 | #endif 109 | #ifdef BSD 110 | #include 111 | #endif 112 | 113 | 114 | #pragma hdrstop 115 | using namespace std; 116 | using namespace boost; 117 | 118 | #include "strlcpy.h" 119 | #include "serialize.h" 120 | #include "uint256.h" 121 | #include "util.h" 122 | #include "key.h" 123 | #include "bignum.h" 124 | #include "base58.h" 125 | #include "script.h" 126 | #include "db.h" 127 | #include "net.h" 128 | #include "irc.h" 129 | #include "main.h" 130 | #include "rpc.h" 131 | #ifdef GUI 132 | #include "uibase.h" 133 | #include "ui.h" 134 | #else 135 | #include "noui.h" 136 | #endif 137 | #include "init.h" 138 | 139 | #include "xpm/addressbook16.xpm" 140 | #include "xpm/addressbook20.xpm" 141 | #include "xpm/bitcoin16.xpm" 142 | #include "xpm/bitcoin20.xpm" 143 | #include "xpm/bitcoin32.xpm" 144 | #include "xpm/bitcoin48.xpm" 145 | #include "xpm/bitcoin80.xpm" 146 | #include "xpm/check.xpm" 147 | #include "xpm/send16.xpm" 148 | #include "xpm/send16noshadow.xpm" 149 | #include "xpm/send20.xpm" 150 | #include "xpm/about.xpm" 151 | 152 | #endif // _bitcoin_headers_h_ 153 | -------------------------------------------------------------------------------- /src/init.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2010 Satoshi Nakamoto 2 | // Distributed under the MIT/X11 software license, see the accompanying 3 | // file license.txt or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef _bitcoin_init_h_ 6 | #define _bitcoin_init_h_ 7 | 8 | void Shutdown(void* parg); 9 | bool AppInit(int argc, char* argv[]); 10 | bool AppInit2(int argc, char* argv[]); 11 | 12 | #endif // _bitcoin_init_h_ 13 | -------------------------------------------------------------------------------- /src/irc.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2010 Satoshi Nakamoto 2 | // Distributed under the MIT/X11 software license, see the accompanying 3 | // file license.txt or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef _bitcoin_irc_h_ 6 | #define _bitcoin_irc_h_ 7 | 8 | bool RecvLine(SOCKET hSocket, string& strLine); 9 | void ThreadIRCSeed(void* parg); 10 | 11 | extern int nGotIRCAddresses; 12 | 13 | #endif // _bitcoin_irc_h_ 14 | -------------------------------------------------------------------------------- /src/json/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2007 - 2009 John W. Wilkinson 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /src/json/json_spirit.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_SPIRIT 2 | #define JSON_SPIRIT 3 | 4 | // Copyright John W. Wilkinson 2007 - 2009. 5 | // Distributed under the MIT License, see accompanying file LICENSE.txt 6 | 7 | // json spirit version 4.03 8 | 9 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 10 | # pragma once 11 | #endif 12 | 13 | #include "json_spirit_value.h" 14 | #include "json_spirit_reader.h" 15 | #include "json_spirit_writer.h" 16 | #include "json_spirit_utils.h" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/json/json_spirit_error_position.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_SPIRIT_ERROR_POSITION 2 | #define JSON_SPIRIT_ERROR_POSITION 3 | 4 | // Copyright John W. Wilkinson 2007 - 2009. 5 | // Distributed under the MIT License, see accompanying file LICENSE.txt 6 | 7 | // json spirit version 4.03 8 | 9 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 10 | # pragma once 11 | #endif 12 | 13 | #include 14 | 15 | namespace json_spirit 16 | { 17 | // An Error_position exception is thrown by the "read_or_throw" functions below on finding an error. 18 | // Note the "read_or_throw" functions are around 3 times slower than the standard functions "read" 19 | // functions that return a bool. 20 | // 21 | struct Error_position 22 | { 23 | Error_position(); 24 | Error_position( unsigned int line, unsigned int column, const std::string& reason ); 25 | bool operator==( const Error_position& lhs ) const; 26 | unsigned int line_; 27 | unsigned int column_; 28 | std::string reason_; 29 | }; 30 | 31 | inline Error_position::Error_position() 32 | : line_( 0 ) 33 | , column_( 0 ) 34 | { 35 | } 36 | 37 | inline Error_position::Error_position( unsigned int line, unsigned int column, const std::string& reason ) 38 | : line_( line ) 39 | , column_( column ) 40 | , reason_( reason ) 41 | { 42 | } 43 | 44 | inline bool Error_position::operator==( const Error_position& lhs ) const 45 | { 46 | if( this == &lhs ) return true; 47 | 48 | return ( reason_ == lhs.reason_ ) && 49 | ( line_ == lhs.line_ ) && 50 | ( column_ == lhs.column_ ); 51 | } 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/json/json_spirit_reader.cpp: -------------------------------------------------------------------------------- 1 | // Copyright John W. Wilkinson 2007 - 2009. 2 | // Distributed under the MIT License, see accompanying file LICENSE.txt 3 | 4 | // json spirit version 4.03 5 | 6 | #include "json_spirit_reader.h" 7 | #include "json_spirit_reader_template.h" 8 | 9 | using namespace json_spirit; 10 | 11 | bool json_spirit::read( const std::string& s, Value& value ) 12 | { 13 | return read_string( s, value ); 14 | } 15 | 16 | void json_spirit::read_or_throw( const std::string& s, Value& value ) 17 | { 18 | read_string_or_throw( s, value ); 19 | } 20 | 21 | bool json_spirit::read( std::istream& is, Value& value ) 22 | { 23 | return read_stream( is, value ); 24 | } 25 | 26 | void json_spirit::read_or_throw( std::istream& is, Value& value ) 27 | { 28 | read_stream_or_throw( is, value ); 29 | } 30 | 31 | bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, Value& value ) 32 | { 33 | return read_range( begin, end, value ); 34 | } 35 | 36 | void json_spirit::read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, Value& value ) 37 | { 38 | begin = read_range_or_throw( begin, end, value ); 39 | } 40 | 41 | #ifndef BOOST_NO_STD_WSTRING 42 | 43 | bool json_spirit::read( const std::wstring& s, wValue& value ) 44 | { 45 | return read_string( s, value ); 46 | } 47 | 48 | void json_spirit::read_or_throw( const std::wstring& s, wValue& value ) 49 | { 50 | read_string_or_throw( s, value ); 51 | } 52 | 53 | bool json_spirit::read( std::wistream& is, wValue& value ) 54 | { 55 | return read_stream( is, value ); 56 | } 57 | 58 | void json_spirit::read_or_throw( std::wistream& is, wValue& value ) 59 | { 60 | read_stream_or_throw( is, value ); 61 | } 62 | 63 | bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value ) 64 | { 65 | return read_range( begin, end, value ); 66 | } 67 | 68 | void json_spirit::read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value ) 69 | { 70 | begin = read_range_or_throw( begin, end, value ); 71 | } 72 | 73 | #endif 74 | 75 | bool json_spirit::read( const std::string& s, mValue& value ) 76 | { 77 | return read_string( s, value ); 78 | } 79 | 80 | void json_spirit::read_or_throw( const std::string& s, mValue& value ) 81 | { 82 | read_string_or_throw( s, value ); 83 | } 84 | 85 | bool json_spirit::read( std::istream& is, mValue& value ) 86 | { 87 | return read_stream( is, value ); 88 | } 89 | 90 | void json_spirit::read_or_throw( std::istream& is, mValue& value ) 91 | { 92 | read_stream_or_throw( is, value ); 93 | } 94 | 95 | bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value ) 96 | { 97 | return read_range( begin, end, value ); 98 | } 99 | 100 | void json_spirit::read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value ) 101 | { 102 | begin = read_range_or_throw( begin, end, value ); 103 | } 104 | 105 | #ifndef BOOST_NO_STD_WSTRING 106 | 107 | bool json_spirit::read( const std::wstring& s, wmValue& value ) 108 | { 109 | return read_string( s, value ); 110 | } 111 | 112 | void json_spirit::read_or_throw( const std::wstring& s, wmValue& value ) 113 | { 114 | read_string_or_throw( s, value ); 115 | } 116 | 117 | bool json_spirit::read( std::wistream& is, wmValue& value ) 118 | { 119 | return read_stream( is, value ); 120 | } 121 | 122 | void json_spirit::read_or_throw( std::wistream& is, wmValue& value ) 123 | { 124 | read_stream_or_throw( is, value ); 125 | } 126 | 127 | bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value ) 128 | { 129 | return read_range( begin, end, value ); 130 | } 131 | 132 | void json_spirit::read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value ) 133 | { 134 | begin = read_range_or_throw( begin, end, value ); 135 | } 136 | 137 | #endif 138 | -------------------------------------------------------------------------------- /src/json/json_spirit_reader.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_SPIRIT_READER 2 | #define JSON_SPIRIT_READER 3 | 4 | // Copyright John W. Wilkinson 2007 - 2009. 5 | // Distributed under the MIT License, see accompanying file LICENSE.txt 6 | 7 | // json spirit version 4.03 8 | 9 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 10 | # pragma once 11 | #endif 12 | 13 | #include "json_spirit_value.h" 14 | #include "json_spirit_error_position.h" 15 | #include 16 | 17 | namespace json_spirit 18 | { 19 | // functions to reads a JSON values 20 | 21 | bool read( const std::string& s, Value& value ); 22 | bool read( std::istream& is, Value& value ); 23 | bool read( std::string::const_iterator& begin, std::string::const_iterator end, Value& value ); 24 | 25 | void read_or_throw( const std::string& s, Value& value ); 26 | void read_or_throw( std::istream& is, Value& value ); 27 | void read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, Value& value ); 28 | 29 | #ifndef BOOST_NO_STD_WSTRING 30 | 31 | bool read( const std::wstring& s, wValue& value ); 32 | bool read( std::wistream& is, wValue& value ); 33 | bool read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value ); 34 | 35 | void read_or_throw( const std::wstring& s, wValue& value ); 36 | void read_or_throw( std::wistream& is, wValue& value ); 37 | void read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value ); 38 | 39 | #endif 40 | 41 | bool read( const std::string& s, mValue& value ); 42 | bool read( std::istream& is, mValue& value ); 43 | bool read( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value ); 44 | 45 | void read_or_throw( const std::string& s, mValue& value ); 46 | void read_or_throw( std::istream& is, mValue& value ); 47 | void read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value ); 48 | 49 | #ifndef BOOST_NO_STD_WSTRING 50 | 51 | bool read( const std::wstring& s, wmValue& value ); 52 | bool read( std::wistream& is, wmValue& value ); 53 | bool read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value ); 54 | 55 | void read_or_throw( const std::wstring& s, wmValue& value ); 56 | void read_or_throw( std::wistream& is, wmValue& value ); 57 | void read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value ); 58 | 59 | #endif 60 | } 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/json/json_spirit_stream_reader.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_SPIRIT_READ_STREAM 2 | #define JSON_SPIRIT_READ_STREAM 3 | 4 | // Copyright John W. Wilkinson 2007 - 2009. 5 | // Distributed under the MIT License, see accompanying file LICENSE.txt 6 | 7 | // json spirit version 4.03 8 | 9 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 10 | # pragma once 11 | #endif 12 | 13 | #include "json_spirit_reader_template.h" 14 | 15 | namespace json_spirit 16 | { 17 | // these classes allows you to read multiple top level contiguous values from a stream, 18 | // the normal stream read functions have a bug that prevent multiple top level values 19 | // from being read unless they are separated by spaces 20 | 21 | template< class Istream_type, class Value_type > 22 | class Stream_reader 23 | { 24 | public: 25 | 26 | Stream_reader( Istream_type& is ) 27 | : iters_( is ) 28 | { 29 | } 30 | 31 | bool read_next( Value_type& value ) 32 | { 33 | return read_range( iters_.begin_, iters_.end_, value ); 34 | } 35 | 36 | private: 37 | 38 | typedef Multi_pass_iters< Istream_type > Mp_iters; 39 | 40 | Mp_iters iters_; 41 | }; 42 | 43 | template< class Istream_type, class Value_type > 44 | class Stream_reader_thrower 45 | { 46 | public: 47 | 48 | Stream_reader_thrower( Istream_type& is ) 49 | : iters_( is ) 50 | , posn_begin_( iters_.begin_, iters_.end_ ) 51 | , posn_end_( iters_.end_, iters_.end_ ) 52 | { 53 | } 54 | 55 | void read_next( Value_type& value ) 56 | { 57 | posn_begin_ = read_range_or_throw( posn_begin_, posn_end_, value ); 58 | } 59 | 60 | private: 61 | 62 | typedef Multi_pass_iters< Istream_type > Mp_iters; 63 | typedef spirit_namespace::position_iterator< typename Mp_iters::Mp_iter > Posn_iter_t; 64 | 65 | Mp_iters iters_; 66 | Posn_iter_t posn_begin_, posn_end_; 67 | }; 68 | } 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /src/json/json_spirit_utils.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_SPIRIT_UTILS 2 | #define JSON_SPIRIT_UTILS 3 | 4 | // Copyright John W. Wilkinson 2007 - 2009. 5 | // Distributed under the MIT License, see accompanying file LICENSE.txt 6 | 7 | // json spirit version 4.03 8 | 9 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 10 | # pragma once 11 | #endif 12 | 13 | #include "json_spirit_value.h" 14 | #include 15 | 16 | namespace json_spirit 17 | { 18 | template< class Obj_t, class Map_t > 19 | void obj_to_map( const Obj_t& obj, Map_t& mp_obj ) 20 | { 21 | mp_obj.clear(); 22 | 23 | for( typename Obj_t::const_iterator i = obj.begin(); i != obj.end(); ++i ) 24 | { 25 | mp_obj[ i->name_ ] = i->value_; 26 | } 27 | } 28 | 29 | template< class Obj_t, class Map_t > 30 | void map_to_obj( const Map_t& mp_obj, Obj_t& obj ) 31 | { 32 | obj.clear(); 33 | 34 | for( typename Map_t::const_iterator i = mp_obj.begin(); i != mp_obj.end(); ++i ) 35 | { 36 | obj.push_back( typename Obj_t::value_type( i->first, i->second ) ); 37 | } 38 | } 39 | 40 | typedef std::map< std::string, Value > Mapped_obj; 41 | 42 | #ifndef BOOST_NO_STD_WSTRING 43 | typedef std::map< std::wstring, wValue > wMapped_obj; 44 | #endif 45 | 46 | template< class Object_type, class String_type > 47 | const typename Object_type::value_type::Value_type& find_value( const Object_type& obj, const String_type& name ) 48 | { 49 | for( typename Object_type::const_iterator i = obj.begin(); i != obj.end(); ++i ) 50 | { 51 | if( i->name_ == name ) 52 | { 53 | return i->value_; 54 | } 55 | } 56 | 57 | return Object_type::value_type::Value_type::null; 58 | } 59 | } 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/json/json_spirit_value.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007 John W Wilkinson 2 | 3 | This source code can be used for any purpose as long as 4 | this comment is retained. */ 5 | 6 | // json spirit version 2.00 7 | 8 | #include "json_spirit_value.h" 9 | -------------------------------------------------------------------------------- /src/json/json_spirit_writer.cpp: -------------------------------------------------------------------------------- 1 | // Copyright John W. Wilkinson 2007 - 2009. 2 | // Distributed under the MIT License, see accompanying file LICENSE.txt 3 | 4 | // json spirit version 4.03 5 | 6 | #include "json_spirit_writer.h" 7 | #include "json_spirit_writer_template.h" 8 | 9 | void json_spirit::write( const Value& value, std::ostream& os ) 10 | { 11 | write_stream( value, os, false ); 12 | } 13 | 14 | void json_spirit::write_formatted( const Value& value, std::ostream& os ) 15 | { 16 | write_stream( value, os, true ); 17 | } 18 | 19 | std::string json_spirit::write( const Value& value ) 20 | { 21 | return write_string( value, false ); 22 | } 23 | 24 | std::string json_spirit::write_formatted( const Value& value ) 25 | { 26 | return write_string( value, true ); 27 | } 28 | 29 | #ifndef BOOST_NO_STD_WSTRING 30 | 31 | void json_spirit::write( const wValue& value, std::wostream& os ) 32 | { 33 | write_stream( value, os, false ); 34 | } 35 | 36 | void json_spirit::write_formatted( const wValue& value, std::wostream& os ) 37 | { 38 | write_stream( value, os, true ); 39 | } 40 | 41 | std::wstring json_spirit::write( const wValue& value ) 42 | { 43 | return write_string( value, false ); 44 | } 45 | 46 | std::wstring json_spirit::write_formatted( const wValue& value ) 47 | { 48 | return write_string( value, true ); 49 | } 50 | 51 | #endif 52 | 53 | void json_spirit::write( const mValue& value, std::ostream& os ) 54 | { 55 | write_stream( value, os, false ); 56 | } 57 | 58 | void json_spirit::write_formatted( const mValue& value, std::ostream& os ) 59 | { 60 | write_stream( value, os, true ); 61 | } 62 | 63 | std::string json_spirit::write( const mValue& value ) 64 | { 65 | return write_string( value, false ); 66 | } 67 | 68 | std::string json_spirit::write_formatted( const mValue& value ) 69 | { 70 | return write_string( value, true ); 71 | } 72 | 73 | #ifndef BOOST_NO_STD_WSTRING 74 | 75 | void json_spirit::write( const wmValue& value, std::wostream& os ) 76 | { 77 | write_stream( value, os, false ); 78 | } 79 | 80 | void json_spirit::write_formatted( const wmValue& value, std::wostream& os ) 81 | { 82 | write_stream( value, os, true ); 83 | } 84 | 85 | std::wstring json_spirit::write( const wmValue& value ) 86 | { 87 | return write_string( value, false ); 88 | } 89 | 90 | std::wstring json_spirit::write_formatted( const wmValue& value ) 91 | { 92 | return write_string( value, true ); 93 | } 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /src/json/json_spirit_writer.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_SPIRIT_WRITER 2 | #define JSON_SPIRIT_WRITER 3 | 4 | // Copyright John W. Wilkinson 2007 - 2009. 5 | // Distributed under the MIT License, see accompanying file LICENSE.txt 6 | 7 | // json spirit version 4.03 8 | 9 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 10 | # pragma once 11 | #endif 12 | 13 | #include "json_spirit_value.h" 14 | #include 15 | 16 | namespace json_spirit 17 | { 18 | // functions to convert JSON Values to text, 19 | // the "formatted" versions add whitespace to format the output nicely 20 | 21 | void write ( const Value& value, std::ostream& os ); 22 | void write_formatted( const Value& value, std::ostream& os ); 23 | std::string write ( const Value& value ); 24 | std::string write_formatted( const Value& value ); 25 | 26 | #ifndef BOOST_NO_STD_WSTRING 27 | 28 | void write ( const wValue& value, std::wostream& os ); 29 | void write_formatted( const wValue& value, std::wostream& os ); 30 | std::wstring write ( const wValue& value ); 31 | std::wstring write_formatted( const wValue& value ); 32 | 33 | #endif 34 | 35 | void write ( const mValue& value, std::ostream& os ); 36 | void write_formatted( const mValue& value, std::ostream& os ); 37 | std::string write ( const mValue& value ); 38 | std::string write_formatted( const mValue& value ); 39 | 40 | #ifndef BOOST_NO_STD_WSTRING 41 | 42 | void write ( const wmValue& value, std::wostream& os ); 43 | void write_formatted( const wmValue& value, std::wostream& os ); 44 | std::wstring write ( const wmValue& value ); 45 | std::wstring write_formatted( const wmValue& value ); 46 | 47 | #endif 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/key.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2010 Satoshi Nakamoto 2 | // Distributed under the MIT/X11 software license, see the accompanying 3 | // file license.txt or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef _bitcoin_key_h_ 6 | #define _bitcoin_key_h_ 7 | 8 | 9 | // secp160k1 10 | // const unsigned int PRIVATE_KEY_SIZE = 192; 11 | // const unsigned int PUBLIC_KEY_SIZE = 41; 12 | // const unsigned int SIGNATURE_SIZE = 48; 13 | // 14 | // secp192k1 15 | // const unsigned int PRIVATE_KEY_SIZE = 222; 16 | // const unsigned int PUBLIC_KEY_SIZE = 49; 17 | // const unsigned int SIGNATURE_SIZE = 57; 18 | // 19 | // secp224k1 20 | // const unsigned int PRIVATE_KEY_SIZE = 250; 21 | // const unsigned int PUBLIC_KEY_SIZE = 57; 22 | // const unsigned int SIGNATURE_SIZE = 66; 23 | // 24 | // secp256k1: 25 | // const unsigned int PRIVATE_KEY_SIZE = 279; 26 | // const unsigned int PUBLIC_KEY_SIZE = 65; 27 | // const unsigned int SIGNATURE_SIZE = 72; 28 | // 29 | // see www.keylength.com 30 | // script supports up to 75 for single byte push 31 | 32 | 33 | 34 | class key_error : public std::runtime_error 35 | { 36 | public: 37 | explicit key_error(const std::string& str) : std::runtime_error(str) {} 38 | }; 39 | 40 | 41 | // secure_allocator is defined in serialize.h 42 | typedef vector > CPrivKey; 43 | 44 | 45 | 46 | class CKey 47 | { 48 | protected: 49 | EC_KEY* pkey; 50 | bool fSet; 51 | 52 | public: 53 | CKey() 54 | { 55 | pkey = EC_KEY_new_by_curve_name(NID_secp256k1); 56 | if (pkey == NULL) 57 | throw key_error("CKey::CKey() : EC_KEY_new_by_curve_name failed"); 58 | fSet = false; 59 | } 60 | 61 | CKey(const CKey& b) 62 | { 63 | pkey = EC_KEY_dup(b.pkey); 64 | if (pkey == NULL) 65 | throw key_error("CKey::CKey(const CKey&) : EC_KEY_dup failed"); 66 | fSet = b.fSet; 67 | } 68 | 69 | CKey& operator=(const CKey& b) 70 | { 71 | if (!EC_KEY_copy(pkey, b.pkey)) 72 | throw key_error("CKey::operator=(const CKey&) : EC_KEY_copy failed"); 73 | fSet = b.fSet; 74 | return (*this); 75 | } 76 | 77 | ~CKey() 78 | { 79 | EC_KEY_free(pkey); 80 | } 81 | 82 | bool IsNull() const 83 | { 84 | return !fSet; 85 | } 86 | 87 | void MakeNewKey() 88 | { 89 | if (!EC_KEY_generate_key(pkey)) 90 | throw key_error("CKey::MakeNewKey() : EC_KEY_generate_key failed"); 91 | fSet = true; 92 | } 93 | 94 | bool SetPrivKey(const CPrivKey& vchPrivKey) 95 | { 96 | const unsigned char* pbegin = &vchPrivKey[0]; 97 | if (!d2i_ECPrivateKey(&pkey, &pbegin, vchPrivKey.size())) 98 | return false; 99 | fSet = true; 100 | return true; 101 | } 102 | 103 | CPrivKey GetPrivKey() const 104 | { 105 | unsigned int nSize = i2d_ECPrivateKey(pkey, NULL); 106 | if (!nSize) 107 | throw key_error("CKey::GetPrivKey() : i2d_ECPrivateKey failed"); 108 | CPrivKey vchPrivKey(nSize, 0); 109 | unsigned char* pbegin = &vchPrivKey[0]; 110 | if (i2d_ECPrivateKey(pkey, &pbegin) != nSize) 111 | throw key_error("CKey::GetPrivKey() : i2d_ECPrivateKey returned unexpected size"); 112 | return vchPrivKey; 113 | } 114 | 115 | bool SetPubKey(const vector& vchPubKey) 116 | { 117 | const unsigned char* pbegin = &vchPubKey[0]; 118 | if (!o2i_ECPublicKey(&pkey, &pbegin, vchPubKey.size())) 119 | return false; 120 | fSet = true; 121 | return true; 122 | } 123 | 124 | vector GetPubKey() const 125 | { 126 | unsigned int nSize = i2o_ECPublicKey(pkey, NULL); 127 | if (!nSize) 128 | throw key_error("CKey::GetPubKey() : i2o_ECPublicKey failed"); 129 | vector vchPubKey(nSize, 0); 130 | unsigned char* pbegin = &vchPubKey[0]; 131 | if (i2o_ECPublicKey(pkey, &pbegin) != nSize) 132 | throw key_error("CKey::GetPubKey() : i2o_ECPublicKey returned unexpected size"); 133 | return vchPubKey; 134 | } 135 | 136 | bool Sign(uint256 hash, vector& vchSig) 137 | { 138 | vchSig.clear(); 139 | unsigned char pchSig[10000]; 140 | unsigned int nSize = 0; 141 | if (!ECDSA_sign(0, (unsigned char*)&hash, sizeof(hash), pchSig, &nSize, pkey)) 142 | return false; 143 | vchSig.resize(nSize); 144 | memcpy(&vchSig[0], pchSig, nSize); 145 | return true; 146 | } 147 | 148 | bool Verify(uint256 hash, const vector& vchSig) 149 | { 150 | // -1 = error, 0 = bad sig, 1 = good 151 | if (ECDSA_verify(0, (unsigned char*)&hash, sizeof(hash), &vchSig[0], vchSig.size(), pkey) != 1) 152 | return false; 153 | return true; 154 | } 155 | 156 | static bool Sign(const CPrivKey& vchPrivKey, uint256 hash, vector& vchSig) 157 | { 158 | CKey key; 159 | if (!key.SetPrivKey(vchPrivKey)) 160 | return false; 161 | return key.Sign(hash, vchSig); 162 | } 163 | 164 | static bool Verify(const vector& vchPubKey, uint256 hash, const vector& vchSig) 165 | { 166 | CKey key; 167 | if (!key.SetPubKey(vchPubKey)) 168 | return false; 169 | return key.Verify(hash, vchSig); 170 | } 171 | }; 172 | 173 | #endif // _bitcoin_key_h_ 174 | -------------------------------------------------------------------------------- /src/license.txt: -------------------------------------------------------------------------------- 1 | Portions of this software Copyright (c) 2009-2010 Satoshi Nakamoto 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | ****************************************************************************** 22 | 23 | Portions of this software Copyright (C) 2010-2011 puddinpop 24 | 25 | This program is free software; you can redistribute it and/or modify 26 | it under the terms of the GNU General Public License as published by 27 | the Free Software Foundation; either version 2 of the License, or 28 | (at your option) any later version. 29 | 30 | This program is distributed in the hope that it will be useful, 31 | but WITHOUT ANY WARRANTY; without even the implied warranty of 32 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 33 | GNU General Public License for more details. 34 | 35 | You should have received a copy of the GNU General Public License along 36 | with this program; if not, write to the Free Software Foundation, Inc., 37 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -------------------------------------------------------------------------------- /src/locale/de/LC_MESSAGES/bitcoin.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/locale/de/LC_MESSAGES/bitcoin.mo -------------------------------------------------------------------------------- /src/locale/es/LC_MESSAGES/bitcoin.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/locale/es/LC_MESSAGES/bitcoin.mo -------------------------------------------------------------------------------- /src/locale/fr/LC_MESSAGES/bitcoin.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/locale/fr/LC_MESSAGES/bitcoin.mo -------------------------------------------------------------------------------- /src/locale/it/LC_MESSAGES/bitcoin.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/locale/it/LC_MESSAGES/bitcoin.mo -------------------------------------------------------------------------------- /src/locale/nl/LC_MESSAGES/bitcoin.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/locale/nl/LC_MESSAGES/bitcoin.mo -------------------------------------------------------------------------------- /src/locale/pt/LC_MESSAGES/bitcoin.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/locale/pt/LC_MESSAGES/bitcoin.mo -------------------------------------------------------------------------------- /src/locale/readme.txt: -------------------------------------------------------------------------------- 1 | put bitcoin.po and bitcoin.mo files at: 2 | locale//LC_MESSAGES/bitcoin.mo and .po 3 | 4 | .po is the sourcefile 5 | .mo is the compiled translation 6 | -------------------------------------------------------------------------------- /src/locale/ru/LC_MESSAGES/bitcoin.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/locale/ru/LC_MESSAGES/bitcoin.mo -------------------------------------------------------------------------------- /src/makefile.mingw: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2009-2010 Satoshi Nakamoto 2 | # Distributed under the MIT/X11 software license, see the accompanying 3 | # file license.txt or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | 6 | INCLUDEPATHS= \ 7 | -I"/boost" \ 8 | -I"/db/build_unix" \ 9 | -I"/openssl/include" \ 10 | -I"/wxwidgets/lib/gcc_lib/mswud" \ 11 | -I"/wxwidgets/include" 12 | 13 | LIBPATHS= \ 14 | -L"/boost/stage/lib" \ 15 | -L"/db/build_unix" \ 16 | -L"/openssl/out" \ 17 | -L"/wxwidgets/lib/gcc_lib" 18 | 19 | WXLIBS= \ 20 | -l wxmsw29ud_html -l wxmsw29ud_core -l wxmsw29ud_adv -l wxbase29ud -l wxtiffd -l wxjpegd -l wxpngd -l wxzlibd 21 | 22 | LIBS= \ 23 | -l libboost_system-mgw34-mt-d \ 24 | -l libboost_filesystem-mgw34-mt-d \ 25 | -l libboost_program_options-mgw34-mt-d \ 26 | -l libboost_thread-mgw34-mt-d \ 27 | -l db_cxx \ 28 | -l eay32 \ 29 | -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi 30 | 31 | DEFS=-DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH 32 | DEBUGFLAGS=-g -D__WXDEBUG__ 33 | CFLAGS=-mthreads -O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) 34 | HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \ 35 | script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h 36 | 37 | OBJS= \ 38 | obj/util.o \ 39 | obj/script.o \ 40 | obj/db.o \ 41 | obj/net.o \ 42 | obj/irc.o \ 43 | obj/main.o \ 44 | obj/rpc.o \ 45 | obj/init.o \ 46 | cryptopp/obj/sha.o \ 47 | cryptopp/obj/cpu.o 48 | 49 | 50 | all: bitcoin.exe 51 | 52 | 53 | obj/%.o: %.cpp $(HEADERS) 54 | g++ -c $(CFLAGS) -DGUI -o $@ $< 55 | 56 | cryptopp/obj/%.o: cryptopp/%.cpp 57 | g++ -c $(CFLAGS) -O3 -DCRYPTOPP_X86_ASM_AVAILABLE -o $@ $< 58 | 59 | obj/ui_res.o: ui.rc rc/bitcoin.ico rc/check.ico rc/send16.bmp rc/send16mask.bmp rc/send16masknoshadow.bmp rc/send20.bmp rc/send20mask.bmp rc/addressbook16.bmp rc/addressbook16mask.bmp rc/addressbook20.bmp rc/addressbook20mask.bmp 60 | windres $(DEFS) $(INCLUDEPATHS) -o $@ -i $< 61 | 62 | bitcoin.exe: $(OBJS) obj/ui.o obj/uibase.o obj/ui_res.o 63 | g++ $(CFLAGS) -mwindows -Wl,--subsystem,windows -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS) 64 | 65 | 66 | obj/nogui/%.o: %.cpp $(HEADERS) 67 | g++ -c $(CFLAGS) -o $@ $< 68 | 69 | bitcoind.exe: $(OBJS:obj/%=obj/nogui/%) obj/ui_res.o 70 | g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) 71 | 72 | 73 | clean: 74 | -del /Q obj\* 75 | -del /Q obj\nogui\* 76 | -del /Q cryptopp\obj\* 77 | -del /Q headers.h.gch 78 | -------------------------------------------------------------------------------- /src/makefile.osx: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2009-2010 Satoshi Nakamoto 2 | # Distributed under the MIT/X11 software license, see the accompanying 3 | # file license.txt or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | # Mac OS X makefile for bitcoin 6 | # Laszlo Hanyecz (solar@heliacal.net) 7 | 8 | CXX=llvm-g++ 9 | DEPSDIR=/Users/macosuser/bitcoin/deps 10 | 11 | INCLUDEPATHS= \ 12 | -I"$(DEPSDIR)/include" 13 | 14 | LIBPATHS= \ 15 | -L"$(DEPSDIR)/lib" 16 | 17 | WXLIBS=$(shell $(DEPSDIR)/bin/wx-config --libs --static) 18 | 19 | LIBS= -dead_strip \ 20 | $(DEPSDIR)/lib/libdb_cxx-4.8.a \ 21 | $(DEPSDIR)/lib/libboost_system.a \ 22 | $(DEPSDIR)/lib/libboost_filesystem.a \ 23 | $(DEPSDIR)/lib/libboost_program_options.a \ 24 | $(DEPSDIR)/lib/libboost_thread.a \ 25 | $(DEPSDIR)/lib/libssl.a \ 26 | $(DEPSDIR)/lib/libcrypto.a 27 | 28 | DEFS=$(shell $(DEPSDIR)/bin/wx-config --cxxflags) -D__WXMAC_OSX__ -DNOPCH -DMSG_NOSIGNAL=0 -DUSE_SSL 29 | 30 | DEBUGFLAGS=-g -DwxDEBUG_LEVEL=0 31 | # ppc doesn't work because we don't support big-endian 32 | CFLAGS=-mmacosx-version-min=10.5 -arch i386 -arch x86_64 -O3 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) 33 | HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \ 34 | script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h 35 | 36 | OBJS= \ 37 | obj/util.o \ 38 | obj/script.o \ 39 | obj/db.o \ 40 | obj/net.o \ 41 | obj/irc.o \ 42 | obj/main.o \ 43 | obj/rpc.o \ 44 | obj/init.o \ 45 | cryptopp/obj/sha.o \ 46 | cryptopp/obj/cpu.o 47 | 48 | 49 | all: bitcoin 50 | 51 | 52 | obj/%.o: %.cpp $(HEADERS) 53 | $(CXX) -c $(CFLAGS) -DGUI -o $@ $< 54 | 55 | cryptopp/obj/%.o: cryptopp/%.cpp 56 | $(CXX) -c $(CFLAGS) -O3 -DCRYPTOPP_DISABLE_ASM -o $@ $< 57 | 58 | bitcoin: $(OBJS) obj/ui.o obj/uibase.o 59 | $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS) 60 | 61 | 62 | obj/nogui/%.o: %.cpp $(HEADERS) 63 | $(CXX) -c $(CFLAGS) -o $@ $< 64 | 65 | bitcoind: $(OBJS:obj/%=obj/nogui/%) 66 | $(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) 67 | 68 | 69 | clean: 70 | -rm -f bitcoin bitcoind 71 | -rm -f obj/*.o 72 | -rm -f obj/nogui/*.o 73 | -rm -f cryptopp/obj/*.o 74 | -------------------------------------------------------------------------------- /src/makefile.unix: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2009-2010 Satoshi Nakamoto 2 | # Distributed under the MIT/X11 software license, see the accompanying 3 | # file license.txt or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | 6 | INCLUDEPATHS= \ 7 | -I"/usr/local/include/wx-2.9" \ 8 | -I"/usr/local/lib/wx/include/gtk2-unicode-debug-static-2.9" 9 | 10 | # for wxWidgets 2.9.1, add -l Xxf86vm 11 | WXLIBS= \ 12 | -Wl,-Bstatic \ 13 | -l wx_gtk2ud-2.9 \ 14 | -Wl,-Bdynamic \ 15 | -l gtk-x11-2.0 \ 16 | -l SM 17 | 18 | # for boost 1.37, add -mt to the boost libraries 19 | LIBS= \ 20 | -Wl,-Bstatic \ 21 | -l boost_system \ 22 | -l boost_filesystem \ 23 | -l boost_program_options \ 24 | -l boost_thread \ 25 | -l db_cxx \ 26 | -l ssl \ 27 | -l crypto \ 28 | -Wl,-Bdynamic \ 29 | -l gthread-2.0 \ 30 | -l z \ 31 | -l dl 32 | 33 | DEFS=-D__WXGTK__ -DNOPCH -DFOURWAYSSE2 -DUSE_SSL 34 | DEBUGFLAGS=-g -D__WXDEBUG__ 35 | CFLAGS=-O2 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) 36 | HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \ 37 | script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h 38 | 39 | OBJS= \ 40 | obj/util.o \ 41 | obj/script.o \ 42 | obj/db.o \ 43 | obj/net.o \ 44 | obj/irc.o \ 45 | obj/main.o \ 46 | obj/rpc.o \ 47 | obj/init.o \ 48 | cryptopp/obj/sha.o \ 49 | cryptopp/obj/cpu.o 50 | 51 | 52 | all: bitcoin 53 | 54 | 55 | obj/%.o: %.cpp $(HEADERS) 56 | g++ -c $(CFLAGS) -DGUI -o $@ $< 57 | 58 | cryptopp/obj/%.o: cryptopp/%.cpp 59 | g++ -c $(CFLAGS) -O3 -o $@ $< 60 | 61 | obj/sha256.o: sha256.cpp 62 | g++ -c $(CFLAGS) -msse2 -O3 -march=amdfam10 -o $@ $< 63 | 64 | bitcoin: $(OBJS) obj/ui.o obj/uibase.o obj/sha256.o 65 | g++ $(CFLAGS) -o $@ $^ $(WXLIBS) $(LIBS) 66 | 67 | 68 | obj/nogui/%.o: %.cpp $(HEADERS) 69 | g++ -c $(CFLAGS) -o $@ $< 70 | 71 | bitcoind: $(OBJS:obj/%=obj/nogui/%) obj/sha256.o 72 | g++ $(CFLAGS) -o $@ $^ $(LIBS) 73 | 74 | 75 | clean: 76 | -rm -f obj/*.o 77 | -rm -f obj/nogui/*.o 78 | -rm -f cryptopp/obj/*.o 79 | -rm -f headers.h.gch 80 | -------------------------------------------------------------------------------- /src/makefile.vc: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2009-2010 Satoshi Nakamoto 2 | # Distributed under the MIT/X11 software license, see the accompanying 3 | # file license.txt or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | 6 | INCLUDEPATHS= \ 7 | /I"/boost" \ 8 | /I"/db/build_windows" \ 9 | /I"/openssl/include" \ 10 | /I"/wxwidgets/lib/vc_lib/mswud" \ 11 | /I"/wxwidgets/include" 12 | 13 | LIBPATHS= \ 14 | /LIBPATH:"/boost/stage/lib" \ 15 | /LIBPATH:"/db/build_windows/debug" \ 16 | /LIBPATH:"/openssl/out" \ 17 | /LIBPATH:"/wxwidgets/lib/vc_lib" 18 | 19 | WXLIBS=wxmsw29ud_html.lib wxmsw29ud_core.lib wxmsw29ud_adv.lib wxbase29ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib 20 | 21 | LIBS= \ 22 | libboost_system-vc80-mt-gd.lib \ 23 | libboost_filesystem-vc80-mt-gd.lib \ 24 | libboost_program_options-vc80-mt-gd.lib \ 25 | libboost_thread-vc80-mt-gd.lib \ 26 | libdb47sd.lib \ 27 | libeay32.lib \ 28 | kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib ws2_32.lib shlwapi.lib 29 | 30 | DEFS=/DWIN32 /D__WXMSW__ /D_WINDOWS /DNOPCH 31 | DEBUGFLAGS=/Zi /D__WXDEBUG__ 32 | CFLAGS=/c /nologo /MDd /EHsc /GR /Zm300 $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) 33 | HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \ 34 | script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h 35 | 36 | OBJS= \ 37 | obj\util.obj \ 38 | obj\script.obj \ 39 | obj\db.obj \ 40 | obj\net.obj \ 41 | obj\irc.obj \ 42 | obj\main.obj \ 43 | obj\rpc.obj \ 44 | obj\init.obj \ 45 | cryptopp\obj\sha.obj \ 46 | cryptopp\obj\cpu.obj 47 | 48 | 49 | all: bitcoin.exe 50 | 51 | 52 | .cpp{obj}.obj: 53 | cl $(CFLAGS) /DGUI /Fo$@ %s 54 | 55 | obj\util.obj: $(HEADERS) 56 | 57 | obj\script.obj: $(HEADERS) 58 | 59 | obj\db.obj: $(HEADERS) 60 | 61 | obj\net.obj: $(HEADERS) 62 | 63 | obj\irc.obj: $(HEADERS) 64 | 65 | obj\main.obj: $(HEADERS) 66 | 67 | obj\rpc.obj: $(HEADERS) 68 | 69 | obj\init.obj: $(HEADERS) 70 | 71 | obj\ui.obj: $(HEADERS) 72 | 73 | obj\uibase.obj: $(HEADERS) 74 | 75 | cryptopp\obj\sha.obj: cryptopp\sha.cpp 76 | cl $(CFLAGS) /O2 /DCRYPTOPP_DISABLE_ASM /Fo$@ %s 77 | 78 | cryptopp\obj\cpu.obj: cryptopp\cpu.cpp 79 | cl $(CFLAGS) /O2 /DCRYPTOPP_DISABLE_ASM /Fo$@ %s 80 | 81 | obj\ui.res: ui.rc rc/bitcoin.ico rc/check.ico rc/send16.bmp rc/send16mask.bmp rc/send16masknoshadow.bmp rc/send20.bmp rc/send20mask.bmp rc/addressbook16.bmp rc/addressbook16mask.bmp rc/addressbook20.bmp rc/addressbook20mask.bmp 82 | rc $(INCLUDEPATHS) $(DEFS) /Fo$@ %s 83 | 84 | bitcoin.exe: $(OBJS) obj\ui.obj obj\uibase.obj obj\ui.res 85 | link /nologo /DEBUG /SUBSYSTEM:WINDOWS /OUT:$@ $(LIBPATHS) $** $(WXLIBS) $(LIBS) 86 | 87 | 88 | .cpp{obj\nogui}.obj: 89 | cl $(CFLAGS) /Fo$@ %s 90 | 91 | obj\nogui\util.obj: $(HEADERS) 92 | 93 | obj\nogui\script.obj: $(HEADERS) 94 | 95 | obj\nogui\db.obj: $(HEADERS) 96 | 97 | obj\nogui\net.obj: $(HEADERS) 98 | 99 | obj\nogui\irc.obj: $(HEADERS) 100 | 101 | obj\nogui\main.obj: $(HEADERS) 102 | 103 | obj\nogui\rpc.obj: $(HEADERS) 104 | 105 | obj\nogui\init.obj: $(HEADERS) 106 | 107 | bitcoind.exe: $(OBJS:obj\=obj\nogui\) obj\ui.res 108 | link /nologo /DEBUG /OUT:$@ $(LIBPATHS) $** $(LIBS) 109 | 110 | 111 | clean: 112 | -del /Q obj\* 113 | -del /Q obj\nogui\* 114 | -del /Q cryptopp\obj\* 115 | -del /Q *.ilk 116 | -del /Q *.pdb 117 | -------------------------------------------------------------------------------- /src/minercommon/base64.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file base64.h 3 | * 4 | * Copyright (C) 2006-2010, Paul Bakker 5 | * All rights reserved. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 | */ 21 | #ifndef POLARSSL_BASE64_H 22 | #define POLARSSL_BASE64_H 23 | 24 | #define POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL 0x0010 25 | #define POLARSSL_ERR_BASE64_INVALID_CHARACTER 0x0012 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /** 32 | * \brief Encode a buffer into base64 format 33 | * 34 | * \param dst destination buffer 35 | * \param dlen size of the buffer 36 | * \param src source buffer 37 | * \param slen amount of data to be encoded 38 | * 39 | * \return 0 if successful, or POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL. 40 | * *dlen is always updated to reflect the amount 41 | * of data that has (or would have) been written. 42 | * 43 | * \note Call this function with *dlen = 0 to obtain the 44 | * required buffer size in *dlen 45 | */ 46 | int base64_encode( unsigned char *dst, int *dlen, 47 | const unsigned char *src, int slen ); 48 | 49 | /** 50 | * \brief Decode a base64-formatted buffer 51 | * 52 | * \param dst destination buffer 53 | * \param dlen size of the buffer 54 | * \param src source buffer 55 | * \param slen amount of data to be decoded 56 | * 57 | * \return 0 if successful, POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL, or 58 | * POLARSSL_ERR_BASE64_INVALID_DATA if the input data is not 59 | * correct. *dlen is always updated to reflect the amount 60 | * of data that has (or would have) been written. 61 | * 62 | * \note Call this function with *dlen = 0 to obtain the 63 | * required buffer size in *dlen 64 | */ 65 | int base64_decode( unsigned char *dst, int *dlen, 66 | const unsigned char *src, int slen ); 67 | 68 | /** 69 | * \brief Checkup routine 70 | * 71 | * \return 0 if successful, or 1 if the test failed 72 | */ 73 | int base64_self_test( int verbose ); 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | 79 | #endif /* base64.h */ 80 | -------------------------------------------------------------------------------- /src/minercommon/minerheaders.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _miner_headers_ 20 | #define _miner_headers_ 21 | 22 | #ifdef _WIN32 23 | 24 | #ifdef _WIN32_WINNT 25 | #undef _WIN32_WINNT 26 | #endif 27 | #define _WIN32_WINNT 0x0500 28 | #ifdef _WIN32_IE 29 | #undef _WIN32_IE 30 | #endif 31 | 32 | #include 33 | #include 34 | #endif // _WIN32 35 | 36 | #ifndef _WIN32 37 | #include // for setpriority 38 | #include // for setpriority 39 | #endif 40 | 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include "base64.h" 58 | #include "../serialize.h" 59 | #include "../uint256.h" 60 | #include "../util.h" 61 | #include "../bignum.h" 62 | #include "../base58.h" 63 | #include "../strlcpy.h" 64 | 65 | #endif // _miner_headers_ 66 | -------------------------------------------------------------------------------- /src/noui.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Satoshi Nakamoto 2 | // Distributed under the MIT/X11 software license, see the accompanying 3 | // file license.txt or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef _bitcoin_noui_h_ 6 | #define _bitcoin_noui_h_ 7 | 8 | 9 | typedef void wxWindow; 10 | #define wxYES 0x00000002 11 | #define wxOK 0x00000004 12 | #define wxNO 0x00000008 13 | #define wxYES_NO (wxYES|wxNO) 14 | #define wxCANCEL 0x00000010 15 | #define wxAPPLY 0x00000020 16 | #define wxCLOSE 0x00000040 17 | #define wxOK_DEFAULT 0x00000000 18 | #define wxYES_DEFAULT 0x00000000 19 | #define wxNO_DEFAULT 0x00000080 20 | #define wxCANCEL_DEFAULT 0x80000000 21 | #define wxICON_EXCLAMATION 0x00000100 22 | #define wxICON_HAND 0x00000200 23 | #define wxICON_WARNING wxICON_EXCLAMATION 24 | #define wxICON_ERROR wxICON_HAND 25 | #define wxICON_QUESTION 0x00000400 26 | #define wxICON_INFORMATION 0x00000800 27 | #define wxICON_STOP wxICON_HAND 28 | #define wxICON_ASTERISK wxICON_INFORMATION 29 | #define wxICON_MASK (0x00000100|0x00000200|0x00000400|0x00000800) 30 | #define wxFORWARD 0x00001000 31 | #define wxBACKWARD 0x00002000 32 | #define wxRESET 0x00004000 33 | #define wxHELP 0x00008000 34 | #define wxMORE 0x00010000 35 | #define wxSETUP 0x00020000 36 | 37 | inline int MyMessageBox(const string& message, const string& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1) 38 | { 39 | printf("%s: %s\n", caption.c_str(), message.c_str()); 40 | fprintf(stderr, "%s: %s\n", caption.c_str(), message.c_str()); 41 | return 4; 42 | } 43 | #define wxMessageBox MyMessageBox 44 | 45 | inline int ThreadSafeMessageBox(const string& message, const string& caption, int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1) 46 | { 47 | return MyMessageBox(message, caption, style, parent, x, y); 48 | } 49 | 50 | inline bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent) 51 | { 52 | return true; 53 | } 54 | 55 | inline void CalledSetStatusBar(const string& strText, int nField) 56 | { 57 | } 58 | 59 | inline void UIThreadCall(boost::function0 fn) 60 | { 61 | } 62 | 63 | inline void MainFrameRepaint() 64 | { 65 | } 66 | 67 | #endif // _bitcoin_noui_h_ 68 | -------------------------------------------------------------------------------- /src/obj/nogui: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/obj/nogui -------------------------------------------------------------------------------- /src/opencl/bitcoinmineropencl.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _bitcoin_miner_opencl_ 20 | #define _bitcoin_miner_opencl_ 21 | 22 | #ifdef _BITCOIN_MINER_OPENCL_ 23 | 24 | #include "../gpucommon/gpurunner.h" 25 | #include "openclshared.h" 26 | #include 27 | 28 | class OpenCLRunner:public GPURunner 29 | { 30 | public: 31 | OpenCLRunner(); 32 | ~OpenCLRunner(); 33 | 34 | void FindBestConfiguration(); 35 | 36 | const cl_uint RunStep(); 37 | 38 | opencl_in *GetIn() { return m_in; } 39 | 40 | private: 41 | void DeallocateResources(); 42 | void AllocateResources(const int numb, const int numt); 43 | 44 | const std::string ReadFileContents(const std::string &filename) const; 45 | 46 | opencl_in *m_in; 47 | cl_mem m_devin; 48 | opencl_out *m_out; 49 | cl_mem m_devout; 50 | 51 | int m_platform; 52 | cl_device_id m_device; 53 | cl_context m_context; 54 | cl_command_queue m_commandqueue; 55 | cl_program m_program; 56 | cl_kernel m_kernel; 57 | 58 | }; 59 | 60 | #endif // _BITCOIN_MINER_OPENCL_ 61 | 62 | #endif // _bitcoin_miner_opencl_ 63 | -------------------------------------------------------------------------------- /src/opencl/openclshared.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _opencl_shared_ 20 | #define _opencl_shared_ 21 | 22 | #ifdef _BITCOIN_MINER_OPENCL_ 23 | 24 | #include 25 | 26 | typedef struct 27 | { 28 | cl_uint m_AH[8]; 29 | cl_uint m_merkle; 30 | cl_uint m_ntime; 31 | cl_uint m_nbits; 32 | cl_uint m_nonce; 33 | }opencl_in; 34 | 35 | typedef struct 36 | { 37 | cl_uint m_bestnonce; 38 | //cl_uint m_bestg; 39 | }opencl_out; 40 | 41 | #endif // _BITCOIN_MINER_OPENCL_ 42 | 43 | #endif // _opencl_shared_ 44 | -------------------------------------------------------------------------------- /src/rc/addressbook16.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/rc/addressbook16.bmp -------------------------------------------------------------------------------- /src/rc/addressbook16mask.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/rc/addressbook16mask.bmp -------------------------------------------------------------------------------- /src/rc/addressbook20.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/rc/addressbook20.bmp -------------------------------------------------------------------------------- /src/rc/addressbook20mask.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/rc/addressbook20mask.bmp -------------------------------------------------------------------------------- /src/rc/bitcoin-bc.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/rc/bitcoin-bc.ico -------------------------------------------------------------------------------- /src/rc/bitcoin.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/rc/bitcoin.ico -------------------------------------------------------------------------------- /src/rc/check.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/rc/check.ico -------------------------------------------------------------------------------- /src/rc/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/rc/favicon.ico -------------------------------------------------------------------------------- /src/rc/send16.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/rc/send16.bmp -------------------------------------------------------------------------------- /src/rc/send16mask.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/rc/send16mask.bmp -------------------------------------------------------------------------------- /src/rc/send16masknoshadow.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/rc/send16masknoshadow.bmp -------------------------------------------------------------------------------- /src/rc/send20.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/rc/send20.bmp -------------------------------------------------------------------------------- /src/rc/send20mask.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doublec/bitcoin-pool/b788ec493f8175349fd710ec8690ebdfd5df276d/src/rc/send20mask.bmp -------------------------------------------------------------------------------- /src/remote/cuda/bitcoinminercuda.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _bitcoin_remote_miner_cuda_ 20 | #define _bitcoin_remote_miner_cuda_ 21 | 22 | #ifdef _BITCOIN_MINER_CUDA_ 23 | 24 | #include "../../gpucommon/gpurunner.h" 25 | #include "cudashared.h" 26 | 27 | class RemoteCUDARunner:public GPURunner 28 | { 29 | public: 30 | RemoteCUDARunner(); 31 | ~RemoteCUDARunner(); 32 | 33 | void FindBestConfiguration(); 34 | 35 | const unsigned long RunStep(); 36 | 37 | void SetMetaHashSize(const long size) { m_metahashsize=size; } 38 | remote_cuda_in *GetIn() { return m_in; } 39 | remote_cuda_out *GetOut() { return m_out; } 40 | unsigned char *GetMetaHash() { return m_metahash; } 41 | 42 | private: 43 | void DeallocateResources(); 44 | void AllocateResources(const int numb, const int numt); 45 | 46 | long m_metahashsize; 47 | remote_cuda_in *m_in; 48 | remote_cuda_in *m_devin; 49 | remote_cuda_out *m_out; 50 | remote_cuda_out *m_devout; 51 | unsigned char *m_metahash; 52 | unsigned char *m_devmetahash; 53 | 54 | }; 55 | 56 | #endif // _BITCOIN_MINER_CUDA_ 57 | 58 | #endif // _bitcoin_remote_miner_cuda_ 59 | -------------------------------------------------------------------------------- /src/remote/cuda/cudashared.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _remote_cuda_shared_ 20 | #define _remote_cuda_shared_ 21 | 22 | #ifdef _BITCOIN_MINER_CUDA_ 23 | 24 | typedef struct 25 | { 26 | unsigned int m_AH[8]; 27 | unsigned int m_merkle; 28 | unsigned int m_ntime; 29 | unsigned int m_nbits; 30 | unsigned int m_nonce; 31 | }remote_cuda_in; 32 | 33 | typedef struct 34 | { 35 | unsigned int m_bestnonce; 36 | unsigned int m_bestAH[8]; 37 | }remote_cuda_out; 38 | 39 | void remote_cuda_process_helper(remote_cuda_in *in, remote_cuda_out *out, unsigned char *metahash, const unsigned int loops, const unsigned int bits, const int grid, const int threads); 40 | 41 | #endif // _BITCOIN_MINER_CUDA_ 42 | 43 | #endif // _remote_cuda_shared_ 44 | -------------------------------------------------------------------------------- /src/remote/opencl/bitcoinmineropencl.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _bitcoin_remote_miner_opencl_ 20 | #define _bitcoin_remote_miner_opencl_ 21 | 22 | #ifdef _BITCOIN_MINER_OPENCL_ 23 | 24 | #include "../../gpucommon/gpurunner.h" 25 | #include "openclshared.h" 26 | #include 27 | 28 | class RemoteOpenCLRunner:public GPURunner 29 | { 30 | public: 31 | RemoteOpenCLRunner(); 32 | ~RemoteOpenCLRunner(); 33 | 34 | void FindBestConfiguration(); 35 | 36 | const cl_uint RunStep(); 37 | 38 | void SetMetaHashSize(const long size) { m_metahashsize=size; } 39 | remote_opencl_in *GetIn() { return m_in; } 40 | remote_opencl_out *GetOut() { return m_out; } 41 | cl_uchar *GetMetaHash() { return m_metahash; } 42 | 43 | private: 44 | void DeallocateResources(); 45 | void AllocateResources(const int numb, const int numt); 46 | 47 | const std::string ReadFileContents(const std::string &filename) const; 48 | 49 | long m_metahashsize; 50 | remote_opencl_in *m_in; 51 | cl_mem m_devin; 52 | remote_opencl_out *m_out; 53 | cl_mem m_devout; 54 | cl_uchar *m_metahash; 55 | cl_mem m_devmetahash; 56 | 57 | int m_platform; 58 | cl_device_id m_device; 59 | cl_context m_context; 60 | cl_command_queue m_commandqueue; 61 | cl_program m_program; 62 | cl_kernel m_kernel; 63 | 64 | }; 65 | 66 | #endif // _BITCOIN_MINER_OPENCL_ 67 | 68 | #endif // _bitcoin_remote_miner_opencl_ 69 | -------------------------------------------------------------------------------- /src/remote/opencl/openclshared.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _remote_opencl_shared_ 20 | #define _remote_opencl_shared_ 21 | 22 | #ifdef _BITCOIN_MINER_OPENCL_ 23 | 24 | #include 25 | 26 | typedef struct 27 | { 28 | cl_uint m_AH[8]; 29 | cl_uint m_merkle; 30 | cl_uint m_ntime; 31 | cl_uint m_nbits; 32 | cl_uint m_nonce; 33 | }remote_opencl_in; 34 | 35 | typedef struct 36 | { 37 | cl_uint m_bestnonce; 38 | cl_uint m_bestAH[8]; 39 | }remote_opencl_out; 40 | 41 | void remote_cuda_process_helper(remote_opencl_in *in, remote_opencl_out *out, unsigned char *metahash, const unsigned int loops, const unsigned int bits, const int grid, const int threads); 42 | 43 | #endif // _BITCOIN_MINER_OPENCL_ 44 | 45 | #endif // _remote_opencl_shared_ 46 | -------------------------------------------------------------------------------- /src/remote/remoteminerclient.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _remote_miner_client_ 20 | #define _remote_miner_client_ 21 | 22 | #include 23 | #include 24 | 25 | #ifdef _WIN32 26 | #include 27 | #include 28 | #endif 29 | 30 | #include "../minercommon/minerheaders.h" 31 | #include "remoteminermessage.h" 32 | #include "remoteminerthreadcpu.h" 33 | #include "remoteminerthreadgpu.h" 34 | #include "../cryptopp/sha.h" 35 | 36 | class RemoteMinerClient 37 | { 38 | public: 39 | RemoteMinerClient(); 40 | virtual ~RemoteMinerClient(); 41 | 42 | virtual void Run(const std::string &server, const std::string &port, const std::string &password, const std::string &address, const int threadcount=1); 43 | 44 | const bool Connect(const std::string &server, const std::string &port); 45 | const bool Disconnect(); 46 | const bool IsConnected() const { return m_socket!=INVALID_SOCKET; } 47 | 48 | void SendMessage(const RemoteMinerMessage &message); 49 | const bool MessageReady() const; 50 | const bool ProtocolError() const; 51 | const bool ReceiveMessage(RemoteMinerMessage &message); 52 | 53 | protected: 54 | #ifdef _WIN32 55 | static bool m_wsastartup; 56 | #endif 57 | 58 | void SocketSend(); 59 | void SocketReceive(); 60 | const bool Update(const int ms=100); 61 | 62 | const bool EncodeBase64(const std::vector &data, std::string &encoded) const; 63 | const bool DecodeBase64(const std::string &encoded, std::vector &decoded) const; 64 | 65 | void SendClientHello(const std::string &password, const std::string &address); 66 | void SendMetaHash(const int64 blockid, const unsigned int startnonce, const std::vector &digest, const uint256 &besthash, const unsigned int besthashnonce); 67 | void SendWorkRequest(); 68 | void SendFoundHash(const int64 blockid, const unsigned int nonce); 69 | 70 | void HandleMessage(const RemoteMinerMessage &message); 71 | 72 | const bool FindGenerationAddressInBlock(const uint160 address, json_spirit::Object &obj, double &amount) const; 73 | const std::string ReverseAddressHex(const uint160 address) const; 74 | 75 | void SaveBlock(json_spirit::Object &block, const std::string &filename); 76 | 77 | const std::string GetTimeStr(const time_t timet) const; 78 | 79 | uint160 m_address160; 80 | bool m_gotserverhello; 81 | SOCKET m_socket; 82 | std::vector m_receivebuffer; 83 | std::vector m_sendbuffer; 84 | std::vector m_tempbuffer; 85 | fd_set m_readfs; 86 | fd_set m_writefs; 87 | struct timeval m_timeval; 88 | unsigned int m_metahashsize; 89 | 90 | #if defined(_BITCOIN_MINER_CUDA_) || defined(_BITCOIN_MINER_OPENCL_) 91 | typedef RemoteMinerThreadGPU threadtype; 92 | #else 93 | typedef RemoteMinerThreadCPU threadtype; 94 | #endif 95 | 96 | RemoteMinerThreads m_minerthreads; 97 | }; 98 | 99 | #endif // _remote_miner_client_ 100 | -------------------------------------------------------------------------------- /src/remote/remoteminermessage.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #include "remoteminermessage.h" 20 | 21 | RemoteMinerMessage::RemoteMinerMessage() 22 | { 23 | 24 | } 25 | 26 | RemoteMinerMessage::RemoteMinerMessage(const json_spirit::Value &value):m_value(value) 27 | { 28 | 29 | } 30 | 31 | RemoteMinerMessage::~RemoteMinerMessage() 32 | { 33 | 34 | } 35 | 36 | const std::vector RemoteMinerMessage::GetWireData() const 37 | { 38 | char flags=0; 39 | std::string jsonstr=json_spirit::write(m_value); 40 | std::vector data; 41 | data.reserve(jsonstr.size()+4); 42 | data.push_back(REMOTEMINER_PROTOCOL_VERSION); // protocol version; 43 | 44 | if(jsonstr.size()>=65535) 45 | { 46 | flags|=FLAG_4BYTESIZE; 47 | } 48 | 49 | data.push_back(flags); 50 | 51 | if((flags & FLAG_4BYTESIZE)!=FLAG_4BYTESIZE) 52 | { 53 | data.push_back((jsonstr.size() >> 8) & 0xff); // size 54 | data.push_back(jsonstr.size() & 0xff); // size 55 | } 56 | else 57 | { 58 | data.push_back((jsonstr.size() >> 24) & 0xff); 59 | data.push_back((jsonstr.size() >> 16) & 0xff); 60 | data.push_back((jsonstr.size() >> 8) & 0xff); 61 | data.push_back(jsonstr.size() & 0xff); 62 | } 63 | 64 | data.insert(data.end(),jsonstr.begin(),jsonstr.end()); // json object 65 | 66 | return data; 67 | } 68 | 69 | bool RemoteMinerMessage::MessageReady(const std::vector &buffer) 70 | { 71 | if(buffer.size()>4 && buffer[0]==REMOTEMINER_PROTOCOL_VERSION) 72 | { 73 | char flags=buffer[1]; 74 | unsigned long messagesize=0; 75 | unsigned long headersize=4; 76 | 77 | if((flags & FLAG_4BYTESIZE)!=FLAG_4BYTESIZE) 78 | { 79 | headersize=4; 80 | messagesize|=(buffer[2] << 8) & 0xff00; 81 | messagesize|=(buffer[3]) & 0xff; 82 | } 83 | else 84 | { 85 | if(buffer.size()>=6) 86 | { 87 | headersize=6; 88 | messagesize|=(buffer[2] << 24) & 0xff000000; 89 | messagesize|=(buffer[3] << 16) & 0xff0000; 90 | messagesize|=(buffer[4] << 8) & 0xff00; 91 | messagesize|=buffer[5] & 0xff; 92 | } 93 | else 94 | { 95 | return false; 96 | } 97 | } 98 | 99 | if(buffer.size()>=headersize+messagesize) 100 | { 101 | return true; 102 | } 103 | } 104 | 105 | return false; 106 | } 107 | 108 | bool RemoteMinerMessage::ProtocolError(const std::vector &buffer) 109 | { 110 | if(buffer.size()>0 && buffer[0]!=REMOTEMINER_PROTOCOL_VERSION) 111 | { 112 | return true; 113 | } 114 | else 115 | { 116 | return false; 117 | } 118 | } 119 | 120 | void RemoteMinerMessage::PushWireData(std::vector &buffer) const 121 | { 122 | char flags=0; 123 | std::string jsonstr=json_spirit::write(m_value); 124 | buffer.reserve(buffer.size()+jsonstr.size()+4); 125 | 126 | buffer.push_back(REMOTEMINER_PROTOCOL_VERSION); 127 | 128 | if(jsonstr.size()>=65535) 129 | { 130 | flags|=FLAG_4BYTESIZE; 131 | } 132 | 133 | buffer.push_back(flags); 134 | 135 | if((flags & FLAG_4BYTESIZE)!=FLAG_4BYTESIZE) 136 | { 137 | buffer.push_back((jsonstr.size() >> 8) & 0xff); // size 138 | buffer.push_back(jsonstr.size() & 0xff); // size 139 | } 140 | else 141 | { 142 | buffer.push_back((jsonstr.size() >> 24) & 0xff); 143 | buffer.push_back((jsonstr.size() >> 16) & 0xff); 144 | buffer.push_back((jsonstr.size() >> 8) & 0xff); 145 | buffer.push_back(jsonstr.size() & 0xff); 146 | } 147 | 148 | buffer.insert(buffer.end(),jsonstr.begin(),jsonstr.end()); 149 | } 150 | 151 | bool RemoteMinerMessage::ReceiveMessage(std::vector &buffer, RemoteMinerMessage &message) 152 | { 153 | if(MessageReady(buffer)==true) 154 | { 155 | char flags=buffer[1]; 156 | unsigned long messagesize=0; 157 | unsigned long headersize=4; 158 | 159 | if((flags & FLAG_4BYTESIZE)!=FLAG_4BYTESIZE) 160 | { 161 | headersize=4; 162 | messagesize|=(buffer[2] << 8) & 0xff00; 163 | messagesize|=(buffer[3]) & 0xff; 164 | } 165 | else 166 | { 167 | if(buffer.size()>=6) 168 | { 169 | headersize=6; 170 | messagesize|=(buffer[2] << 24) & 0xff000000; 171 | messagesize|=(buffer[3] << 16) & 0xff0000; 172 | messagesize|=(buffer[4] << 8) & 0xff00; 173 | messagesize|=buffer[5] & 0xff; 174 | } 175 | else 176 | { 177 | return false; 178 | } 179 | } 180 | 181 | if(buffer.size()>=headersize+messagesize) 182 | { 183 | std::string objstr(buffer.begin()+headersize,buffer.begin()+headersize+messagesize); 184 | json_spirit::Value value; 185 | bool jsonread=json_spirit::read(objstr,value); 186 | if(jsonread) 187 | { 188 | message=RemoteMinerMessage(value); 189 | } 190 | buffer.erase(buffer.begin(),buffer.begin()+headersize+messagesize); 191 | return jsonread; 192 | } 193 | } 194 | return false; 195 | } 196 | -------------------------------------------------------------------------------- /src/remote/remoteminermessage.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _remote_miner_message_ 20 | #define _remote_miner_message_ 21 | 22 | #include "../json/json_spirit.h" 23 | #include 24 | 25 | const int REMOTEMINER_PROTOCOL_VERSION=2; 26 | 27 | class RemoteMinerMessage 28 | { 29 | public: 30 | RemoteMinerMessage(); 31 | RemoteMinerMessage(const json_spirit::Value &value); 32 | ~RemoteMinerMessage(); 33 | 34 | const json_spirit::Value GetValue() const { return m_value; } 35 | 36 | const std::vector GetWireData() const; 37 | void PushWireData(std::vector &buffer) const; 38 | 39 | static bool MessageReady(const std::vector &buffer); 40 | static bool ReceiveMessage(std::vector &buffer, RemoteMinerMessage &message); 41 | static bool ProtocolError(const std::vector &buffer); 42 | 43 | enum RemoteMinerMessageType 44 | { 45 | MESSAGE_TYPE_NONE=0, 46 | MESSAGE_TYPE_CLIENTHELLO=1, 47 | MESSAGE_TYPE_SERVERHELLO=2, 48 | MESSAGE_TYPE_CLIENTGETWORK=3, 49 | MESSAGE_TYPE_SERVERSENDWORK=4, 50 | MESSAGE_TYPE_SERVERSTOPPED=5, 51 | MESSAGE_TYPE_CLIENTSTOPPED=6, 52 | MESSAGE_TYPE_CLIENTHASHRATE=7, 53 | MESSAGE_TYPE_CLIENTMETAHASH=8, 54 | MESSAGE_TYPE_CLIENTFOUNDHASH=9, 55 | MESSAGE_TYPE_SERVERSTATUS=10, 56 | MESSAGE_TYPE_MAX 57 | }; 58 | 59 | enum Flag 60 | { 61 | FLAG_4BYTESIZE=1, 62 | }; 63 | 64 | private: 65 | json_spirit::Value m_value; 66 | }; 67 | 68 | #endif // _remote_miner_message_ 69 | -------------------------------------------------------------------------------- /src/remote/remoteminerthreadcpu.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _remoteminer_thread_cpu_ 20 | #define _remoteminer_thread_cpu_ 21 | 22 | #include "remoteminerthread.h" 23 | 24 | class RemoteMinerThreadCPU:public RemoteMinerThread 25 | { 26 | public: 27 | RemoteMinerThreadCPU(); 28 | ~RemoteMinerThreadCPU(); 29 | 30 | virtual const bool Start() 31 | { 32 | m_threaddata.m_done=false; 33 | m_threaddata.m_havework=false; 34 | m_threaddata.m_generate=true; 35 | m_threaddata.m_nextblock.m_blockid=0; 36 | FreeMetaHashPointers(); 37 | if(!CreateThread(RemoteMinerThreadCPU::Run,&m_threaddata)) 38 | { 39 | m_threaddata.m_done=true; 40 | return false; 41 | } 42 | return true; 43 | } 44 | 45 | private: 46 | static void Run(void *arg); 47 | 48 | }; 49 | 50 | #endif // _remoteminer_thread_cpu_ 51 | -------------------------------------------------------------------------------- /src/remote/remoteminerthreadgpu.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _remoteminer_thread_gpu_ 20 | #define _remoteminer_thread_gpu_ 21 | 22 | #if defined(_BITCOIN_MINER_CUDA_) || defined(_BITCOIN_MINER_OPENCL_) 23 | 24 | #include "remoteminerthread.h" 25 | #include "cuda/bitcoinminercuda.h" 26 | #include "opencl/bitcoinmineropencl.h" 27 | 28 | class RemoteMinerThreadGPU:public RemoteMinerThread 29 | { 30 | public: 31 | RemoteMinerThreadGPU(); 32 | ~RemoteMinerThreadGPU(); 33 | 34 | virtual const bool Start() 35 | { 36 | m_threaddata.m_done=false; 37 | m_threaddata.m_havework=false; 38 | m_threaddata.m_generate=true; 39 | m_threaddata.m_nextblock.m_blockid=0; 40 | FreeMetaHashPointers(); 41 | if(!CreateThread(RemoteMinerThreadGPU::Run,&m_threaddata)) 42 | { 43 | m_threaddata.m_done=true; 44 | return false; 45 | } 46 | return true; 47 | } 48 | 49 | private: 50 | static void Run(void *arg); 51 | 52 | #ifdef _BITCOIN_MINER_CUDA_ 53 | typedef RemoteCUDARunner gpurunnertype; 54 | #elif defined(_BITCOIN_MINER_OPENCL_) 55 | typedef RemoteOpenCLRunner gpurunnertype; 56 | #endif 57 | }; 58 | 59 | #endif // defined(_BITCOIN_MINER_CUDA_) || defined(_BITCOIN_MINER_OPENCL_) 60 | 61 | #endif // _remoteminer_thread_cuda_ 62 | -------------------------------------------------------------------------------- /src/remote/timestats.h: -------------------------------------------------------------------------------- 1 | #ifndef _timestats_ 2 | #define _timestats_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class TimeStats 9 | { 10 | public: 11 | TimeStats(const std::string &filename, const int64 writedelay):m_lastwritemillis(GetTimeMillis()), 12 | m_filename(filename),m_writedelay(writedelay) 13 | { 14 | 15 | } 16 | 17 | ~TimeStats() 18 | { 19 | WriteStats(); 20 | } 21 | 22 | void Add(const std::string §ion, const int64 callcount, const int64 usec) 23 | { 24 | m_stats[section].first+=callcount; 25 | m_stats[section].second+=usec; 26 | if((m_lastwritemillis+m_writedelay) >::const_iterator i=m_stats.begin(); i!=m_stats.end(); i++) 42 | { 43 | outfile << (*i).first << "\t" << (*i).second.first << "\t" << (*i).second.second << std::endl; 44 | } 45 | outfile.close(); 46 | } 47 | } 48 | 49 | private: 50 | std::string m_filename; 51 | int64 m_writedelay; 52 | int64 m_lastwritemillis; 53 | std::map > m_stats; 54 | }; 55 | 56 | class ScopedTimer 57 | { 58 | public: 59 | ScopedTimer(TimeStats &ts,const std::string §ion):m_ts(ts),m_section(section) { m_startmicros=boost::posix_time::microsec_clock::local_time(); } 60 | ~ScopedTimer() { m_ts.Add(m_section,1,(boost::posix_time::microsec_clock::local_time()-m_startmicros).total_microseconds()); } 61 | 62 | private: 63 | 64 | TimeStats &m_ts; 65 | boost::posix_time::ptime m_startmicros; 66 | std::string m_section; 67 | 68 | }; 69 | 70 | #endif // _timestats_ 71 | -------------------------------------------------------------------------------- /src/remoteminermain.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #include "minercommon/minerheaders.h" 20 | #include "remote/remoteminerclient.h" 21 | 22 | #include 23 | 24 | bool fTestNet=false; 25 | std::map mapArgs; 26 | std::map > mapMultiArgs; 27 | 28 | void ParseParameters(int argc, char* argv[]) 29 | { 30 | mapArgs.clear(); 31 | mapMultiArgs.clear(); 32 | for (int i = 1; i < argc; i++) 33 | { 34 | char psz[10000]; 35 | strlcpy(psz, argv[i], sizeof(psz)); 36 | char* pszValue = (char*)""; 37 | if (strchr(psz, '=')) 38 | { 39 | pszValue = strchr(psz, '='); 40 | *pszValue++ = '\0'; 41 | } 42 | #ifdef __WXMSW__ 43 | _strlwr(psz); 44 | if (psz[0] == '/') 45 | psz[0] = '-'; 46 | #endif 47 | if (psz[0] != '-') 48 | break; 49 | mapArgs[psz] = pszValue; 50 | mapMultiArgs[psz].push_back(pszValue); 51 | } 52 | } 53 | 54 | int main(int argc, char *argv[]) 55 | { 56 | 57 | std::string server("127.0.0.1"); 58 | std::string port("8335"); 59 | std::string password(""); 60 | std::string address(""); 61 | int threadcount=1; 62 | 63 | ParseParameters(argc,argv); 64 | 65 | if(mapArgs.count("-server")>0) 66 | { 67 | server=mapArgs["-server"]; 68 | } 69 | if(mapArgs.count("-port")>0) 70 | { 71 | port=mapArgs["-port"]; 72 | } 73 | if(mapArgs.count("-password")>0) 74 | { 75 | password=mapArgs["-password"]; 76 | } 77 | if(mapArgs.count("-address")>0) 78 | { 79 | address=mapArgs["-address"]; 80 | uint160 h160; 81 | if(AddressToHash160(address.c_str(),h160)==false) 82 | { 83 | std::cout << "Address is invalid" << std::endl; 84 | address=""; 85 | } 86 | } 87 | if(mapArgs.count("-threads")>0) 88 | { 89 | std::istringstream istr(mapArgs["-threads"]); 90 | istr >> threadcount; 91 | } 92 | else 93 | { 94 | #if !defined(_BITCOIN_MINER_CUDA_) && !defined(_BITCOIN_MINER_OPENCL_) 95 | threadcount=boost::thread::hardware_concurrency(); 96 | #endif 97 | } 98 | 99 | RemoteMinerClient client; 100 | 101 | client.Run(server,port,password,address,threadcount); 102 | 103 | return 0; 104 | } 105 | -------------------------------------------------------------------------------- /src/rpc.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Satoshi Nakamoto 2 | // Distributed under the MIT/X11 software license, see the accompanying 3 | // file license.txt or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef _bitcoin_rpc_h_ 6 | #define _bitcoin_rpc_h_ 7 | 8 | void ThreadRPCServer(void* parg); 9 | int CommandLineRPC(int argc, char *argv[]); 10 | 11 | #endif // _bitcoin_rpc_h_ 12 | -------------------------------------------------------------------------------- /src/rpcminer/hex.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #include "hex.h" 20 | 21 | namespace Hex 22 | { 23 | 24 | static const std::string hexchars="0123456789abcdef"; 25 | 26 | const bool Encode(const std::vector &data, std::string &encoded) 27 | { 28 | encoded.reserve(data.size()*2); 29 | for(std::vector::const_iterator i=data.begin(); i!=data.end(); i++) 30 | { 31 | encoded.push_back(hexchars[(((*i)>>4) & 0x0F)]); 32 | encoded.push_back(hexchars[((*i) & 0x0F)]); 33 | } 34 | return true; 35 | } 36 | 37 | const bool Decode(const std::string &encoded, std::vector &data) 38 | { 39 | 40 | std::string::size_type pos=0; 41 | unsigned char byte; 42 | int bytepart=0; 43 | std::string enc(encoded); 44 | 45 | // make upper case lower case 46 | for(std::string::iterator i=enc.begin(); i!=enc.end(); i++) 47 | { 48 | if((*i)>=65 && (*i)<71) 49 | { 50 | (*i)=(*i)+32; 51 | } 52 | } 53 | 54 | data.reserve(enc.size()/2); 55 | 56 | pos=enc.find_first_of(hexchars); 57 | 58 | while(pos!=std::string::npos) 59 | { 60 | if(bytepart==0) 61 | { 62 | byte=(hexchars.find(enc[pos]) << 4) & 0xF0; 63 | bytepart=1; 64 | } 65 | else 66 | { 67 | byte|=hexchars.find(enc[pos]) & 0x0F; 68 | data.push_back(byte); 69 | bytepart=0; 70 | } 71 | pos=enc.find_first_of(hexchars,pos+1); 72 | } 73 | return true; 74 | } 75 | 76 | } // namespace 77 | -------------------------------------------------------------------------------- /src/rpcminer/hex.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _hex_funcs_ 20 | #define _hex_funcs_ 21 | 22 | #include 23 | #include 24 | 25 | namespace Hex 26 | { 27 | 28 | const bool Encode(const std::vector &data, std::string &encoded); 29 | const bool Decode(const std::string &encoded, std::vector &data); 30 | 31 | }; 32 | 33 | #endif _hex_funcs_ 34 | -------------------------------------------------------------------------------- /src/rpcminer/httprequest.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #include "httprequest.h" 20 | #include 21 | #include 22 | #include 23 | 24 | HTTPRequest::HTTPRequest(const std::string &url):m_url(url) 25 | { 26 | 27 | } 28 | 29 | HTTPRequest::~HTTPRequest() 30 | { 31 | 32 | } 33 | 34 | const bool HTTPRequest::DoRequest(std::string &result) 35 | { 36 | m_writebuff.clear(); 37 | //m_readbuff.assign(data.begin(),data.end()); 38 | m_readbuff.clear(); 39 | 40 | CURL *curl=0; 41 | struct curl_slist *headers=0; 42 | int rval; 43 | 44 | curl=curl_easy_init(); 45 | 46 | curl_easy_setopt(curl,CURLOPT_URL,m_url.c_str()); 47 | curl_easy_setopt(curl,CURLOPT_ENCODING,""); 48 | curl_easy_setopt(curl,CURLOPT_FAILONERROR,1); 49 | curl_easy_setopt(curl,CURLOPT_TCP_NODELAY,1); 50 | curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,HTTPRequest::WriteData); 51 | curl_easy_setopt(curl,CURLOPT_WRITEDATA,this); 52 | curl_easy_setopt(curl,CURLOPT_READFUNCTION,HTTPRequest::ReadData); 53 | curl_easy_setopt(curl,CURLOPT_READDATA,this); 54 | /* 55 | if(m_user!="" && m_password!="") 56 | { 57 | std::string userpass(m_user+":"+m_password); 58 | curl_easy_setopt(curl,CURLOPT_USERPWD,userpass.c_str()); 59 | curl_easy_setopt(curl,CURLOPT_HTTPAUTH,CURLAUTH_BASIC); 60 | } 61 | curl_easy_setopt(curl,CURLOPT_POST,1); 62 | */ 63 | 64 | /* 65 | std::ostringstream istr; 66 | istr << m_readbuff.size(); 67 | std::string headersize("Content-Length: "+istr.str()); 68 | */ 69 | 70 | //headers=curl_slist_append(headers,"Content-type: application/json"); 71 | //headers=curl_slist_append(headers,headersize.c_str()); 72 | headers=curl_slist_append(headers,"Expect:"); 73 | 74 | curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); 75 | 76 | rval=curl_easy_perform(curl); 77 | 78 | if(m_writebuff.size()>0) 79 | { 80 | result.assign(m_writebuff.begin(),m_writebuff.end()); 81 | } 82 | else 83 | { 84 | result=""; 85 | } 86 | 87 | curl_slist_free_all(headers); 88 | curl_easy_cleanup(curl); 89 | 90 | return (rval==0); 91 | } 92 | 93 | size_t HTTPRequest::ReadData(void *ptr, size_t size, size_t nmemb, void *user_data) 94 | { 95 | size_t readlen=size*nmemb; 96 | HTTPRequest *req=(HTTPRequest *)user_data; 97 | 98 | readlen=(std::min)(req->m_readbuff.size(),readlen); 99 | 100 | if(readlen>0) 101 | { 102 | ::memcpy(ptr,&req->m_readbuff[0],readlen); 103 | 104 | req->m_readbuff.erase(req->m_readbuff.begin(),req->m_readbuff.begin()+readlen); 105 | } 106 | 107 | return readlen; 108 | } 109 | 110 | size_t HTTPRequest::WriteData(void *ptr, size_t size, size_t nmemb, void *user_data) 111 | { 112 | size_t writelen=size*nmemb; 113 | HTTPRequest *req=(HTTPRequest *)user_data; 114 | 115 | if(writelen>0) 116 | { 117 | std::vector::size_type startpos=req->m_writebuff.size(); 118 | req->m_writebuff.resize(req->m_writebuff.size()+writelen); 119 | ::memcpy(&req->m_writebuff[startpos],ptr,writelen); 120 | } 121 | 122 | return writelen; 123 | } 124 | -------------------------------------------------------------------------------- /src/rpcminer/httprequest.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _http_request_ 20 | #define _http_request_ 21 | 22 | #include 23 | #include 24 | 25 | class HTTPRequest 26 | { 27 | public: 28 | HTTPRequest(const std::string &url); 29 | ~HTTPRequest(); 30 | 31 | const bool DoRequest(std::string &result); 32 | 33 | private: 34 | 35 | static size_t WriteData(void *ptr, size_t size, size_t nmemb, void *user_data); 36 | static size_t ReadData(void *ptr, size_t size, size_t nmemb, void *user_data); 37 | 38 | std::string m_url; 39 | 40 | std::vector m_writebuff; 41 | std::vector m_readbuff; 42 | }; 43 | 44 | #endif // _http_request_ 45 | -------------------------------------------------------------------------------- /src/rpcminer/rpcminerclient.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _rpcminer_client_ 20 | #define _rpcminer_client_ 21 | 22 | #include 23 | #include 24 | 25 | #include "../json/json_spirit.h" 26 | #include "../minercommon/minerheaders.h" 27 | #include "rpcminerthreadcpu.h" 28 | #include "rpcminerthreadgpu.h" 29 | #include "../cryptopp/sha.h" 30 | 31 | class RPCMinerClient 32 | { 33 | public: 34 | RPCMinerClient(); 35 | virtual ~RPCMinerClient(); 36 | 37 | virtual void Run(const std::string &url, const std::string &user, const std::string &password, const int threadcount=1); 38 | void SetServerStatsURL(const std::string &url) { m_serverstatsurl=url; } 39 | void SetWorkRefreshMS(const int ms) { m_workrefreshms=ms; } 40 | 41 | protected: 42 | 43 | const bool EncodeBase64(const std::vector &data, std::string &encoded) const; 44 | const bool DecodeBase64(const std::string &encoded, std::vector &decoded) const; 45 | 46 | void SendWorkRequest(); 47 | void SendFoundHash(const int64 blockid, const unsigned int nonce); 48 | const bool GetServerStats(json_spirit::Object &stats); 49 | 50 | void PrintServerStats(json_spirit::Object &stats); 51 | 52 | void SaveBlock(json_spirit::Object &block, const std::string &filename); 53 | 54 | const std::string GetTimeStr(const time_t timet) const; 55 | 56 | void CleanupOldBlocks(); 57 | 58 | #if defined(_BITCOIN_MINER_CUDA_) || defined(_BITCOIN_MINER_OPENCL_) 59 | typedef RPCMinerThreadGPU threadtype; 60 | #else 61 | typedef RPCMinerThreadCPU threadtype; 62 | #endif 63 | 64 | RPCMinerThreads m_minerthreads; 65 | int64 m_blockid; 66 | std::string m_url; 67 | std::string m_user; 68 | std::string m_password; 69 | std::map > > m_blocklookup; 70 | uint256 m_lasttarget; 71 | std::string m_serverstatsurl; 72 | int m_workrefreshms; 73 | int m_threadcount; 74 | }; 75 | 76 | #endif // _rpcminer_client_ 77 | -------------------------------------------------------------------------------- /src/rpcminer/rpcminerthreadcpu.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #include "rpcminerthreadcpu.h" 20 | 21 | extern void DoubleBlockSHA256(const void* pin, void* pout, const void* pinit, unsigned int hash[8][32], const void* init2); 22 | 23 | RPCMinerThreadCPU::RPCMinerThreadCPU() 24 | { 25 | } 26 | 27 | RPCMinerThreadCPU::~RPCMinerThreadCPU() 28 | { 29 | } 30 | 31 | void RPCMinerThreadCPU::Run(void *arg) 32 | { 33 | threaddata *td=(threaddata *)arg; 34 | int64 currentblockid=-1; 35 | 36 | static const unsigned int SHA256InitState[8] ={0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19}; 37 | uint256 tempbuff[4]; 38 | uint256 &temphash=*alignup<16>(tempbuff); 39 | uint256 hashbuff[4]; 40 | uint256 &hash=*alignup<16>(hashbuff); 41 | uint256 currenttarget; 42 | 43 | unsigned char currentmidbuff[256]; 44 | unsigned char currentblockbuff[256]; 45 | volatile unsigned char *midbuffptr; 46 | volatile unsigned char *blockbuffptr; 47 | volatile unsigned int *nonce; 48 | midbuffptr=alignup<16>(currentmidbuff); 49 | blockbuffptr=alignup<16>(currentblockbuff); 50 | nonce=(unsigned int *)(blockbuffptr+12); 51 | 52 | #ifdef FOURWAYSSE2 53 | unsigned int fourwayhashbuf[9][32]; 54 | unsigned int (&fourwayhash)[9][32]=*alignup<16>(&fourwayhashbuf); 55 | #endif 56 | 57 | SetThreadPriority(THREAD_PRIORITY_LOWEST); 58 | 59 | FormatHashBlocks(&temphash,sizeof(temphash)); 60 | for(int i=0; i<64/4; i++) 61 | { 62 | ((unsigned int*)&temphash)[i] = CryptoPP::ByteReverse(((unsigned int*)&temphash)[i]); 63 | } 64 | 65 | (*nonce)=0; 66 | 67 | while(td->m_generate) 68 | { 69 | if(td->m_havework) 70 | { 71 | CRITICAL_BLOCK(td->m_cs); 72 | if(currentblockid!=td->m_nextblock.m_blockid) 73 | { 74 | currenttarget=td->m_nextblock.m_target; 75 | currentblockid=td->m_nextblock.m_blockid; 76 | ::memcpy((void *)midbuffptr,&td->m_nextblock.m_midstate[0],32); 77 | ::memcpy((void *)blockbuffptr,&td->m_nextblock.m_block[0],64); 78 | ::memcpy(&temphash,&td->m_nextblock.m_hash1[0],64); 79 | (*nonce)=0; 80 | } 81 | 82 | #ifdef FOURWAYSSE2 83 | 84 | for(int iter=0; iter<100; iter++) 85 | { 86 | DoubleBlockSHA256((void *)blockbuffptr,&temphash,(void *)midbuffptr,fourwayhash,SHA256InitState); 87 | 88 | for(int i=0; i<32; i++) 89 | { 90 | if(fourwayhash[7][i]==0) 91 | { 92 | for (int j = 0; j < sizeof(hash)/4; j++) 93 | { 94 | ((unsigned int*)&hash)[j] = CryptoPP::ByteReverse(fourwayhash[j][i]); 95 | } 96 | 97 | if(hash<=currenttarget) 98 | { 99 | CRITICAL_BLOCK(td->m_cs); 100 | td->m_foundhashes.push_back(foundhash(currentblockid,(*nonce)+i)); 101 | } 102 | } 103 | } 104 | 105 | (*nonce)+=32; 106 | } 107 | 108 | { 109 | CRITICAL_BLOCK(td->m_cs); 110 | td->m_hashcount+=32*100; 111 | } 112 | 113 | #else // FOURWAYSSE2 114 | 115 | // do 10000 hashes at a time 116 | for(unsigned int i=0; i<10000; i++) 117 | { 118 | SHA256Transform(&temphash,(void *)blockbuffptr,(void *)midbuffptr); 119 | SHA256Transform(&hash,&temphash,SHA256InitState); 120 | 121 | if((((unsigned int*)&hash)[7]==0)) 122 | { 123 | for (int i = 0; i < sizeof(hash)/4; i++) 124 | { 125 | ((unsigned int*)&hash)[i] = CryptoPP::ByteReverse(((unsigned int*)&hash)[i]); 126 | } 127 | 128 | if(hash<=currenttarget) 129 | { 130 | CRITICAL_BLOCK(td->m_cs); 131 | 132 | td->m_foundhashes.push_back(foundhash(currentblockid,(*nonce))); 133 | } 134 | } 135 | 136 | (*nonce)++; 137 | } 138 | 139 | { 140 | CRITICAL_BLOCK(td->m_cs); 141 | td->m_hashcount+=10000; 142 | } 143 | 144 | #endif // FOURWAYSSE2 145 | 146 | } 147 | else 148 | { 149 | Sleep(100); 150 | } 151 | } 152 | 153 | { 154 | CRITICAL_BLOCK(td->m_cs); 155 | td->m_done=true; 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /src/rpcminer/rpcminerthreadcpu.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _rpcthread_cpu_ 20 | #define _rpcthread_cpu_ 21 | 22 | #include "rpcminerthread.h" 23 | 24 | class RPCMinerThreadCPU:public RPCMinerThread 25 | { 26 | public: 27 | RPCMinerThreadCPU(); 28 | ~RPCMinerThreadCPU(); 29 | 30 | virtual const bool Start() 31 | { 32 | m_threaddata.m_done=false; 33 | m_threaddata.m_havework=false; 34 | m_threaddata.m_generate=true; 35 | m_threaddata.m_nextblock.m_blockid=0; 36 | m_threaddata.m_hashcount=0; 37 | if(!CreateThread(RPCMinerThreadCPU::Run,&m_threaddata)) 38 | { 39 | m_threaddata.m_done=true; 40 | return false; 41 | } 42 | return true; 43 | } 44 | 45 | private: 46 | static void Run(void *arg); 47 | 48 | }; 49 | 50 | #endif // _rpcthread_cpu_ 51 | -------------------------------------------------------------------------------- /src/rpcminer/rpcminerthreadgpu.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #if defined(_BITCOIN_MINER_CUDA_) || defined(_BITCOIN_MINER_OPENCL_) 20 | 21 | #include "rpcminerthreadgpu.h" 22 | 23 | RPCMinerThreadGPU::RPCMinerThreadGPU() 24 | { 25 | } 26 | 27 | RPCMinerThreadGPU::~RPCMinerThreadGPU() 28 | { 29 | } 30 | 31 | void RPCMinerThreadGPU::Run(void *arg) 32 | { 33 | threaddata *td=(threaddata *)arg; 34 | int64 currentblockid=-1; 35 | 36 | static const unsigned int SHA256InitState[8] ={0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19}; 37 | uint256 tempbuff[4]; 38 | uint256 &temphash=*alignup<16>(tempbuff); 39 | uint256 hashbuff[4]; 40 | uint256 &hash=*alignup<16>(hashbuff); 41 | uint256 currenttarget; 42 | 43 | unsigned char currentmidbuff[256]; 44 | unsigned char currentblockbuff[256]; 45 | volatile unsigned char *midbuffptr; 46 | volatile unsigned char *blockbuffptr; 47 | volatile unsigned int *nonce; 48 | unsigned int gpunonce; 49 | midbuffptr=alignup<16>(currentmidbuff); 50 | blockbuffptr=alignup<16>(currentblockbuff); 51 | nonce=(unsigned int *)(blockbuffptr+12); 52 | 53 | gpurunnertype gpu; 54 | 55 | if(gpu.GetDeviceIndex()<0) 56 | { 57 | return; 58 | } 59 | 60 | SetThreadPriority(THREAD_PRIORITY_LOWEST); 61 | 62 | FormatHashBlocks(&temphash,sizeof(temphash)); 63 | for(int i=0; i<64/4; i++) 64 | { 65 | ((unsigned int*)&temphash)[i] = CryptoPP::ByteReverse(((unsigned int*)&temphash)[i]); 66 | } 67 | 68 | (*nonce)=0; 69 | 70 | gpu.FindBestConfiguration(); 71 | 72 | int iterations=10000/(gpu.GetStepIterations()+gpu.GetNumBlocks()+gpu.GetNumThreads()); 73 | 74 | while(td->m_generate) 75 | { 76 | if(td->m_havework) 77 | { 78 | 79 | CRITICAL_BLOCK(td->m_cs); 80 | if(currentblockid!=td->m_nextblock.m_blockid) 81 | { 82 | currenttarget=td->m_nextblock.m_target; 83 | currentblockid=td->m_nextblock.m_blockid; 84 | ::memcpy((void *)midbuffptr,&td->m_nextblock.m_midstate[0],32); 85 | ::memcpy((void *)blockbuffptr,&td->m_nextblock.m_block[0],64); 86 | ::memcpy(&temphash,&td->m_nextblock.m_hash1[0],64); 87 | (*nonce)=0; 88 | for(int i=0; i<8; i++) 89 | { 90 | gpu.GetIn()->m_AH[i]=((unsigned int *)midbuffptr)[i]; 91 | } 92 | gpu.GetIn()->m_merkle=((unsigned int *)blockbuffptr)[0]; 93 | gpu.GetIn()->m_ntime=((unsigned int *)blockbuffptr)[1]; 94 | gpu.GetIn()->m_nbits=((unsigned int *)blockbuffptr)[2]; 95 | } 96 | 97 | for(int i=0; im_nonce=(*nonce); 100 | 101 | gpunonce=gpu.RunStep(); 102 | if(gpunonce!=0) 103 | { 104 | (*nonce)=CryptoPP::ByteReverse(gpunonce); 105 | SHA256Transform(&temphash,(void *)blockbuffptr,(void *)midbuffptr); 106 | SHA256Transform(&hash,&temphash,SHA256InitState); 107 | 108 | if(hashm_cs); 111 | 112 | td->m_foundhashes.push_back(foundhash(currentblockid,(*nonce))); 113 | } 114 | 115 | } 116 | 117 | (*nonce)+=(gpu.GetStepIterations()*gpu.GetNumBlocks()*gpu.GetNumThreads()); 118 | 119 | { 120 | CRITICAL_BLOCK(td->m_cs); 121 | td->m_hashcount+=(gpu.GetStepIterations()*gpu.GetNumBlocks()*gpu.GetNumThreads()); 122 | } 123 | 124 | } 125 | 126 | } 127 | else 128 | { 129 | Sleep(100); 130 | } 131 | 132 | } 133 | 134 | { 135 | CRITICAL_BLOCK(td->m_cs); 136 | td->m_done=true; 137 | } 138 | 139 | } 140 | 141 | #endif // defined(_BITCOIN_MINER_CUDA_) || defined(_BITCOIN_MINER_OPENCL_) 142 | -------------------------------------------------------------------------------- /src/rpcminer/rpcminerthreadgpu.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _rpcthread_gpu_ 20 | #define _rpcthread_gpu_ 21 | 22 | #if defined(_BITCOIN_MINER_CUDA_) || defined(_BITCOIN_MINER_OPENCL_) 23 | 24 | #include "rpcminerthread.h" 25 | #include "../cuda/bitcoinminercuda.h" 26 | #include "../opencl/bitcoinmineropencl.h" 27 | 28 | class RPCMinerThreadGPU:public RPCMinerThread 29 | { 30 | public: 31 | RPCMinerThreadGPU(); 32 | ~RPCMinerThreadGPU(); 33 | 34 | virtual const bool Start() 35 | { 36 | m_threaddata.m_done=false; 37 | m_threaddata.m_havework=false; 38 | m_threaddata.m_generate=true; 39 | m_threaddata.m_nextblock.m_blockid=0; 40 | m_threaddata.m_hashcount=0; 41 | if(!CreateThread(RPCMinerThreadGPU::Run,&m_threaddata)) 42 | { 43 | m_threaddata.m_done=true; 44 | return false; 45 | } 46 | return true; 47 | } 48 | 49 | private: 50 | static void Run(void *arg); 51 | 52 | #ifdef _BITCOIN_MINER_CUDA_ 53 | typedef CUDARunner gpurunnertype; 54 | #elif defined(_BITCOIN_MINER_OPENCL_) 55 | typedef OpenCLRunner gpurunnertype; 56 | #endif 57 | }; 58 | 59 | #endif // defined(_BITCOIN_MINER_CUDA_) || defined(_BITCOIN_MINER_OPENCL_) 60 | 61 | #endif // _rpcthread_gpu_ 62 | -------------------------------------------------------------------------------- /src/rpcminer/rpcrequest.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #include "rpcrequest.h" 20 | #include 21 | #include 22 | #include 23 | 24 | RPCRequest::RPCRequest(const std::string &url, const std::string &user, const std::string &password):m_url(url),m_user(user),m_password(password) 25 | { 26 | 27 | } 28 | 29 | RPCRequest::~RPCRequest() 30 | { 31 | 32 | } 33 | 34 | const bool RPCRequest::DoRequest(const std::string &data, std::string &result) 35 | { 36 | m_writebuff.clear(); 37 | m_readbuff.assign(data.begin(),data.end()); 38 | 39 | CURL *curl=0; 40 | struct curl_slist *headers=0; 41 | int rval; 42 | 43 | curl=curl_easy_init(); 44 | 45 | curl_easy_setopt(curl,CURLOPT_URL,m_url.c_str()); 46 | curl_easy_setopt(curl,CURLOPT_ENCODING,""); 47 | curl_easy_setopt(curl,CURLOPT_FAILONERROR,1); 48 | curl_easy_setopt(curl,CURLOPT_TCP_NODELAY,1); 49 | curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,RPCRequest::WriteData); 50 | curl_easy_setopt(curl,CURLOPT_WRITEDATA,this); 51 | curl_easy_setopt(curl,CURLOPT_READFUNCTION,RPCRequest::ReadData); 52 | curl_easy_setopt(curl,CURLOPT_READDATA,this); 53 | if(m_user!="" && m_password!="") 54 | { 55 | std::string userpass(m_user+":"+m_password); 56 | curl_easy_setopt(curl,CURLOPT_USERPWD,userpass.c_str()); 57 | curl_easy_setopt(curl,CURLOPT_HTTPAUTH,CURLAUTH_BASIC); 58 | } 59 | curl_easy_setopt(curl,CURLOPT_POST,1); 60 | 61 | std::ostringstream istr; 62 | istr << m_readbuff.size(); 63 | std::string headersize("Content-Length: "+istr.str()); 64 | 65 | headers=curl_slist_append(headers,"Content-type: application/json"); 66 | headers=curl_slist_append(headers,headersize.c_str()); 67 | headers=curl_slist_append(headers,"Expect:"); 68 | 69 | curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); 70 | 71 | rval=curl_easy_perform(curl); 72 | 73 | if(m_writebuff.size()>0) 74 | { 75 | result.assign(m_writebuff.begin(),m_writebuff.end()); 76 | } 77 | else 78 | { 79 | result=""; 80 | } 81 | 82 | curl_slist_free_all(headers); 83 | curl_easy_cleanup(curl); 84 | 85 | return (rval==0); 86 | } 87 | 88 | size_t RPCRequest::ReadData(void *ptr, size_t size, size_t nmemb, void *user_data) 89 | { 90 | size_t readlen=size*nmemb; 91 | RPCRequest *req=(RPCRequest *)user_data; 92 | 93 | readlen=(std::min)(req->m_readbuff.size(),readlen); 94 | 95 | if(readlen>0) 96 | { 97 | ::memcpy(ptr,&req->m_readbuff[0],readlen); 98 | 99 | req->m_readbuff.erase(req->m_readbuff.begin(),req->m_readbuff.begin()+readlen); 100 | } 101 | 102 | return readlen; 103 | } 104 | 105 | size_t RPCRequest::WriteData(void *ptr, size_t size, size_t nmemb, void *user_data) 106 | { 107 | size_t writelen=size*nmemb; 108 | RPCRequest *req=(RPCRequest *)user_data; 109 | 110 | if(writelen>0) 111 | { 112 | std::vector::size_type startpos=req->m_writebuff.size(); 113 | req->m_writebuff.resize(req->m_writebuff.size()+writelen); 114 | ::memcpy(&req->m_writebuff[startpos],ptr,writelen); 115 | } 116 | 117 | return writelen; 118 | } 119 | -------------------------------------------------------------------------------- /src/rpcminer/rpcrequest.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (C) 2010 puddinpop 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, write to the Free Software Foundation, Inc., 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | **/ 18 | 19 | #ifndef _rpc_request_ 20 | #define _rpc_request_ 21 | 22 | #include 23 | #include 24 | #include 25 | #include "../headers.h" 26 | 27 | #include 28 | 29 | class RPCRequest 30 | { 31 | public: 32 | RPCRequest(const std::string &url, const std::string &user, const std::string &password); 33 | ~RPCRequest(); 34 | 35 | const bool DoRequest(const std::string &data, std::string &result); 36 | 37 | private: 38 | 39 | static size_t WriteData(void *ptr, size_t size, size_t nmemb, void *user_data); 40 | static size_t ReadData(void *ptr, size_t size, size_t nmemb, void *user_data); 41 | 42 | std::string m_url; 43 | std::string m_user; 44 | std::string m_password; 45 | 46 | std::vector m_writebuff; 47 | std::vector m_readbuff; 48 | }; 49 | 50 | #endif // _rpc_request_ 51 | -------------------------------------------------------------------------------- /src/setup.nsi: -------------------------------------------------------------------------------- 1 | # Auto-generated by EclipseNSIS Script Wizard 2 | # 3.10.2009 19:00:28 3 | 4 | Name Bitcoin 5 | 6 | RequestExecutionLevel highest 7 | 8 | # General Symbol Definitions 9 | !define REGKEY "SOFTWARE\$(^Name)" 10 | !define VERSION 0.3.17 11 | !define COMPANY "Bitcoin project" 12 | !define URL http://www.bitcoin.org/ 13 | 14 | # MUI Symbol Definitions 15 | !define MUI_ICON "src\rc\bitcoin.ico" 16 | !define MUI_FINISHPAGE_NOAUTOCLOSE 17 | !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM 18 | !define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY} 19 | !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup 20 | !define MUI_STARTMENUPAGE_DEFAULTFOLDER Bitcoin 21 | !define MUI_FINISHPAGE_RUN $INSTDIR\bitcoin.exe 22 | !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" 23 | !define MUI_UNFINISHPAGE_NOAUTOCLOSE 24 | 25 | # Included files 26 | !include Sections.nsh 27 | !include MUI2.nsh 28 | 29 | # Variables 30 | Var StartMenuGroup 31 | 32 | # Installer pages 33 | !insertmacro MUI_PAGE_WELCOME 34 | !insertmacro MUI_PAGE_DIRECTORY 35 | !insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup 36 | !insertmacro MUI_PAGE_INSTFILES 37 | !insertmacro MUI_PAGE_FINISH 38 | !insertmacro MUI_UNPAGE_CONFIRM 39 | !insertmacro MUI_UNPAGE_INSTFILES 40 | 41 | # Installer languages 42 | !insertmacro MUI_LANGUAGE English 43 | 44 | # Installer attributes 45 | OutFile bitcoin-0.3.17-win32-setup.exe 46 | InstallDir $PROGRAMFILES\Bitcoin 47 | CRCCheck on 48 | XPStyle on 49 | ShowInstDetails show 50 | VIProductVersion 0.3.17.0 51 | VIAddVersionKey ProductName Bitcoin 52 | VIAddVersionKey ProductVersion "${VERSION}" 53 | VIAddVersionKey CompanyName "${COMPANY}" 54 | VIAddVersionKey CompanyWebsite "${URL}" 55 | VIAddVersionKey FileVersion "${VERSION}" 56 | VIAddVersionKey FileDescription "" 57 | VIAddVersionKey LegalCopyright "" 58 | InstallDirRegKey HKCU "${REGKEY}" Path 59 | ShowUninstDetails show 60 | 61 | # Installer sections 62 | Section -Main SEC0000 63 | SetOutPath $INSTDIR 64 | SetOverwrite on 65 | File bitcoin.exe 66 | File libeay32.dll 67 | File mingwm10.dll 68 | File license.txt 69 | File readme.txt 70 | SetOutPath $INSTDIR\daemon 71 | File /r daemon\*.* 72 | SetOutPath $INSTDIR\locale 73 | File /r locale\*.* 74 | SetOutPath $INSTDIR\src 75 | File /r src\*.* 76 | SetOutPath $INSTDIR 77 | WriteRegStr HKCU "${REGKEY}\Components" Main 1 78 | SectionEnd 79 | 80 | Section -post SEC0001 81 | WriteRegStr HKCU "${REGKEY}" Path $INSTDIR 82 | SetOutPath $INSTDIR 83 | WriteUninstaller $INSTDIR\uninstall.exe 84 | !insertmacro MUI_STARTMENU_WRITE_BEGIN Application 85 | CreateDirectory $SMPROGRAMS\$StartMenuGroup 86 | CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Bitcoin.lnk" $INSTDIR\bitcoin.exe 87 | CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall Bitcoin.lnk" $INSTDIR\uninstall.exe 88 | !insertmacro MUI_STARTMENU_WRITE_END 89 | WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)" 90 | WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}" 91 | WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}" 92 | WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}" 93 | WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe 94 | WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe 95 | WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1 96 | WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1 97 | SectionEnd 98 | 99 | # Macro for selecting uninstaller sections 100 | !macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID 101 | Push $R0 102 | ReadRegStr $R0 HKCU "${REGKEY}\Components" "${SECTION_NAME}" 103 | StrCmp $R0 1 0 next${UNSECTION_ID} 104 | !insertmacro SelectSection "${UNSECTION_ID}" 105 | GoTo done${UNSECTION_ID} 106 | next${UNSECTION_ID}: 107 | !insertmacro UnselectSection "${UNSECTION_ID}" 108 | done${UNSECTION_ID}: 109 | Pop $R0 110 | !macroend 111 | 112 | # Uninstaller sections 113 | Section /o -un.Main UNSEC0000 114 | Delete /REBOOTOK $INSTDIR\bitcoin.exe 115 | Delete /REBOOTOK $INSTDIR\libeay32.dll 116 | Delete /REBOOTOK $INSTDIR\mingwm10.dll 117 | Delete /REBOOTOK $INSTDIR\license.txt 118 | Delete /REBOOTOK $INSTDIR\readme.txt 119 | RMDir /r /REBOOTOK $INSTDIR\daemon 120 | RMDir /r /REBOOTOK $INSTDIR\locale 121 | RMDir /r /REBOOTOK $INSTDIR\src 122 | DeleteRegValue HKCU "${REGKEY}\Components" Main 123 | SectionEnd 124 | 125 | Section -un.post UNSEC0001 126 | DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" 127 | Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall Bitcoin.lnk" 128 | Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Bitcoin.lnk" 129 | Delete /REBOOTOK "$SMSTARTUP\Bitcoin.lnk" 130 | Delete /REBOOTOK $INSTDIR\uninstall.exe 131 | Delete /REBOOTOK $INSTDIR\debug.log 132 | Delete /REBOOTOK $INSTDIR\db.log 133 | DeleteRegValue HKCU "${REGKEY}" StartMenuGroup 134 | DeleteRegValue HKCU "${REGKEY}" Path 135 | DeleteRegKey /IfEmpty HKCU "${REGKEY}\Components" 136 | DeleteRegKey /IfEmpty HKCU "${REGKEY}" 137 | RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup 138 | RmDir /REBOOTOK $INSTDIR 139 | Push $R0 140 | StrCpy $R0 $StartMenuGroup 1 141 | StrCmp $R0 ">" no_smgroup 142 | no_smgroup: 143 | Pop $R0 144 | SectionEnd 145 | 146 | # Installer functions 147 | Function .onInit 148 | InitPluginsDir 149 | FunctionEnd 150 | 151 | # Uninstaller functions 152 | Function un.onInit 153 | ReadRegStr $INSTDIR HKCU "${REGKEY}" Path 154 | !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup 155 | !insertmacro SELECT_UNSECTION Main ${UNSEC0000} 156 | FunctionEnd 157 | -------------------------------------------------------------------------------- /src/strlcpy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1998 Todd C. Miller 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef _bitcoin_strlcpy_h_ 18 | #define _bitcoin_strlcpy_h_ 19 | 20 | /* 21 | * Copy src to string dst of size siz. At most siz-1 characters 22 | * will be copied. Always NUL terminates (unless siz == 0). 23 | * Returns strlen(src); if retval >= siz, truncation occurred. 24 | */ 25 | inline size_t strlcpy(char *dst, const char *src, size_t siz) 26 | { 27 | char *d = dst; 28 | const char *s = src; 29 | size_t n = siz; 30 | 31 | /* Copy as many bytes as will fit */ 32 | if (n != 0) 33 | { 34 | while (--n != 0) 35 | { 36 | if ((*d++ = *s++) == '\0') 37 | break; 38 | } 39 | } 40 | 41 | /* Not enough room in dst, add NUL and traverse rest of src */ 42 | if (n == 0) 43 | { 44 | if (siz != 0) 45 | *d = '\0'; /* NUL-terminate dst */ 46 | while (*s++) 47 | ; 48 | } 49 | 50 | return(s - src - 1); /* count does not include NUL */ 51 | } 52 | 53 | /* 54 | * Appends src to string dst of size siz (unlike strncat, siz is the 55 | * full size of dst, not space left). At most siz-1 characters 56 | * will be copied. Always NUL terminates (unless siz <= strlen(dst)). 57 | * Returns strlen(src) + MIN(siz, strlen(initial dst)). 58 | * If retval >= siz, truncation occurred. 59 | */ 60 | inline size_t strlcat(char *dst, const char *src, size_t siz) 61 | { 62 | char *d = dst; 63 | const char *s = src; 64 | size_t n = siz; 65 | size_t dlen; 66 | 67 | /* Find the end of dst and adjust bytes left but don't go past end */ 68 | while (n-- != 0 && *d != '\0') 69 | d++; 70 | dlen = d - dst; 71 | n = siz - dlen; 72 | 73 | if (n == 0) 74 | return(dlen + strlen(s)); 75 | while (*s != '\0') 76 | { 77 | if (n != 1) 78 | { 79 | *d++ = *s; 80 | n--; 81 | } 82 | s++; 83 | } 84 | *d = '\0'; 85 | 86 | return(dlen + (s - src)); /* count does not include NUL */ 87 | } 88 | 89 | #endif // _bitcoin_strlcpy_h_ 90 | -------------------------------------------------------------------------------- /src/ui.rc: -------------------------------------------------------------------------------- 1 | bitcoin ICON "rc/bitcoin.ico" 2 | 3 | #include "wx/msw/wx.rc" 4 | 5 | check ICON "rc/check.ico" 6 | send16 BITMAP "rc/send16.bmp" 7 | send16mask BITMAP "rc/send16mask.bmp" 8 | send16masknoshadow BITMAP "rc/send16masknoshadow.bmp" 9 | send20 BITMAP "rc/send20.bmp" 10 | send20mask BITMAP "rc/send20mask.bmp" 11 | addressbook16 BITMAP "rc/addressbook16.bmp" 12 | addressbook16mask BITMAP "rc/addressbook16mask.bmp" 13 | addressbook20 BITMAP "rc/addressbook20.bmp" 14 | addressbook20mask BITMAP "rc/addressbook20mask.bmp" 15 | favicon ICON "rc/favicon.ico" 16 | -------------------------------------------------------------------------------- /src/xpm/addressbook16.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * addressbook16_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 16 256 2", 5 | " c #FFFFFF", 6 | ". c #F7FFFF", 7 | "X c #F7F7FF", 8 | "o c #EFF7FF", 9 | "O c #E6EFF7", 10 | "+ c #E6E6F7", 11 | "@ c #CEE6F7", 12 | "# c #DEDEEF", 13 | "$ c #D6DEEF", 14 | "% c #D6DEE6", 15 | "& c #CEDEF7", 16 | "* c #CEDEEF", 17 | "= c #EFF708", 18 | "- c #C5DEF7", 19 | "; c #CED6EF", 20 | ": c None", 21 | "> c #C5D6E6", 22 | ", c #BDD6F7", 23 | "< c #BDD6EF", 24 | "1 c #D6CECE", 25 | "2 c #BDCEE6", 26 | "3 c #BDC5E6", 27 | "4 c #B5C5DE", 28 | "5 c #BDD631", 29 | "6 c #ADBDDE", 30 | "7 c #B5B5BD", 31 | "8 c #A5B5D6", 32 | "9 c #00FFFF", 33 | "0 c #9CB5CE", 34 | "q c #9CADD6", 35 | "w c #94A5D6", 36 | "e c #8CA5D6", 37 | "r c #8CA5CE", 38 | "t c #8CA5C5", 39 | "y c #849CC5", 40 | "u c #7B9CD6", 41 | "i c #7B9CCE", 42 | "p c #31BDCE", 43 | "a c #6B9CD6", 44 | "s c #00F708", 45 | "d c #8494AD", 46 | "f c #7B94B5", 47 | "g c #6B94D6", 48 | "h c #6B9C84", 49 | "j c #7B8CAD", 50 | "k c #738CAD", 51 | "l c #638CC5", 52 | "z c #10CE42", 53 | "x c #638CBD", 54 | "c c #7B849C", 55 | "v c #73849C", 56 | "b c #6B84A5", 57 | "n c #7B7BA5", 58 | "m c #6B849C", 59 | "M c #7B8C42", 60 | "N c #5A84C5", 61 | "B c #29AD6B", 62 | "V c #F74A4A", 63 | "C c #6384A5", 64 | "Z c #5284C5", 65 | "A c #637BA5", 66 | "S c #637B9C", 67 | "D c #9C637B", 68 | "F c #6B7B5A", 69 | "G c #637394", 70 | "H c #52739C", 71 | "J c #5A7384", 72 | "K c #526B94", 73 | "L c #426B94", 74 | "P c #52638C", 75 | "I c #426B7B", 76 | "U c #5A5A8C", 77 | "Y c #524A7B", 78 | "T c #425273", 79 | "R c #21636B", 80 | "E c #106394", 81 | "W c #106B52", 82 | "Q c #3A4273", 83 | "! c #31426B", 84 | "~ c #523163", 85 | "^ c #29426B", 86 | "/ c #293A63", 87 | "( c #213A63", 88 | ") c #193A63", 89 | "_ c #193163", 90 | "` c #19315A", 91 | "' c #212963", 92 | "] c #10315A", 93 | "[ c #082952", 94 | "{ c #FFCC33", 95 | "} c #33FF33", 96 | "| c #66FF33", 97 | " . c #99FF33", 98 | ".. c #CCFF33", 99 | "X. c #FFFF33", 100 | "o. c #000066", 101 | "O. c #330066", 102 | "+. c #660066", 103 | "@. c #990066", 104 | "#. c #CC0066", 105 | "$. c #FF0066", 106 | "%. c #003366", 107 | "&. c #333366", 108 | "*. c #663366", 109 | "=. c #993366", 110 | "-. c #CC3366", 111 | ";. c #FF3366", 112 | ":. c #006666", 113 | ">. c #336666", 114 | ",. c #666666", 115 | "<. c #996666", 116 | "1. c #CC6666", 117 | "2. c #009966", 118 | "3. c #339966", 119 | "4. c #669966", 120 | "5. c #999966", 121 | "6. c #CC9966", 122 | "7. c #FF9966", 123 | "8. c #00CC66", 124 | "9. c #33CC66", 125 | "0. c #99CC66", 126 | "q. c #CCCC66", 127 | "w. c #FFCC66", 128 | "e. c #00FF66", 129 | "r. c #33FF66", 130 | "t. c #99FF66", 131 | "y. c #CCFF66", 132 | "u. c #FF00CC", 133 | "i. c #CC00FF", 134 | "p. c #009999", 135 | "a. c #993399", 136 | "s. c #990099", 137 | "d. c #CC0099", 138 | "f. c #000099", 139 | "g. c #333399", 140 | "h. c #660099", 141 | "j. c #CC3399", 142 | "k. c #FF0099", 143 | "l. c #006699", 144 | "z. c #336699", 145 | "x. c #663399", 146 | "c. c #996699", 147 | "v. c #CC6699", 148 | "b. c #FF3399", 149 | "n. c #339999", 150 | "m. c #669999", 151 | "M. c #999999", 152 | "N. c #CC9999", 153 | "B. c #FF9999", 154 | "V. c #00CC99", 155 | "C. c #33CC99", 156 | "Z. c #66CC66", 157 | "A. c #99CC99", 158 | "S. c #CCCC99", 159 | "D. c #FFCC99", 160 | "F. c #00FF99", 161 | "G. c #33FF99", 162 | "H. c #66CC99", 163 | "J. c #99FF99", 164 | "K. c #CCFF99", 165 | "L. c #FFFF99", 166 | "P. c #0000CC", 167 | "I. c #330099", 168 | "U. c #6600CC", 169 | "Y. c #9900CC", 170 | "T. c #CC00CC", 171 | "R. c #003399", 172 | "E. c #3333CC", 173 | "W. c #6633CC", 174 | "Q. c #9933CC", 175 | "!. c #CC33CC", 176 | "~. c #FF33CC", 177 | "^. c #0066CC", 178 | "/. c #3366CC", 179 | "(. c #666699", 180 | "). c #9966CC", 181 | "_. c #CC66CC", 182 | "`. c #FF6699", 183 | "'. c #0099CC", 184 | "]. c #3399CC", 185 | "[. c #6699CC", 186 | "{. c #9999CC", 187 | "}. c #CC99CC", 188 | "|. c #FF99CC", 189 | " X c #00CCCC", 190 | ".X c #33CCCC", 191 | "XX c #66CCCC", 192 | "oX c #99CCCC", 193 | "OX c #CCCCCC", 194 | "+X c #FFCCCC", 195 | "@X c #00FFCC", 196 | "#X c #33FFCC", 197 | "$X c #66FF99", 198 | "%X c #99FFCC", 199 | "&X c #CCFFCC", 200 | "*X c #FFFFCC", 201 | "=X c #3300CC", 202 | "-X c #6600FF", 203 | ";X c #9900FF", 204 | ":X c #0033CC", 205 | ">X c #3333FF", 206 | ",X c #6633FF", 207 | " g , S z R : ", 268 | "n * c * r r y g , 6 r q S s W : ", 269 | "n * c X 4 N u + m B I : ", 270 | "n * c X ; a - S 5 F : ", 271 | "n * c * r r r g - S = M : ", 272 | "n * c X 4 N - m h J : ", 273 | "n * c X ; a - A 9 E : ", 274 | "n * ( ] ` ^ P l y T / / ( p L : ", 275 | "n O > 0 f ) ! t 8 % n : ", 276 | "U U U U U U U ' Q U U U U U U : ", 277 | ": : : : : : : : : : : : : : : : " 278 | }; 279 | -------------------------------------------------------------------------------- /src/xpm/bitcoin16.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * bitcoin16_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 16 197 2", 5 | " c #755507", 6 | ". c #775606", 7 | "X c #795707", 8 | "o c #7D5A07", 9 | "O c #765608", 10 | "+ c #74550A", 11 | "@ c #75550A", 12 | "# c #75560A", 13 | "$ c #785708", 14 | "% c #78580B", 15 | "& c #7D5C0B", 16 | "* c #78590E", 17 | "= c #7E5F14", 18 | "- c #8A6711", 19 | "; c #8D6B15", 20 | ": c #8A691A", 21 | "> c #93711C", 22 | ", c #9D7A23", 23 | "< c #9F7B22", 24 | "1 c #9C7B2A", 25 | "2 c #9E7C28", 26 | "3 c #A37F26", 27 | "4 c #B4831B", 28 | "5 c #A68126", 29 | "6 c #A5852E", 30 | "7 c #A9872E", 31 | "8 c #AC862D", 32 | "9 c #AC872F", 33 | "0 c #AF8B30", 34 | "q c #AC8932", 35 | "w c #AF8A34", 36 | "e c #B08E36", 37 | "r c #B98F33", 38 | "t c #B18E3A", 39 | "y c #B39036", 40 | "u c #B69237", 41 | "i c #B3913B", 42 | "p c #B6923C", 43 | "a c #BD9338", 44 | "s c #B9993F", 45 | "d c #BA993F", 46 | "f c #C2932D", 47 | "g c #C09437", 48 | "h c #C59832", 49 | "j c #C39836", 50 | "k c #C89835", 51 | "l c #C59C3D", 52 | "z c #CF9E3E", 53 | "x c #CFA23F", 54 | "c c #D0A13A", 55 | "v c #D3A23A", 56 | "b c #D4A338", 57 | "n c #D6A33F", 58 | "m c #B19345", 59 | "M c #BF9940", 60 | "N c #BF9D43", 61 | "B c #B3954B", 62 | "V c #BD9A48", 63 | "C c #BC9C4B", 64 | "Z c #BD9F51", 65 | "A c #CAA244", 66 | "S c #C2A14B", 67 | "D c #C4A44B", 68 | "F c #C1A24C", 69 | "G c #C7A64C", 70 | "H c #C5A64E", 71 | "J c #C9A94F", 72 | "K c #D1A343", 73 | "L c #D7A644", 74 | "P c #D5A547", 75 | "I c #D6A547", 76 | "U c #DCAD42", 77 | "Y c #DDAB45", 78 | "T c #C3A151", 79 | "R c #C9A551", 80 | "E c #CAAA50", 81 | "W c #CBAD53", 82 | "Q c #CDAC52", 83 | "! c #CEA855", 84 | "~ c #CEB15A", 85 | "^ c #DEB154", 86 | "/ c #D1B35A", 87 | "( c #D7B35A", 88 | ") c #D8B45D", 89 | "_ c #E3B34A", 90 | "` c #E2B34E", 91 | "' c #E6B54F", 92 | "] c #E2B350", 93 | "[ c #E3B352", 94 | "{ c #E4B451", 95 | "} c #E2B355", 96 | "| c #E7B853", 97 | " . c #E9BC51", 98 | ".. c #ECBC53", 99 | "X. c #E7BE5A", 100 | "o. c #E2BA5C", 101 | "O. c #E2BC5C", 102 | "+. c #E9BB59", 103 | "@. c #EBBE59", 104 | "#. c #EABD5B", 105 | "$. c #E8BF5C", 106 | "%. c #E9BE5E", 107 | "&. c #C8AC63", 108 | "*. c #D0B162", 109 | "=. c #D5B567", 110 | "-. c #DABC62", 111 | ";. c #D2B66B", 112 | ":. c #D0B56D", 113 | ">. c #DCBC6E", 114 | ",. c #D2B972", 115 | "<. c #D7BE78", 116 | "1. c #E9BE62", 117 | "2. c #EEC05A", 118 | "3. c #F0C25F", 119 | "4. c #DEC26B", 120 | "5. c #DDC27A", 121 | "6. c #E0C167", 122 | "7. c #E5C067", 123 | "8. c #EBC463", 124 | "9. c #EEC460", 125 | "0. c #ECC364", 126 | "q. c #E4C16B", 127 | "w. c #E7C46B", 128 | "e. c #E9C56C", 129 | "r. c #E0C172", 130 | "t. c #E5C575", 131 | "y. c #E4C870", 132 | "u. c #E6CA72", 133 | "i. c #E6CA74", 134 | "p. c #E8CB73", 135 | "a. c #E9CE76", 136 | "s. c #EBD07B", 137 | "d. c #EED179", 138 | "f. c #F5D478", 139 | "g. c #F5D57C", 140 | "h. c #F4D67C", 141 | "j. c #F4D77E", 142 | "k. c #DEC781", 143 | "l. c #E0C883", 144 | "z. c #E3CA89", 145 | "x. c #E4CB8B", 146 | "c. c #E3CD8A", 147 | "v. c #E5CE8B", 148 | "b. c #E3CC8E", 149 | "n. c #E8D18D", 150 | "m. c #F6D980", 151 | "M. c #F7DB83", 152 | "N. c #F3DA86", 153 | "B. c #F7DA84", 154 | "V. c #F6DB84", 155 | "C. c #F7DB84", 156 | "Z. c #F7DA86", 157 | "A. c #F6DC85", 158 | "S. c #F7DC85", 159 | "D. c #F8DB85", 160 | "F. c #FADD85", 161 | "G. c #FBDE86", 162 | "H. c #F5DE8B", 163 | "J. c #FADD88", 164 | "K. c #F9DF8B", 165 | "L. c #E4CF93", 166 | "P. c #E6CF92", 167 | "I. c #E6D094", 168 | "U. c #EAD597", 169 | "Y. c #EBD698", 170 | "T. c #EFDA99", 171 | "R. c #F0DC9C", 172 | "E. c #FCE089", 173 | "W. c #FCE28B", 174 | "Q. c #FDE28B", 175 | "!. c #FCE38C", 176 | "~. c #FCE28D", 177 | "^. c #FCE38D", 178 | "/. c #FDE38D", 179 | "(. c #FEE38D", 180 | "). c #FDE38E", 181 | "_. c #FEE48D", 182 | "`. c #FEE58F", 183 | "'. c #FCE490", 184 | "]. c #FDE490", 185 | "[. c #FFE590", 186 | "{. c #FFE690", 187 | "}. c #FFE691", 188 | "|. c #FEE791", 189 | " X c #FFE692", 190 | ".X c #FFE792", 191 | "XX c #FEE693", 192 | "oX c #FFE693", 193 | "OX c #FFE793", 194 | "+X c #FEE897", 195 | "@X c #F6E2A2", 196 | "#X c #F7E3A2", 197 | "$X c #FAE6A8", 198 | "%X c #FBE7A9", 199 | "&X c #FCE9AB", 200 | "*X c #FDEAAC", 201 | "=X c None", 202 | /* pixels */ 203 | "=X=X=X=X=X0 S G D i =X=X=X=X=X=X", 204 | "=X=X=X9 6.).).).).).d.e =X=X=X=X", 205 | "=X=Xu C.J.O.( h ( o.D.).J & =X=X", 206 | "=X0 S.j.f 4 b.e P.K @.j.'.d % =X", 207 | "=X4.).k a T Y.&.Y.R 2.2.F.S.- =X", 208 | "e '.e.z ! v.&X,.k.*X:. .%.`.d # ", 209 | "H +X^ I P =.*X9 j T.k.U ' F.-.% ", 210 | "W '.` { } >.*X<.n.*XC b Y g.u.X ", 211 | "W |.` { 3.t.&Xm C c.%Xa n m.u.. ", 212 | "N '.9...@.r.&Xi A 5.*XM L W.~ . ", 213 | "5 m.f._ *.#X&XR.#X%X:.v 0.'.7 # ", 214 | "=XQ `.@.l t P.B I.u v { G.a.o =X", 215 | "=X3 u.W.0.A z.V b.+.1.J.E., # =X", 216 | "=X=X3 u.oXF.e.7.q.C.+XH.6 # =X=X", 217 | "=X=X=X=XS s.'.'.'.C.~ ; * =X=X=X", 218 | "=X=X=X=X=X=X1 1 > : = =X=X=X=X=X" 219 | }; 220 | -------------------------------------------------------------------------------- /src/xpm/bitcoin20.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * bitcoin20_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "20 20 134 2", 5 | " c #735305", 6 | ". c #785706", 7 | "X c #7E5C07", 8 | "o c #755509", 9 | "O c #76580D", 10 | "+ c #7F6015", 11 | "@ c #85620D", 12 | "# c #89650D", 13 | "$ c #836215", 14 | "% c #886510", 15 | "& c #8E6B11", 16 | "* c #81641F", 17 | "= c #906D19", 18 | "- c #977116", 19 | "; c #96741E", 20 | ": c #9B761E", 21 | "> c #947424", 22 | ", c #9B7722", 23 | "< c #9D7824", 24 | "1 c #A47F23", 25 | "2 c #A17D2A", 26 | "3 c #A58125", 27 | "4 c #AA8327", 28 | "5 c #A4832F", 29 | "6 c #AD862B", 30 | "7 c #B28B2E", 31 | "8 c #A58433", 32 | "9 c #A88637", 33 | "0 c #AD8932", 34 | "q c #A78639", 35 | "w c #A8893C", 36 | "e c #B28C34", 37 | "r c #B88E33", 38 | "t c #B28E3A", 39 | "y c #B79136", 40 | "u c #BB9235", 41 | "i c #BB9639", 42 | "p c #C19836", 43 | "a c #C29539", 44 | "s c #C59C3C", 45 | "d c #A88B41", 46 | "f c #AF9045", 47 | "g c #B49342", 48 | "h c #BE9641", 49 | "j c #BD9B44", 50 | "k c #B29448", 51 | "l c #B7994B", 52 | "z c #B8994C", 53 | "x c #C09946", 54 | "c c #CB9E46", 55 | "v c #C59D4C", 56 | "b c #CFA246", 57 | "n c #CBAB47", 58 | "m c #CEA74A", 59 | "M c #D4A749", 60 | "N c #D6A94D", 61 | "B c #C7A754", 62 | "V c #CEA453", 63 | "C c #C6AA56", 64 | "Z c #CDA955", 65 | "A c #CBAB5B", 66 | "S c #D2AB54", 67 | "D c #D2AE5E", 68 | "F c #D9AE5A", 69 | "G c #D7B356", 70 | "H c #DDB35F", 71 | "J c #DFB95A", 72 | "K c #E1B554", 73 | "L c #E4BA56", 74 | "P c #E6BC5A", 75 | "I c #E9BE5E", 76 | "U c #C7AC64", 77 | "Y c #CBAF64", 78 | "T c #CDB166", 79 | "R c #D4B364", 80 | "E c #DBB463", 81 | "W c #DFB867", 82 | "Q c #D5B76B", 83 | "! c #DFBA6F", 84 | "~ c #D5BB76", 85 | "^ c #D7BE79", 86 | "/ c #E3BC64", 87 | "( c #E8BF64", 88 | ") c #E0BB68", 89 | "_ c #DECA7A", 90 | "` c #EBC265", 91 | "' c #EBC36B", 92 | "] c #EFC96B", 93 | "[ c #F1C564", 94 | "{ c #F3CB6A", 95 | "} c #F9CD6C", 96 | "| c #FAD16C", 97 | " . c #E5C770", 98 | ".. c #EEC774", 99 | "X. c #E6CE7E", 100 | "o. c #EFCE7A", 101 | "O. c #F1CB73", 102 | "+. c #F4CE7A", 103 | "@. c #F3D273", 104 | "#. c #FCD574", 105 | "$. c #FEDA76", 106 | "%. c #F5D47D", 107 | "&. c #FAD47B", 108 | "*. c #F2D97D", 109 | "=. c #FCDA7A", 110 | "-. c #DDC784", 111 | ";. c #E1CA86", 112 | ":. c #E4CE8B", 113 | ">. c #ECD985", 114 | ",. c #E7D18E", 115 | "<. c #F4DC84", 116 | "1. c #FCDC81", 117 | "2. c #F4DB8B", 118 | "3. c #FBDF8B", 119 | "4. c #EBD592", 120 | "5. c #EFDA99", 121 | "6. c #F1DD9C", 122 | "7. c #F6E081", 123 | "8. c #FDE484", 124 | "9. c #FFEA87", 125 | "0. c #F9E488", 126 | "q. c #FEE88D", 127 | "w. c #F9E394", 128 | "e. c #FFEB93", 129 | "r. c #FEE698", 130 | "t. c #FEEA9B", 131 | "y. c #FFF49A", 132 | "u. c #F7E4A4", 133 | "i. c #F9E5A5", 134 | "p. c #FCE9AA", 135 | "a. c #F7F0AA", 136 | "s. c #FEF1AE", 137 | "d. c #FEF6B3", 138 | "f. c None", 139 | /* pixels */ 140 | "f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.", 141 | "f.f.f.f.f.f.f.0 y i i 0 , f.f.f.f.f.f.f.", 142 | "f.f.f.f.3 p P | $.| } { I p ; f.f.f.f.f.", 143 | "f.f.f.4 L | $.{ L K L ` =.#.` 3 $ f.f.f.", 144 | "f.f.6 [ $.{ M a Q 0 Q S ' %.q.*.6 o f.f.", 145 | "f.3 ' $.P i u r ,.< :.S +.%.0.y.*.& f.f.", 146 | "f.C e.%.c x T Y 6.U 5.T R @.#.0.9.n . f.", 147 | "f.>.t.W F A ^ p.u.~ -.p.i.C { { =.@.# f.", 148 | "e e.3.E H / j p.6.0 V ~ p.Y ( ` #.$.3 o ", 149 | "j p.2.( ( ! Z p.6.l R 6.6.t I I { #.y o ", 150 | "j e.1.( ! +.H i.i.-.:.i.u.R N K ` #.u ", 151 | "i 9.&.( ..1.) p.6.8 j w p.p.h N ' #.7 ", 152 | "4 =.7.` ....Z p.6.g D T p.i.t M [ } - o ", 153 | "f.J =.{ ` E i.p.p.i.p.p.6.k u M } K @ o ", 154 | "f.7 @.@./ S z f 4.d ,.q 2 r a ( { 6 f.", 155 | "f.f.m @.O.( / V 4.q :.v V V O.&.G X O f.", 156 | "f.f.: G 1.0.+.W R D R ! 4.d.d._ # f.f.", 157 | "f.f.f.2 C a.i.r.w.w.i.s.d.p.Y @ f.f.f.", 158 | "f.f.f.f.f.5 Z .<.3.2.X.A > . f.f.f.f.", 159 | "f.f.f.f.f.f.f.> > = # $ + f.f.f.f.f.f.f." 160 | }; 161 | -------------------------------------------------------------------------------- /src/xpm/check.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * check_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "32 32 3 1", 5 | " c #008000", 6 | ". c #00FF00", 7 | "X c None", 8 | /* pixels */ 9 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 10 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 11 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 12 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 13 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 14 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 15 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 16 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 17 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 18 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 19 | "XXXXXXXXXXXXXXXXX XXXXXXXXXXXX", 20 | "XXXXXXXXXXXXXXXXX . XXXXXXXXXXX", 21 | "XXXXXXXXXXXXXXXX .. XXXXXXXXXXXX", 22 | "XXXXXXXXXXXXXXXX . XXXXXXXXXXXX", 23 | "XXXXXXXXXXXXXXX .. XXXXXXXXXXXXX", 24 | "XXXXXXXXXXX XX . XXXXXXXXXXXXX", 25 | "XXXXXXXXXXX . .. XXXXXXXXXXXXXX", 26 | "XXXXXXXXXXX .. . XXXXXXXXXXXXXX", 27 | "XXXXXXXXXXXX ... XXXXXXXXXXXXXXX", 28 | "XXXXXXXXXXXXX . XXXXXXXXXXXXXXX", 29 | "XXXXXXXXXXXXXX XXXXXXXXXXXXXXXX", 30 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 31 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 32 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 33 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 34 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 35 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 36 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 37 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 38 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 39 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 40 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 41 | }; 42 | -------------------------------------------------------------------------------- /src/xpm/send16.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * send16_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 16 256 2", 5 | " c #ADF7AD", 6 | ". c #9CFF9C", 7 | "X c None", 8 | "o c #ADEFAD", 9 | "O c #94FF94", 10 | "+ c #D6CECE", 11 | "@ c #8CFF8C", 12 | "# c #CECECE", 13 | "$ c #CECEC5", 14 | "% c #84FF84", 15 | "& c #CEC5C5", 16 | "* c #73FF73", 17 | "= c #C5C5C5", 18 | "- c #6BFF6B", 19 | "; c #73F773", 20 | ": c #C5BDBD", 21 | "> c #6BF76B", 22 | ", c #BDBDBD", 23 | "< c #63F763", 24 | "1 c #B5B5B5", 25 | "2 c #52F752", 26 | "3 c #42FF42", 27 | "4 c #3AFF3A", 28 | "5 c #ADADAD", 29 | "6 c #ADADA5", 30 | "7 c #4AEF4A", 31 | "8 c #29FF29", 32 | "9 c #A5A5A5", 33 | "0 c #42E642", 34 | "q c #9CA59C", 35 | "w c #3AE63A", 36 | "e c #10FF10", 37 | "r c #08FF08", 38 | "t c #949C94", 39 | "y c #00FF00", 40 | "u c #00F700", 41 | "i c #8C948C", 42 | "p c #00EF00", 43 | "a c #08E608", 44 | "s c #10DE10", 45 | "d c #00E600", 46 | "f c #00DE00", 47 | "g c #19C519", 48 | "h c #00CE00", 49 | "j c #00C500", 50 | "k c #008C00", 51 | "l c #008400", 52 | "z c #669900", 53 | "x c #999900", 54 | "c c #CC9900", 55 | "v c #FF9900", 56 | "b c #00CC00", 57 | "n c #33CC00", 58 | "m c #66CC00", 59 | "M c #99CC00", 60 | "N c #CCCC00", 61 | "B c #FFCC00", 62 | "V c #66FF00", 63 | "C c #99FF00", 64 | "Z c #CCFF00", 65 | "A c #000033", 66 | "S c #330033", 67 | "D c #660033", 68 | "F c #990033", 69 | "G c #CC0033", 70 | "H c #FF0033", 71 | "J c #003333", 72 | "K c #333333", 73 | "L c #663333", 74 | "P c #993333", 75 | "I c #CC3333", 76 | "U c #FF3333", 77 | "Y c #006633", 78 | "T c #336633", 79 | "R c #666633", 80 | "E c #996633", 81 | "W c #CC6633", 82 | "Q c #FF6633", 83 | "! c #009933", 84 | "~ c #339933", 85 | "^ c #669933", 86 | "/ c #999933", 87 | "( c #CC9933", 88 | ") c #FF9933", 89 | "_ c #00CC33", 90 | "` c #33CC33", 91 | "' c #66CC33", 92 | "] c #99CC33", 93 | "[ c #CCCC33", 94 | "{ c #FFCC33", 95 | "} c #33FF33", 96 | "| c #66FF33", 97 | " . c #99FF33", 98 | ".. c #CCFF33", 99 | "X. c #FFFF33", 100 | "o. c #000066", 101 | "O. c #330066", 102 | "+. c #660066", 103 | "@. c #990066", 104 | "#. c #CC0066", 105 | "$. c #FF0066", 106 | "%. c #003366", 107 | "&. c #333366", 108 | "*. c #663366", 109 | "=. c #993366", 110 | "-. c #CC3366", 111 | ";. c #FF3366", 112 | ":. c #006666", 113 | ">. c #336666", 114 | ",. c #666666", 115 | "<. c #996666", 116 | "1. c #CC6666", 117 | "2. c #009966", 118 | "3. c #339966", 119 | "4. c #669966", 120 | "5. c #999966", 121 | "6. c #CC9966", 122 | "7. c #FF9966", 123 | "8. c #00CC66", 124 | "9. c #33CC66", 125 | "0. c #99CC66", 126 | "q. c #CCCC66", 127 | "w. c #FFCC66", 128 | "e. c #00FF66", 129 | "r. c #33FF66", 130 | "t. c #99FF66", 131 | "y. c #CCFF66", 132 | "u. c #FF00CC", 133 | "i. c #CC00FF", 134 | "p. c #009999", 135 | "a. c #993399", 136 | "s. c #990099", 137 | "d. c #CC0099", 138 | "f. c #000099", 139 | "g. c #333399", 140 | "h. c #660099", 141 | "j. c #CC3399", 142 | "k. c #FF0099", 143 | "l. c #006699", 144 | "z. c #336699", 145 | "x. c #663399", 146 | "c. c #996699", 147 | "v. c #CC6699", 148 | "b. c #FF3399", 149 | "n. c #339999", 150 | "m. c #669999", 151 | "M. c #999999", 152 | "N. c #CC9999", 153 | "B. c #FF9999", 154 | "V. c #00CC99", 155 | "C. c #33CC99", 156 | "Z. c #66CC66", 157 | "A. c #99CC99", 158 | "S. c #CCCC99", 159 | "D. c #FFCC99", 160 | "F. c #00FF99", 161 | "G. c #33FF99", 162 | "H. c #66CC99", 163 | "J. c #99FF99", 164 | "K. c #CCFF99", 165 | "L. c #FFFF99", 166 | "P. c #0000CC", 167 | "I. c #330099", 168 | "U. c #6600CC", 169 | "Y. c #9900CC", 170 | "T. c #CC00CC", 171 | "R. c #003399", 172 | "E. c #3333CC", 173 | "W. c #6633CC", 174 | "Q. c #9933CC", 175 | "!. c #CC33CC", 176 | "~. c #FF33CC", 177 | "^. c #0066CC", 178 | "/. c #3366CC", 179 | "(. c #666699", 180 | "). c #9966CC", 181 | "_. c #CC66CC", 182 | "`. c #FF6699", 183 | "'. c #0099CC", 184 | "]. c #3399CC", 185 | "[. c #6699CC", 186 | "{. c #9999CC", 187 | "}. c #CC99CC", 188 | "|. c #FF99CC", 189 | " X c #00CCCC", 190 | ".X c #33CCCC", 191 | "XX c #66CCCC", 192 | "oX c #99CCCC", 193 | "OX c #CCCCCC", 194 | "+X c #FFCCCC", 195 | "@X c #00FFCC", 196 | "#X c #33FFCC", 197 | "$X c #66FF99", 198 | "%X c #99FFCC", 199 | "&X c #CCFFCC", 200 | "*X c #FFFFCC", 201 | "=X c #3300CC", 202 | "-X c #6600FF", 203 | ";X c #9900FF", 204 | ":X c #0033CC", 205 | ">X c #3333FF", 206 | ",X c #6633FF", 207 | "