Skip to content

Commit 50cdbfa

Browse files
author
Antonio Juarez
committed
Bytecoin v.1.0.6 release
1 parent b3a91f6 commit 50cdbfa

File tree

573 files changed

+30695
-21213
lines changed

Some content is hidden

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

573 files changed

+30695
-21213
lines changed

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set(CMAKE_CONFIGURATION_TYPES Debug RelWithDebInfo Release CACHE TYPE INTERNAL)
88
set(CMAKE_SKIP_INSTALL_RULES ON)
99
set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY ON)
1010
set(CMAKE_SUPPRESS_REGENERATION ON)
11-
#enable_testing()
11+
enable_testing()
1212

1313
project(Bytecoin)
1414

@@ -62,11 +62,14 @@ else()
6262
else()
6363
set(MINGW_FLAG "")
6464
endif()
65+
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1))
66+
set(WARNINGS "${WARNINGS} -Wno-error=odr")
67+
endif()
6568
set(C_WARNINGS "-Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes")
6669
set(CXX_WARNINGS "-Wno-reorder -Wno-missing-field-initializers")
6770
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 ${MINGW_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} -maes")
6871
if(NOT APPLE)
69-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
72+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
7073
endif()
7174
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${MINGW_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} -maes")
7275
if(APPLE)

ReleaseNotes.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Release notes 1.0.6
2+
3+
- High-level API update
4+
- Aggregate multi-addresses for Bytecoin RPC Wallet
5+
- Wallet synchronization speed increase
6+
17
Release notes 1.0.5
28

39
- High-level API for blockchain explorer

include/BlockchainExplorerData.h

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include <string>
2222
#include <vector>
2323

24+
#include "CryptoTypes.h"
25+
2426
#include <boost/variant.hpp>
2527

2628
namespace CryptoNote {
@@ -32,35 +34,35 @@ enum class TransactionRemoveReason : uint8_t
3234
};
3335

3436
struct TransactionOutputToKeyDetails {
35-
std::array<uint8_t, 16> txOutKey;
37+
Crypto::PublicKey txOutKey;
3638
};
3739

3840
struct TransactionOutputMultisignatureDetails {
39-
std::vector<std::array<uint8_t, 16>> keys;
41+
std::vector<Crypto::PublicKey> keys;
4042
uint32_t requiredSignatures;
4143
};
4244

4345
struct TransactionOutputDetails {
4446
uint64_t amount;
45-
uint64_t globalIndex;
47+
uint32_t globalIndex;
4648

4749
boost::variant<
4850
TransactionOutputToKeyDetails,
4951
TransactionOutputMultisignatureDetails> output;
5052
};
5153

5254
struct TransactionOutputReferenceDetails {
53-
std::array<uint8_t, 32> transactionHash;
55+
Crypto::Hash transactionHash;
5456
size_t number;
5557
};
5658

5759
struct TransactionInputGenerateDetails {
58-
uint64_t height;
60+
uint32_t height;
5961
};
6062

6163
struct TransactionInputToKeyDetails {
62-
std::vector<uint64_t> keyOffsets;
63-
std::array<uint8_t, 16> keyImage;
64+
std::vector<uint32_t> outputIndexes;
65+
Crypto::KeyImage keyImage;
6466
uint64_t mixin;
6567
TransactionOutputReferenceDetails output;
6668
};
@@ -81,26 +83,26 @@ struct TransactionInputDetails {
8183

8284
struct TransactionExtraDetails {
8385
std::vector<size_t> padding;
84-
std::vector<std::array<uint8_t, 16>> publicKey;
86+
std::vector<Crypto::PublicKey> publicKey;
8587
std::vector<std::string> nonce;
8688
std::vector<uint8_t> raw;
8789
};
8890

8991
struct TransactionDetails {
90-
std::array<uint8_t, 32> hash;
92+
Crypto::Hash hash;
9193
uint64_t size;
9294
uint64_t fee;
9395
uint64_t totalInputsAmount;
9496
uint64_t totalOutputsAmount;
9597
uint64_t mixin;
9698
uint64_t unlockTime;
9799
uint64_t timestamp;
98-
std::array<uint8_t, 32> paymentId;
100+
Crypto::Hash paymentId;
99101
bool inBlockchain;
100-
std::array<uint8_t, 32> blockHash;
101-
uint64_t blockHeight;
102+
Crypto::Hash blockHash;
103+
uint32_t blockHeight;
102104
TransactionExtraDetails extra;
103-
std::vector<std::vector<std::array<uint8_t, 32>>> signatures;
105+
std::vector<std::vector<Crypto::Signature>> signatures;
104106
std::vector<TransactionInputDetails> inputs;
105107
std::vector<TransactionOutputDetails> outputs;
106108
};
@@ -109,11 +111,11 @@ struct BlockDetails {
109111
uint8_t majorVersion;
110112
uint8_t minorVersion;
111113
uint64_t timestamp;
112-
std::array<uint8_t, 32> prevBlockHash;
114+
Crypto::Hash prevBlockHash;
113115
uint32_t nonce;
114116
bool isOrphaned;
115-
uint64_t height;
116-
std::array<uint8_t, 32> hash;
117+
uint32_t height;
118+
Crypto::Hash hash;
117119
uint64_t difficulty;
118120
uint64_t reward;
119121
uint64_t baseReward;

include/CryptoNote.h

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
// Copyright (c) 2012-2015, The CryptoNote developers, The Bytecoin developers
2+
//
3+
// This file is part of Bytecoin.
4+
//
5+
// Bytecoin is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU Lesser General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// Bytecoin is distributed in the hope that it will be useful,
11+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
// GNU Lesser General Public License for more details.
14+
//
15+
// You should have received a copy of the GNU Lesser General Public License
16+
// along with Bytecoin. If not, see <http://www.gnu.org/licenses/>.
17+
18+
#pragma once
19+
20+
#include <vector>
21+
#include <boost/variant.hpp>
22+
#include "CryptoTypes.h"
23+
24+
namespace CryptoNote {
25+
26+
struct BaseInput {
27+
uint32_t blockIndex;
28+
};
29+
30+
struct KeyInput {
31+
uint64_t amount;
32+
std::vector<uint32_t> outputIndexes;
33+
Crypto::KeyImage keyImage;
34+
};
35+
36+
struct MultisignatureInput {
37+
uint64_t amount;
38+
uint8_t signatureCount;
39+
uint32_t outputIndex;
40+
};
41+
42+
struct KeyOutput {
43+
Crypto::PublicKey key;
44+
};
45+
46+
struct MultisignatureOutput {
47+
std::vector<Crypto::PublicKey> keys;
48+
uint8_t requiredSignatureCount;
49+
};
50+
51+
typedef boost::variant<BaseInput, KeyInput, MultisignatureInput> TransactionInput;
52+
53+
typedef boost::variant<KeyOutput, MultisignatureOutput> TransactionOutputTarget;
54+
55+
struct TransactionOutput {
56+
uint64_t amount;
57+
TransactionOutputTarget target;
58+
};
59+
60+
struct TransactionPrefix {
61+
uint8_t version;
62+
uint64_t unlockTime;
63+
std::vector<TransactionInput> inputs;
64+
std::vector<TransactionOutput> outputs;
65+
std::vector<uint8_t> extra;
66+
};
67+
68+
struct Transaction : public TransactionPrefix {
69+
std::vector<std::vector<Crypto::Signature>> signatures;
70+
};
71+
72+
struct ParentBlock {
73+
uint8_t majorVersion;
74+
uint8_t minorVersion;
75+
Crypto::Hash previousBlockHash;
76+
uint16_t transactionCount;
77+
std::vector<Crypto::Hash> baseTransactionBranch;
78+
Transaction baseTransaction;
79+
std::vector<Crypto::Hash> blockchainBranch;
80+
};
81+
82+
struct BlockHeader {
83+
uint8_t majorVersion;
84+
uint8_t minorVersion;
85+
uint32_t nonce;
86+
uint64_t timestamp;
87+
Crypto::Hash previousBlockHash;
88+
};
89+
90+
struct Block : public BlockHeader {
91+
ParentBlock parentBlock;
92+
Transaction baseTransaction;
93+
std::vector<Crypto::Hash> transactionHashes;
94+
};
95+
96+
struct AccountPublicAddress {
97+
Crypto::PublicKey spendPublicKey;
98+
Crypto::PublicKey viewPublicKey;
99+
};
100+
101+
struct AccountKeys {
102+
AccountPublicAddress address;
103+
Crypto::SecretKey spendSecretKey;
104+
Crypto::SecretKey viewSecretKey;
105+
};
106+
107+
struct KeyPair {
108+
Crypto::PublicKey publicKey;
109+
Crypto::SecretKey secretKey;
110+
};
111+
112+
using BinaryArray = std::vector<uint8_t>;
113+
114+
}

src/serialization/json_utils.h renamed to include/CryptoTypes.h

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,32 @@
1717

1818
#pragma once
1919

20-
#include <sstream>
21-
#include "json_archive.h"
22-
23-
namespace serialization {
24-
25-
template<class T>
26-
std::string dump_json(T &v)
27-
{
28-
std::stringstream ostr;
29-
json_archive<true> oar(ostr);
30-
assert(serialization::serialize(oar, v));
31-
return ostr.str();
20+
#include <cstdint>
21+
22+
namespace Crypto {
23+
24+
struct Hash {
25+
uint8_t data[32];
26+
};
27+
28+
struct PublicKey {
29+
uint8_t data[32];
30+
};
31+
32+
struct SecretKey {
33+
uint8_t data[32];
34+
};
35+
36+
struct KeyDerivation {
37+
uint8_t data[32];
38+
};
39+
40+
struct KeyImage {
41+
uint8_t data[32];
42+
};
43+
44+
struct Signature {
45+
uint8_t data[64];
3246
};
3347

34-
} // namespace serialization
48+
}

include/IBlockchainExplorer.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class IBlockchainObserver {
2929
virtual ~IBlockchainObserver() {}
3030

3131
virtual void blockchainUpdated(const std::vector<BlockDetails>& newBlocks, const std::vector<BlockDetails>& orphanedBlocks) {}
32-
virtual void poolUpdated(const std::vector<TransactionDetails>& newTransactions, const std::vector<std::pair<std::array<uint8_t, 32>, TransactionRemoveReason>>& removedTransactions) {}
32+
virtual void poolUpdated(const std::vector<TransactionDetails>& newTransactions, const std::vector<std::pair<Crypto::Hash, TransactionRemoveReason>>& removedTransactions) {}
3333

3434
virtual void blockchainSynchronized(const BlockDetails& topBlock) {}
3535
};
@@ -44,13 +44,16 @@ class IBlockchainExplorer {
4444
virtual void init() = 0;
4545
virtual void shutdown() = 0;
4646

47-
virtual bool getBlocks(const std::vector<uint64_t>& blockHeights, std::vector<std::vector<BlockDetails>>& blocks) = 0;
48-
virtual bool getBlocks(const std::vector<std::array<uint8_t, 32>>& blockHashes, std::vector<BlockDetails>& blocks) = 0;
47+
virtual bool getBlocks(const std::vector<uint32_t>& blockHeights, std::vector<std::vector<BlockDetails>>& blocks) = 0;
48+
virtual bool getBlocks(const std::vector<Crypto::Hash>& blockHashes, std::vector<BlockDetails>& blocks) = 0;
49+
virtual bool getBlocks(uint64_t timestampBegin, uint64_t timestampEnd, uint32_t blocksNumberLimit, std::vector<BlockDetails>& blocks, uint32_t& blocksNumberWithinTimestamps) = 0;
4950

5051
virtual bool getBlockchainTop(BlockDetails& topBlock) = 0;
5152

52-
virtual bool getTransactions(const std::vector<std::array<uint8_t, 32>>& transactionHashes, std::vector<TransactionDetails>& transactions) = 0;
53-
virtual bool getPoolState(const std::vector<std::array<uint8_t, 32>>& knownPoolTransactionHashes, std::array<uint8_t, 32> knownBlockchainTop, bool& isBlockchainActual, std::vector<TransactionDetails>& newTransactions, std::vector<std::array<uint8_t, 32>>& removedTransactions) = 0;
53+
virtual bool getTransactions(const std::vector<Crypto::Hash>& transactionHashes, std::vector<TransactionDetails>& transactions) = 0;
54+
virtual bool getTransactionsByPaymentId(const Crypto::Hash& paymentId, std::vector<TransactionDetails>& transactions) = 0;
55+
virtual bool getPoolTransactions(uint64_t timestampBegin, uint64_t timestampEnd, uint32_t transactionsNumberLimit, std::vector<TransactionDetails>& transactions, uint64_t& transactionsNumberWithinTimestamps) = 0;
56+
virtual bool getPoolState(const std::vector<Crypto::Hash>& knownPoolTransactionHashes, Crypto::Hash knownBlockchainTop, bool& isBlockchainActual, std::vector<TransactionDetails>& newTransactions, std::vector<Crypto::Hash>& removedTransactions) = 0;
5457

5558
virtual uint64_t getRewardBlocksWindow() = 0;
5659
virtual uint64_t getFullRewardMaxBlockSize(uint8_t majorVersion) = 0;

0 commit comments

Comments
 (0)