Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
12e2693
prevent easy memory exhaustion attack in rpc.
CryptoDJ Sep 21, 2015
1f6a694
Added checkpoints and corrected checkpoint at block height 0.
CryptoDJ Sep 21, 2015
6041d67
Fix priority calculation in CreateTransaction
CryptoDJ Sep 21, 2015
5320cb9
Ignore blocks received while importing
CryptoDJ Sep 21, 2015
b7d6cc2
Don't check duplicate stake while importing.
CryptoDJ Sep 21, 2015
668eef7
Do not store more than 200 timedata samples.
CryptoDJ Sep 21, 2015
92ca3f5
Bump version to 2.1.5.0.
CryptoDJ Sep 21, 2015
ce03ab8
Fixed error in placement of line in rpcprotocol.cpp.
CryptoDJ Sep 21, 2015
d45b4c8
masternode enforce payments
CryptoDJ Sep 21, 2015
9ae864f
Added readme file to repo and Qt project.
CryptoDJ Sep 21, 2015
6645565
included BCT in readme.
CryptoDJ Sep 21, 2015
73ddc93
Added DNS seeds nodes for finding peers: btxcoin.com, btxcoin.net,
CryptoDJ Sep 24, 2015
6768376
max number of fds in fd_set and prevent redefinition compiler warning.
CryptoDJ Sep 24, 2015
19b8435
Ignore "gettaddr"requests on Outbound connections:
CryptoDJ Sep 24, 2015
b280638
update chainparams.cpp, mistyped two domains.
CryptoDJ Sep 25, 2015
f52617a
Updated DNS Seeds
CryptoDJ Oct 13, 2015
c024263
Update chainparams.cpp
CryptoDJ Oct 29, 2015
4974874
Update README.md
CryptoDJ Oct 31, 2015
26865c6
Added btxseed5.bitcointx.co DNS Seed.
CryptoDJ Oct 31, 2015
4f48630
Turn IRC off by default. Use -ircseed to turn it on.
CryptoDJ Nov 1, 2015
ed54889
Bump Protocol Version to 61339 for v2.1.5.
CryptoDJ Nov 2, 2015
e957f13
Added Release Notes for RC v2.1.5 ~11/02/2015
CryptoDJ Nov 3, 2015
053f1b8
Release Notes added for version 2.1.5.
CryptoDJ Nov 3, 2015
ce4cc5f
Refined formatting in README.md
CryptoDJ Nov 3, 2015
73f8c36
Added Image to readme and updated formatting.
CryptoDJ Nov 3, 2015
a013acd
Another release note change.
CryptoDJ Nov 3, 2015
e722e5a
Updated Readme.md again.
CryptoDJ Nov 3, 2015
83810d0
Added three new DNS seeders.
CryptoDJ Nov 24, 2015
73c1775
list_of -> boost::assign::list_of
AmirAbrams Nov 12, 2016
e2bb245
Bump Version
AmirAbrams Nov 12, 2016
d3efaf7
[Params] Add convert_to_container for list_of
AmirAbrams Nov 12, 2016
a293a1f
Merge pull request #1 from AmirAbrams/patch-1
AmirAbrams Nov 12, 2016
d1b750c
Convert boost list_of to standard vector
AmirAbrams Nov 13, 2016
bc50667
Merge pull request #2 from CryptoDJ/patchCCEX
AmirAbrams Nov 13, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion BitcoinTX.pro
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,8 @@ QMAKE_EXTRA_COMPILERS += TSQM

# "Other files" to show in Qt Creator
OTHER_FILES += \
doc/*.rst doc/*.txt doc/README README.md res/bitcoin-qt.rc
doc/*.rst doc/*.txt doc/README README.md res/bitcoin-qt.rc \
README.md

# platform specific defaults, if not overridden on command line
isEmpty(BOOST_LIB_SUFFIX) {
Expand Down
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#BitcoinTX development tree for version 2.1.5.
**BitcoinTX is a PoS-based cryptocurrency.**

##Specifications:

* Block Spacing: 60 Seconds
* Diff Retarget: 2 Blocks
* Maturity: 40 Blocks
* Stake Minimum Age: 1 Hour
* Stake Maximun Age: 14 Days
* Masternode Deposit: 250,000
* Port: 28280
* RPC Port: 28282

BitcoinTX is dependent upon libsecp256k1. BitcoinTX includes an Address Index feature, based on the address index API (searchrawtransactions RPC command) implemented in Bitcoin Core but modified implementation to work with the BitcoinTX codebase (PoS coins maintain a txindex by default for instance).

Initialize the Address Index By Running with -reindexaddr Command Line Argument. It may take 10-15 minutes to build the initial index.

### Release Notes for *v2.1.5 (11/02/2015)*:
1. Updated src/chainparams.cpp. Added five DNS seeders. Turned ON by default. Use -dnsseed to turn off.
* btxseed1.bitcointx.info (New York)
* btxseed2.bitcointx.io (San Francisco)
* btxseed3.btxcoin.org (Amsterdam)
* btxseed4.btxcoin.net (London)
* btxseed5.bitcointx.co (Sigapore)
2. Updated src/net.cpp. IRC seeding. Turned OFF by default. Use -ircseed to turn on.
3. Updated src/checkpoints.cpp. Added new checkpoints.
4. Updated src/clientversion.h. Bump version to 2.1.5.0.
5. Updated src/version.h. Bump protocol version to 61339 for v2.1.5.
6. Updated src/main.cpp.
* Ignore "gettaddr" requests on Outbound connections.
* Don't check duplicate stake while importing.
* Ignore blocks received while importing.
7. Updated src/compat.h. Max number of fds in fd_set and prevent redefinition compiler warning.
8. Updated src/spork.h. Masternode enforce payments.
9. Updated src/timedata.cpp. Do not store more than 200 timedata samples.
10. Updated src/wallet.cpp. Fix priority calculation in CreateTransaction.
11. Updated src/rpcprotocol.cpp. prevent easy memory exhaustion attack in rpc.

##### **Special thanks to SCDeveloper (https://github.com/SCDeveloper/) for item #6-11.**
###### This version has NOT been fully tested. Please use at your own risk.
###### DNS seeder nodes maintained and deployed by MCDev.
###### All coding changes performed and reviewed by CrytoVote. Email: CrytoVote@yandex.com.

####Contact:
* Wallet Code: CrytoVote@yandex.com.
* Network/MN Support:
* DNS Seeds:

####Discussions:
* BitcoinTalk.org: https://bitcointalk.org/index.php?topic=1051266.0
* Slack: https://btxcoin.slack.com

####Exchanges:
* C-CEX: https://c-cex.com/index.html?p=btx-btc

####Build Instructions:
* *Linux*:
* *Windows*:
* *MacOS*:

## License

### Code
MIT License: http://bitcointx.mit-license.org/

### Logo
# ![BitcoinTX logo](https://github.com/CryptoDJ/BitcoinTX/blob/master/src/qt/res/images/about.png)
Copyright 2015, MIT License: http://bitcointx.mit-license.org/
32 changes: 18 additions & 14 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,19 @@ class CMainParams : public CChainParams {
assert(hashGenesisBlock == uint256("0x00000449ae58462bbad8d26c7eb0270d332948872cfe97b7d5c42c154bfa5523"));
assert(genesis.hashMerkleRoot == uint256("0x543528ec7c8617e4816916806d3536b6a22f18907deae54c13c30d725b7d908f"));





base58Prefixes[PUBKEY_ADDRESS] = list_of(35);
base58Prefixes[SCRIPT_ADDRESS] = list_of(85);
base58Prefixes[SECRET_KEY] = list_of(153);
base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x88)(0xB2)(0x1E);
base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x88)(0xAD)(0xE4);
vSeeds.push_back(CDNSSeedData("bitcointx.info", "btxseed1.bitcointx.info"));
vSeeds.push_back(CDNSSeedData("bitcointx.io", "btxseed2.bitcointx.io"));
vSeeds.push_back(CDNSSeedData("btxcoin.org", "btxseed3.btxcoin.org"));
vSeeds.push_back(CDNSSeedData("btxcoin.net", "btxseed4.btxcoin.net"));
vSeeds.push_back(CDNSSeedData("bitcointx.co", "btxseed5.bitcointx.co"));
vSeeds.push_back(CDNSSeedData("bitcointx.io", "btxseed6.bitcointx.io"));
vSeeds.push_back(CDNSSeedData("bitcointx.io", "btxseed7.bitcointx.io"));

base58Prefixes[PUBKEY_ADDRESS] = boost::assign::list_of(35);
base58Prefixes[SCRIPT_ADDRESS] = boost::assign::list_of(85);
base58Prefixes[SECRET_KEY] = boost::assign::list_of(153);
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x88)(0xB2)(0x1E).convert_to_container<std::vector<unsigned char> >();
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x88)(0xAD)(0xE4).convert_to_container<std::vector<unsigned char> >();

convertSeed6(vFixedSeeds, pnSeed6_main, ARRAYLEN(pnSeed6_main));

Expand Down Expand Up @@ -135,11 +139,11 @@ class CTestNetParams : public CMainParams {
vFixedSeeds.clear();
vSeeds.clear();

base58Prefixes[PUBKEY_ADDRESS] = list_of(125);
base58Prefixes[SCRIPT_ADDRESS] = list_of(196);
base58Prefixes[SECRET_KEY] = list_of(239);
base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x35)(0x87)(0xCF);
base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x35)(0x83)(0x94);
base58Prefixes[PUBKEY_ADDRESS] = boost::assign::list_of(125);
base58Prefixes[SCRIPT_ADDRESS] = boost::assign::list_of(196);
base58Prefixes[SECRET_KEY] = boost::assign::list_of(239);
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container<std::vector<unsigned char> >();
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container<std::vector<unsigned char> >();

convertSeed6(vFixedSeeds, pnSeed6_test, ARRAYLEN(pnSeed6_test));

Expand Down
12 changes: 10 additions & 2 deletions src/checkpoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,16 @@ namespace Checkpoints
//
static MapCheckpoints mapCheckpoints =
boost::assign::map_list_of
( 0, uint256("0x1fc69e54b798486c469bbda82aca1f4550a6c35d60e6becc13f82f0687573a09") )
//( 15, uint256("0x0000009db19214c5e655f4d8509d7b62f6dd34e3fae17f7c5d6c6cce0588c8c5") )
( 0, uint256("0x00000449ae58462bbad8d26c7eb0270d332948872cfe97b7d5c42c154bfa5523") )
( 9950, uint256("0x2bc193c75c0f967825ea78f1e92e57880040f011fa9343d321b34742563039d4") )
( 25000, uint256("0x2c3628b858553f96771ef8771bfc85e6738442e8e995927abe1287f4f45a53f8") )
( 56000, uint256("0x317c2f300b998e885a914e551270ec199aef14ade90d94c454685225b50d50d5") )
( 76000, uint256("0x5ae7590572ff76223dffaa04ef87c24e824bb3ea614a9f23b1f89c9acf259c08") )
( 90001, uint256("0x5c89cf3a408121b7850bfbbe01bd0b3cacf2927b3803b2e502bec0329f43af57") )
( 100014, uint256("0x70050e7917796b8fe4974b226b8e5fbdb386174bb4904daf3465a94de5876443") )
( 120010, uint256("0x74f3a0917a0ca006445df6753f1a80de6c05659b6e1ae51105659ce3b446f7ac") )
( 130542, uint256("0x902fe4e1e0a51ccbf806bb79b582b90b415a7c3bca272b763488633fb04187d4") )
//( 0, uint256("0x") )
;

// TestNet has no checkpoints
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 2
#define CLIENT_VERSION_MINOR 1
#define CLIENT_VERSION_REVISION 2
#define CLIENT_VERSION_REVISION 6
#define CLIENT_VERSION_BUILD 0

// Set to true for release, false for prerelease or test build
Expand Down
4 changes: 4 additions & 0 deletions src/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
#ifndef NOMINMAX
#define NOMINMAX
#endif
#ifdef FD_SETSIZE
#undef FD_SETSIZE // prevent redefinition compiler warning
#endif
#define FD_SETSIZE 1024 // max number of fds in fd_set
#include <winsock2.h>
#include <mswsock.h>
#include <ws2tcpip.h>
Expand Down
11 changes: 8 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2664,7 +2664,7 @@ bool ProcessBlock(CNode* pfrom, CBlock* pblock)
// ppcoin: check proof-of-stake
// Limited duplicity on stake: prevents block flood attack
// Duplicate stake allowed only when there is orphan child block
if (pblock->IsProofOfStake() && setStakeSeen.count(pblock->GetProofOfStake()) && !mapOrphanBlocksByPrev.count(hash) && !Checkpoints::WantedByPendingSyncCheckpoint(hash))
if (!fReindex && !fImporting && pblock->IsProofOfStake() && setStakeSeen.count(pblock->GetProofOfStake()) && !mapOrphanBlocksByPrev.count(hash) && !Checkpoints::WantedByPendingSyncCheckpoint(hash))
return error("ProcessBlock() : duplicate proof-of-stake (%s, %d) for block %s", pblock->GetProofOfStake().first.ToString(), pblock->GetProofOfStake().second, hash.ToString());

CBlockIndex* pcheckpoint = Checkpoints::GetLastSyncCheckpoint();
Expand Down Expand Up @@ -3833,7 +3833,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}


else if (strCommand == "block")
else if (strCommand == "block" && !fImporting && !fReindex)
{
CBlock block;
vRecv >> block;
Expand All @@ -3855,7 +3855,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}


else if (strCommand == "getaddr")
//This asymmetric behavior for inbound and outbound connections was introduced
//to prevent a fingerprinting attack: an attacker can send specific fake addresses
//to users' AddrMan and later request them by sending getaddr messages.
//Making users (which are behind NAT and can only make outgoing connections) ignore
//getaddr message mitigates the attack.
else if ((strCommand == "getaddr") && (pfrom->fInbound))
{
// Don't return addresses older than nCutOff timestamp
int64_t nCutOff = GetTime() - (nNodeLifespan * 24 * 60 * 60);
Expand Down
5 changes: 3 additions & 2 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1674,8 +1674,9 @@ void StartNode(boost::thread_group& threadGroup)
MapPort(GetBoolArg("-upnp", USE_UPNP));
#endif

// Get addresses from IRC and advertise ours
threadGroup.create_thread(boost::bind(&TraceThread<void (*)()>, "irc", &ThreadIRCSeed));
//Enable IRC only with -ircseed command.
if (!GetBoolArg("-ircseed", true))
threadGroup.create_thread(boost::bind(&TraceThread<void (*)()>, "irc", &ThreadIRCSeed));

// Send and receive from sockets, accept connections
threadGroup.create_thread(boost::bind(&TraceThread<void (*)()>, "net", &ThreadSocketHandler));
Expand Down
24 changes: 22 additions & 2 deletions src/rpcprotocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ using namespace boost;
using namespace boost::asio;
using namespace json_spirit;

const size_t POST_READ_SIZE = 256 * 1024;

//
// HTTP protocol
//
Expand Down Expand Up @@ -190,8 +192,26 @@ int ReadHTTPMessage(std::basic_istream<char>& stream, map<string,
// Read message
if (nLen > 0)
{
vector<char> vch(nLen);
stream.read(&vch[0], nLen);
//RPC Bug Fix:
//Prevent easy memory exhaustion attack
//Allocate memory for POST message data only as bytes come in, instead of

//all at once at the beginning.
vector<char> vch;
size_t ptr = 0;

while (ptr < (size_t)nLen)
{
size_t bytes_to_read = std::min((size_t)nLen - ptr, POST_READ_SIZE);
vch.resize(ptr + bytes_to_read);

stream.read(&vch[ptr], bytes_to_read);

if (!stream) // Connection lost while reading
return HTTP_INTERNAL_SERVER_ERROR;

ptr += bytes_to_read;
}
strMessageRet = string(vch.begin(), vch.end());
}

Expand Down
4 changes: 2 additions & 2 deletions src/spork.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ using namespace boost;
#define SPORK_4_NOTUSED 10004


#define SPORK_1_MASTERNODE_PAYMENTS_ENFORCEMENT_DEFAULT 2428537599 //2015-4-8 23:59:59 GMT
#define SPORK_1_MASTERNODE_PAYMENTS_ENFORCEMENT_DEFAULT 1442707200 //2015-09-20 00:00:00 GMT
#define SPORK_2_MAX_VALUE_DEFAULT 500 //500 BTX
#define SPORK_3_REPLAY_BLOCKS_DEFAULT 0
#define SPORK_4_RECONVERGE_DEFAULT 1420070400 //2047-1-1
#define SPORK_4_RECONVERGE_DEFAULT 1420070400 //2015-01-01 00:00:00 GMT

class CSporkMessage;
class CSporkManager;
Expand Down
7 changes: 6 additions & 1 deletion src/timedata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ using namespace std;

static CCriticalSection cs_nTimeOffset;
static int64_t nTimeOffset = 0;
#define BTX_TIMEDATA_MAX_SAMPLES 200

//
// "Never go to sea with two chronometers; take one or three."
Expand Down Expand Up @@ -42,11 +43,15 @@ void AddTimeData(const CNetAddr& ip, int64_t nTime)
LOCK(cs_nTimeOffset);
// Ignore duplicates
static set<CNetAddr> setKnown;

if (setKnown.size() == BTX_TIMEDATA_MAX_SAMPLES)
return;

if (!setKnown.insert(ip).second)
return;

// Add data
static CMedianFilter<int64_t> vTimeOffsets(200,0);
static CMedianFilter<int64_t> vTimeOffsets(BTX_TIMEDATA_MAX_SAMPLES,0);
vTimeOffsets.input(nOffsetSample);
LogPrintf("Added time data, samples %d, offset %+d (%+d minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample/60);

Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static const int DATABASE_VERSION = 70509;
// network protocol versioning
//

static const int PROTOCOL_VERSION = 61338;
static const int PROTOCOL_VERSION = 61339;

// intial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
Expand Down
11 changes: 10 additions & 1 deletion src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2468,7 +2468,16 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64_t> >& vecSend,
BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins)
{
int64_t nCredit = pcoin.first->vout[pcoin.second].nValue;
dPriority += (double)nCredit * pcoin.first->GetDepthInMainChain();
//Fix priority calculation in CreateTransaction
//Make this projection of priority in 1 block match the
//calculation in the low priority reject code.
//But mempool inputs might still be in the mempool, so their age stays 0
int age = pcoin.first->GetDepthInMainChain();

if (age != 0)
age += 1;

dPriority += (double)nCredit * age;
}

int64_t nChange = nValueIn - nValue - nFeeRet;
Expand Down