Skip to content

Commit

Permalink
Bytecoin v.1.0.6 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Juarez committed Jul 30, 2015
1 parent b3a91f6 commit 50cdbfa
Show file tree
Hide file tree
Showing 573 changed files with 30,695 additions and 21,213 deletions.
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set(CMAKE_CONFIGURATION_TYPES Debug RelWithDebInfo Release CACHE TYPE INTERNAL)
set(CMAKE_SKIP_INSTALL_RULES ON)
set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY ON)
set(CMAKE_SUPPRESS_REGENERATION ON)
#enable_testing()
enable_testing()

project(Bytecoin)

Expand Down Expand Up @@ -62,11 +62,14 @@ else()
else()
set(MINGW_FLAG "")
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1))
set(WARNINGS "${WARNINGS} -Wno-error=odr")
endif()
set(C_WARNINGS "-Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes")
set(CXX_WARNINGS "-Wno-reorder -Wno-missing-field-initializers")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 ${MINGW_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} -maes")
if(NOT APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${MINGW_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} -maes")
if(APPLE)
Expand Down
6 changes: 6 additions & 0 deletions ReleaseNotes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Release notes 1.0.6

- High-level API update
- Aggregate multi-addresses for Bytecoin RPC Wallet
- Wallet synchronization speed increase

Release notes 1.0.5

- High-level API for blockchain explorer
Expand Down
34 changes: 18 additions & 16 deletions include/BlockchainExplorerData.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include <string>
#include <vector>

#include "CryptoTypes.h"

#include <boost/variant.hpp>

namespace CryptoNote {
Expand All @@ -32,35 +34,35 @@ enum class TransactionRemoveReason : uint8_t
};

struct TransactionOutputToKeyDetails {
std::array<uint8_t, 16> txOutKey;
Crypto::PublicKey txOutKey;
};

struct TransactionOutputMultisignatureDetails {
std::vector<std::array<uint8_t, 16>> keys;
std::vector<Crypto::PublicKey> keys;
uint32_t requiredSignatures;
};

struct TransactionOutputDetails {
uint64_t amount;
uint64_t globalIndex;
uint32_t globalIndex;

boost::variant<
TransactionOutputToKeyDetails,
TransactionOutputMultisignatureDetails> output;
};

struct TransactionOutputReferenceDetails {
std::array<uint8_t, 32> transactionHash;
Crypto::Hash transactionHash;
size_t number;
};

struct TransactionInputGenerateDetails {
uint64_t height;
uint32_t height;
};

struct TransactionInputToKeyDetails {
std::vector<uint64_t> keyOffsets;
std::array<uint8_t, 16> keyImage;
std::vector<uint32_t> outputIndexes;
Crypto::KeyImage keyImage;
uint64_t mixin;
TransactionOutputReferenceDetails output;
};
Expand All @@ -81,26 +83,26 @@ struct TransactionInputDetails {

struct TransactionExtraDetails {
std::vector<size_t> padding;
std::vector<std::array<uint8_t, 16>> publicKey;
std::vector<Crypto::PublicKey> publicKey;
std::vector<std::string> nonce;
std::vector<uint8_t> raw;
};

struct TransactionDetails {
std::array<uint8_t, 32> hash;
Crypto::Hash hash;
uint64_t size;
uint64_t fee;
uint64_t totalInputsAmount;
uint64_t totalOutputsAmount;
uint64_t mixin;
uint64_t unlockTime;
uint64_t timestamp;
std::array<uint8_t, 32> paymentId;
Crypto::Hash paymentId;
bool inBlockchain;
std::array<uint8_t, 32> blockHash;
uint64_t blockHeight;
Crypto::Hash blockHash;
uint32_t blockHeight;
TransactionExtraDetails extra;
std::vector<std::vector<std::array<uint8_t, 32>>> signatures;
std::vector<std::vector<Crypto::Signature>> signatures;
std::vector<TransactionInputDetails> inputs;
std::vector<TransactionOutputDetails> outputs;
};
Expand All @@ -109,11 +111,11 @@ struct BlockDetails {
uint8_t majorVersion;
uint8_t minorVersion;
uint64_t timestamp;
std::array<uint8_t, 32> prevBlockHash;
Crypto::Hash prevBlockHash;
uint32_t nonce;
bool isOrphaned;
uint64_t height;
std::array<uint8_t, 32> hash;
uint32_t height;
Crypto::Hash hash;
uint64_t difficulty;
uint64_t reward;
uint64_t baseReward;
Expand Down
114 changes: 114 additions & 0 deletions include/CryptoNote.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
// Copyright (c) 2012-2015, The CryptoNote developers, The Bytecoin developers
//
// This file is part of Bytecoin.
//
// Bytecoin is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Bytecoin is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Bytecoin. If not, see <http://www.gnu.org/licenses/>.

#pragma once

#include <vector>
#include <boost/variant.hpp>
#include "CryptoTypes.h"

namespace CryptoNote {

struct BaseInput {
uint32_t blockIndex;
};

struct KeyInput {
uint64_t amount;
std::vector<uint32_t> outputIndexes;
Crypto::KeyImage keyImage;
};

struct MultisignatureInput {
uint64_t amount;
uint8_t signatureCount;
uint32_t outputIndex;
};

struct KeyOutput {
Crypto::PublicKey key;
};

struct MultisignatureOutput {
std::vector<Crypto::PublicKey> keys;
uint8_t requiredSignatureCount;
};

typedef boost::variant<BaseInput, KeyInput, MultisignatureInput> TransactionInput;

typedef boost::variant<KeyOutput, MultisignatureOutput> TransactionOutputTarget;

struct TransactionOutput {
uint64_t amount;
TransactionOutputTarget target;
};

struct TransactionPrefix {
uint8_t version;
uint64_t unlockTime;
std::vector<TransactionInput> inputs;
std::vector<TransactionOutput> outputs;
std::vector<uint8_t> extra;
};

struct Transaction : public TransactionPrefix {
std::vector<std::vector<Crypto::Signature>> signatures;
};

struct ParentBlock {
uint8_t majorVersion;
uint8_t minorVersion;
Crypto::Hash previousBlockHash;
uint16_t transactionCount;
std::vector<Crypto::Hash> baseTransactionBranch;
Transaction baseTransaction;
std::vector<Crypto::Hash> blockchainBranch;
};

struct BlockHeader {
uint8_t majorVersion;
uint8_t minorVersion;
uint32_t nonce;
uint64_t timestamp;
Crypto::Hash previousBlockHash;
};

struct Block : public BlockHeader {
ParentBlock parentBlock;
Transaction baseTransaction;
std::vector<Crypto::Hash> transactionHashes;
};

struct AccountPublicAddress {
Crypto::PublicKey spendPublicKey;
Crypto::PublicKey viewPublicKey;
};

struct AccountKeys {
AccountPublicAddress address;
Crypto::SecretKey spendSecretKey;
Crypto::SecretKey viewSecretKey;
};

struct KeyPair {
Crypto::PublicKey publicKey;
Crypto::SecretKey secretKey;
};

using BinaryArray = std::vector<uint8_t>;

}
40 changes: 27 additions & 13 deletions src/serialization/json_utils.h → include/CryptoTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,32 @@

#pragma once

#include <sstream>
#include "json_archive.h"

namespace serialization {

template<class T>
std::string dump_json(T &v)
{
std::stringstream ostr;
json_archive<true> oar(ostr);
assert(serialization::serialize(oar, v));
return ostr.str();
#include <cstdint>

namespace Crypto {

struct Hash {
uint8_t data[32];
};

struct PublicKey {
uint8_t data[32];
};

struct SecretKey {
uint8_t data[32];
};

struct KeyDerivation {
uint8_t data[32];
};

struct KeyImage {
uint8_t data[32];
};

struct Signature {
uint8_t data[64];
};

} // namespace serialization
}
13 changes: 8 additions & 5 deletions include/IBlockchainExplorer.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class IBlockchainObserver {
virtual ~IBlockchainObserver() {}

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

virtual void blockchainSynchronized(const BlockDetails& topBlock) {}
};
Expand All @@ -44,13 +44,16 @@ class IBlockchainExplorer {
virtual void init() = 0;
virtual void shutdown() = 0;

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

virtual bool getBlockchainTop(BlockDetails& topBlock) = 0;

virtual bool getTransactions(const std::vector<std::array<uint8_t, 32>>& transactionHashes, std::vector<TransactionDetails>& transactions) = 0;
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;
virtual bool getTransactions(const std::vector<Crypto::Hash>& transactionHashes, std::vector<TransactionDetails>& transactions) = 0;
virtual bool getTransactionsByPaymentId(const Crypto::Hash& paymentId, std::vector<TransactionDetails>& transactions) = 0;
virtual bool getPoolTransactions(uint64_t timestampBegin, uint64_t timestampEnd, uint32_t transactionsNumberLimit, std::vector<TransactionDetails>& transactions, uint64_t& transactionsNumberWithinTimestamps) = 0;
virtual bool getPoolState(const std::vector<Crypto::Hash>& knownPoolTransactionHashes, Crypto::Hash knownBlockchainTop, bool& isBlockchainActual, std::vector<TransactionDetails>& newTransactions, std::vector<Crypto::Hash>& removedTransactions) = 0;

virtual uint64_t getRewardBlocksWindow() = 0;
virtual uint64_t getFullRewardMaxBlockSize(uint8_t majorVersion) = 0;
Expand Down
Loading

0 comments on commit 50cdbfa

Please sign in to comment.