Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fbd7265

Browse files
Merge remote-tracking branch 'bytecoin/master'
2 parents b00a96c + 89271f5 commit fbd7265

File tree

472 files changed

+45767
-13259
lines changed

Some content is hidden

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

472 files changed

+45767
-13259
lines changed

CMakeLists.txt

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,22 @@ if(APPLE)
1212
include_directories(SYSTEM /usr/include/malloc)
1313
endif()
1414

15+
if(MSVC)
16+
include_directories(src/Platform/Windows)
17+
elseif(APPLE)
18+
include_directories(src/Platform/OSX)
19+
else()
20+
include_directories(src/Platform/Linux)
21+
endif()
22+
23+
1524
set(STATIC ${MSVC} CACHE BOOL "Link libraries statically")
1625

1726
if(MSVC)
18-
add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /D_VARIADIC_MAX=8 /FIinline_c.h /D__SSE4_1__")
19-
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Dinline=__inline")
27+
add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /D_VARIADIC_MAX=8 /D__SSE4_1__")
2028
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:10485760")
2129
if(STATIC)
22-
foreach(VAR CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE)
30+
foreach(VAR CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO)
2331
string(REPLACE "/MD" "/MT" ${VAR} "${${VAR}}")
2432
endforeach()
2533
endif()
@@ -31,11 +39,11 @@ else()
3139
else()
3240
set(ARCH_FLAG "-march=${ARCH}")
3341
endif()
34-
set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Werror -Wno-error=extra -Wno-error=deprecated-declarations -Wno-error=sign-compare -Wno-error=strict-aliasing -Wno-error=type-limits -Wno-unused-parameter -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized")
42+
set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Werror -Wno-error=extra -Wno-error=deprecated-declarations -Wno-error=sign-compare -Wno-error=strict-aliasing -Wno-error=type-limits -Wno-unused-parameter -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized -Wno-error=unused-result")
3543
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
36-
set(WARNINGS "${WARNINGS} -Wno-error=mismatched-tags -Wno-error=null-conversion -Wno-overloaded-shift-op-parentheses -Wno-error=shift-count-overflow -Wno-error=tautological-constant-out-of-range-compare -Wno-error=unused-private-field -Wno-error=unneeded-internal-declaration")
44+
set(WARNINGS "${WARNINGS} -Wno-error=mismatched-tags -Wno-error=null-conversion -Wno-overloaded-shift-op-parentheses -Wno-error=shift-count-overflow -Wno-error=tautological-constant-out-of-range-compare -Wno-error=unused-private-field -Wno-error=unneeded-internal-declaration -Wno-error=unused-function")
3745
else()
38-
set(WARNINGS "${WARNINGS} -Wlogical-op -Wno-error=maybe-uninitialized")
46+
set(WARNINGS "${WARNINGS} -Wlogical-op -Wno-error=maybe-uninitialized -Wno-error=clobbered -Wno-error=unused-but-set-variable")
3947
endif()
4048
if(MINGW)
4149
set(WARNINGS "${WARNINGS} -Wno-error=unused-value")
@@ -46,13 +54,7 @@ else()
4654
endif()
4755
set(C_WARNINGS "-Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes")
4856
set(CXX_WARNINGS "-Wno-reorder -Wno-missing-field-initializers")
49-
try_compile(STATIC_ASSERT_RES "${CMAKE_CURRENT_BINARY_DIR}/static-assert" "${CMAKE_CURRENT_SOURCE_DIR}/utils/test-static-assert.c" COMPILE_DEFINITIONS "-std=c11")
50-
if(STATIC_ASSERT_RES)
51-
set(STATIC_ASSERT_FLAG "")
52-
else()
53-
set(STATIC_ASSERT_FLAG "-Dstatic_assert=_Static_assert")
54-
endif()
55-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} -maes")
57+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} -maes")
5658
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} -maes")
5759
if(APPLE)
5860
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_HAS_TR1_TUPLE=0")
@@ -83,7 +85,7 @@ if(STATIC)
8385
set(Boost_USE_STATIC_LIBS ON)
8486
set(Boost_USE_STATIC_RUNTIME ON)
8587
endif()
86-
find_package(Boost 1.53 REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options)
88+
find_package(Boost 1.53 REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options coroutine context)
8789
if((${Boost_MAJOR_VERSION} EQUAL 1) AND (${Boost_MINOR_VERSION} EQUAL 54))
8890
message(SEND_ERROR "Boost version 1.54 is unsupported, more details are available here http://goo.gl/RrCFmA")
8991
endif()
@@ -122,6 +124,7 @@ else()
122124
endif()
123125
endif()
124126

127+
add_subdirectory(contrib)
125128
add_subdirectory(external)
126129
add_subdirectory(src)
127130
add_subdirectory(tests)

README.md

Lines changed: 51 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
This is the reference code for [CryptoNote](https://cryptonote.org) cryptocurrency protocol.
2+
23
* Launch your own CryptoNote currency: [CryptoNote Starter](https://cryptonotestarter.org/)
34
* CryptoNote reference implementation: [CryptoNoteCoin](https://cryptonote-coin.org)
45
* Discussion board and support: [CryptoNote Forum](https://forum.cryptonote.org)
@@ -15,18 +16,18 @@ This is the reference code for [CryptoNote](https://cryptonote.org) cryptocurren
1516

1617
### First step. Give a name to your coin
1718

18-
**Good name must be unique.*** Check uniqueness with [google](http://google.com) and [Map of Coins](mapofcoins.com) or any other similar service.
19+
**Good name must be unique.** Check uniqueness with [google](http://google.com) and [Map of Coins](mapofcoins.com) or any other similar service.
1920

2021
Name must be specified twice:
2122

22-
**1. in file src/cryptonote_config.h** - CRYPTONOTE_NAME macro
23+
**1. in file src/cryptonote_config.h** - `CRYPTONOTE_NAME` constant
2324

2425
Example:
2526
```
26-
#define CRYPTONOTE_NAME "furiouscoin"
27+
const char CRYPTONOTE_NAME[] = "furiouscoin";
2728
```
2829

29-
**2. in CMakeList.txt file** - set_property(TARGET daemon PROPERTY OUTPUT_NAME "YOURCOINNAMEd")
30+
**2. in src/CMakeList.txt file** - set_property(TARGET daemon PROPERTY OUTPUT_NAME "YOURCOINNAME**d**")
3031

3132
Example:
3233
```
@@ -40,22 +41,22 @@ set_property(TARGET daemon PROPERTY OUTPUT_NAME "furiouscoind")
4041

4142
**1. Total money supply** (src/cryptonote_config.h)
4243

43-
Total amount of coins to be emitted. Most of CryptoNote based coins use `(uint64_t)(-1)` (equals to 18446744073709551616). You can define number explicitly (for example UINT64_C(858986905600000000)).
44+
Total amount of coins to be emitted. Most of CryptoNote based coins use `(uint64_t)(-1)` (equals to 18446744073709551616). You can define number explicitly (for example `UINT64_C(858986905600000000)`).
4445

4546
Example:
4647
```
47-
#define MONEY_SUPPLY ((uint64_t)(-1))
48+
const uint64_t MONEY_SUPPLY = (uint64_t)(-1);
4849
```
4950

5051
**2. Emission curve** (src/cryptonote_config.h)
5152

5253
Be default CryptoNote provides emission formula with slight decrease of block reward with each block. This is different from Bitcoin where block reward halves every 4 years.
5354

54-
EMISSION_SPEED_FACTOR macro defines emission curve slope. This parameter is required to calulate block reward.
55+
`EMISSION_SPEED_FACTOR` constant defines emission curve slope. This parameter is required to calulate block reward.
5556

5657
Example:
5758
```
58-
#define EMISSION_SPEED_FACTOR (18)
59+
const unsigned EMISSION_SPEED_FACTOR = 18;
5960
```
6061

6162
**3. Difficulty target** (src/cryptonote_config.h)
@@ -72,19 +73,19 @@ For most coins difficulty target is 60 or 120 seconds.
7273

7374
Example:
7475
```
75-
#define DIFFICULTY_TARGET 120
76+
const uint64_t DIFFICULTY_TARGET = 120;
7677
```
7778

7879
**4. Block reward formula**
7980

80-
In case you are not satisfied with CryptoNote default implementation of block reward logic you can also change it. The implementation is in src/cryptonote_core/cryptonote_basic_impl.cpp:
81+
In case you are not satisfied with CryptoNote default implementation of block reward logic you can also change it. The implementation is in `src/cryptonote_core/Currency.cpp`:
8182
```
82-
bool get_block_reward(size_t median_size, size_t current_block_size, uint64_t already_generated_coins, uint64_t &reward)
83+
bool Currency::getBlockReward(size_t medianSize, size_t currentBlockSize, uint64_t alreadyGeneratedCoins, uint64_t fee, uint64_t& reward, int64_t& emissionChange) const
8384
```
8485

8586
This function has two parts:
8687

87-
- basic block reward calculation: `uint64_t base_reward = (MONEY_SUPPLY - already_generated_coins) >> EMISSION_SPEED_FACTOR;`
88+
- basic block reward calculation: `uint64_t baseReward = (m_moneySupply - alreadyGeneratedCoins) >> m_emissionSpeedFactor;`
8889
- big block penalty calculation: this is the way CryptoNote protects the block chain from transaction flooding attacks and preserves opportunities for organic network growth at the same time.
8990

9091
Only the first part of this function is directly related to the emission logic. You can change it the way you want. See MonetaVerde and DuckNote as the examples where this function is modified.
@@ -105,81 +106,93 @@ It's better to choose ports that aren't used by other software or coins. See kno
105106

106107
Example:
107108
```
108-
#define P2P_DEFAULT_PORT 17236
109-
#define RPC_DEFAULT_PORT 18236
109+
const int P2P_DEFAULT_PORT = 17236;
110+
const int RPC_DEFAULT_PORT = 18236;
110111
```
111112

112113

113114
**2. Network identifier** (src/p2p/p2p_networks.h)
114115

115116
This identifier is used in network packages in order not to mix two different cryptocoin networks. Change all the bytes to random values for your network:
116117
```
117-
const static boost::uuids::uuid CRYPTONOTE_NETWORK = { { 0xA1 ,0x1A, 0xA1, 0x1A , 0xA1, 0x0A , 0xA1, 0x0A, 0xA0, 0x1A, 0xA0, 0x1A, 0xA0, 0x1A, 0xA1, 0x1A} };
118+
const static boost::uuids::uuid CRYPTONOTE_NETWORK = { { 0xA1, 0x1A, 0xA1, 0x1A, 0xA1, 0x0A, 0xA1, 0x0A, 0xA0, 0x1A, 0xA0, 0x1A, 0xA0, 0x1A, 0xA1, 0x1A } };
118119
```
119120

120121

121-
**3. Seed nodes** (src/p2p/net_node.inl)
122+
**3. Seed nodes** (src/cryptonote_config.h)
122123

123-
Add ip addresses of your seed nodes to the beginning of `node_server<t_payload_net_handler>::init(const boost::program_options::variables_map& vm)` function.
124+
Add IP addresses of your seed nodes.
124125

125126
Example:
126127
```
127-
ADD_HARDCODED_SEED_NODE("111.11.11.11:17236");
128-
ADD_HARDCODED_SEED_NODE("222.22.22.22:17236");
128+
const std::initializer_list<const char*> SEED_NODES = {
129+
"111.11.11.11:17236",
130+
"222.22.22.22:17236",
131+
};
129132
```
130133

131134

132135
### Fourth step. Transaction fee and related parameters
133136

134-
**1. Default transaction fee** (src/cryptonote_config.h)
137+
**1. Minimum transaction fee** (src/cryptonote_config.h)
135138

136-
Zero default fee can lead to transaction flooding. Transactions cheaper than the default transaction fee wouldn't be accepted by daemons. 100000 value for DEFAULT_FEE is usually enough.
139+
Zero minimum fee can lead to transaction flooding. Transactions cheaper than the minimum transaction fee wouldn't be accepted by daemons. 100000 value for `MINIMUM_FEE` is usually enough.
137140

138141
Example:
139142
```
140-
#define DEFAULT_FEE 100000
143+
const uint64_t MINIMUM_FEE = 100000;
141144
```
142145

143146

144147
**2. Penalty free block size** (src/cryptonote_config.h)
145148

146-
CryptoNote protects chain from tx flooding by reducing block reward for blocks larger than the median block size. However, this rule applies for blocks larger than CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE bytes.
149+
CryptoNote protects chain from tx flooding by reducing block reward for blocks larger than the median block size. However, this rule applies for blocks larger than `CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE` bytes.
147150

148151
Example:
149152
```
150-
#define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE 20000
153+
const size_t CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE = 20000;
151154
```
152155

153156

154-
### Fifth step. Genesis block
157+
### Fifth step. Address prefix
158+
159+
You may choose a letter (in some cases several letters) all the coin's public addresses will start with. It is defined by `CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX` constant. Since the rules for address prefixes are nontrivial you may use the [prefix generator tool](https://cryptonotestarter.org/tools.html).
160+
161+
Example:
162+
```
163+
const uint64_t CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX = 0xe9; // addresses start with "f"
164+
```
165+
166+
167+
### Sixth step. Genesis block
155168

156169
**1. Build the binaries with blank genesis tx hex** (src/cryptonote_config.h)
157170

158-
You should leave #define GENESIS_COINBASE_TX_HEX blank and compile the binaries without it.
171+
You should leave `const char GENESIS_COINBASE_TX_HEX[]` blank and compile the binaries without it.
159172

160173
Example:
161174
```
162-
#define GENESIS_COINBASE_TX_HEX ""
175+
const char GENESIS_COINBASE_TX_HEX[] = "";
163176
```
164177

165178

166179
**2. Start the daemon to print out the genesis block**
167180

168-
Run your daemon with --print-genesis-tx argument. It will print out the genesis block coinbase transaction hash.
181+
Run your daemon with `--print-genesis-tx` argument. It will print out the genesis block coinbase transaction hash.
169182

170183
Example:
171184
```
172-
cryptonotecoind --print-genesis-tx
185+
furiouscoind --print-genesis-tx
173186
```
174187

175188

176189
**3. Copy the printed transaction hash** (src/cryptonote_config.h)
177190

178-
Copy the tx hash that has been printed by the daemon to GENESIS_COINBASE_TX_HEX in /src/cryptonote_config.h
191+
Copy the tx hash that has been printed by the daemon to `GENESIS_COINBASE_TX_HEX` in `src/cryptonote_config.h`
179192

180193
Example:
181194
```
182-
#define GENESIS_COINBASE_TX_HEX "013c01ff0001ffff...785a33d9ebdba68b0"
195+
const char GENESIS_COINBASE_TX_HEX[] = "013c01ff0001ffff...785a33d9ebdba68b0";
183196
```
184197

185198

@@ -192,25 +205,27 @@ Recompile everything again. Your coin code is ready now. Make an announcement fo
192205

193206
### On *nix
194207

195-
Dependencies: GCC 4.7.3 or later, CMake 2.8.6 or later, and Boost 1.53 or later (except 1.54, more details here: http://goo.gl/RrCFmA).
208+
Dependencies: GCC 4.7.3 or later, CMake 2.8.6 or later, and Boost 1.55.
196209

197210
You may download them from:
211+
198212
* http://gcc.gnu.org/
199213
* http://www.cmake.org/
200214
* http://www.boost.org/
201-
*
202-
Alternatively, it may be possible to install them using a package manager.
215+
* Alternatively, it may be possible to install them using a package manager.
203216

204-
To build, change to a directory where this file is located, and run `make'. The resulting executables can be found in build/release/src.
217+
To build, change to a directory where this file is located, and run `make`. The resulting executables can be found in `build/release/src`.
205218

206219
**Advanced options:**
220+
207221
* Parallel build: run `make -j<number of threads>` instead of `make`.
208222
* Debug build: run `make build-debug`.
209223
* Test suite: run `make test-release` to run tests in addition to building. Running `make test-debug` will do the same to the debug version.
210224
* Building with Clang: it may be possible to use Clang instead of GCC, but this may not work everywhere. To build, run `export CC=clang CXX=clang++` before running `make`.
211225

212226
### On Windows
213-
Dependencies: MSVC 2012 or later, CMake 2.8.6 or later, and Boost 1.53 or later. You may download them from:
227+
Dependencies: MSVC 2012 or later, CMake 2.8.6 or later, and Boost 1.55. You may download them from:
228+
214229
* http://www.microsoft.com/
215230
* http://www.cmake.org/
216231
* http://www.boost.org/

ReleaseNotes.txt

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
1-
Release notes 0.8.11
1+
Release notes 1.0.2
2+
3+
- Multisignature with API
4+
- Low level API
5+
- High level API improvements
6+
- Updated block reward scheme
7+
- Dynamic maximum block size limit
8+
9+
- Instant transaction pool notifications
10+
- Transaction priority based on tx fee
11+
- Transactions are returned from tx pools after 24 hours
12+
13+
- Fully refactored simplewallet
14+
- Transaction history for simplewallet
15+
- Reset command for simplewallet
16+
- Faster wallet refresh
17+
18+
- Further optimization in daemon RAM consumption
19+
- Various network health updates
20+
- Config and CryptoNote forking how-to update
21+
22+
Release notes 1.0.1
223

324
- High level API implementation
425
- CryptoNight hash function optimization

contrib/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
file(GLOB_RECURSE EPEE epee/include/*)
2+
3+
source_group(epee FILES ${EPEE})
4+
5+
add_library(epee ${EPEE})
6+
7+
set_property(TARGET epee PROPERTY FOLDER "external")

contrib/epee/demo/demo_levin_server/stdafx.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,4 @@
3535

3636
#define BOOST_FILESYSTEM_VERSION 3
3737
#define ENABLE_RELEASE_LOGGING
38-
#include "log_opt_defs.h"
3938
#include "misc_log_ex.h"
40-
41-

0 commit comments

Comments
 (0)