Skip to content

Commit

Permalink
Merge pull request #103 from bulwark-crypto/dev
Browse files Browse the repository at this point in the history
v1.3.1
  • Loading branch information
Bulwark Cryptocurrency committed Jun 28, 2018
2 parents 3af448b + f22a43a commit 4d51264
Show file tree
Hide file tree
Showing 108 changed files with 1,436 additions and 2,245 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@

\.DS_Store
45 changes: 22 additions & 23 deletions README.md
Expand Up @@ -23,10 +23,10 @@ Bulwark offers both SwiftTX and Obfuscation to enable speedy transactions with a
| Confirmation | 6 Blocks (~9 Minutes) |
| Circulation (1 Year) | 14,505,720 BWK |
| Circulation (5 Years) | 27,668,220 BWK |
| PoW Period | nHeight ≤ 182,700 |
| PoW Period | nHeight ≤ 182,700 |
| PoS Period | nHeight ≥ 182,701 |
| Protocol Support | IPV4, IPV6, TOR |
| PoS | Blackcoin v3.0 PoS, PIVX SeeSaw Rewards |
| PoS | SeeSaw & Split Rewards |

## PoW Block Reward

Expand All @@ -44,24 +44,23 @@ Bulwark offers both SwiftTX and Obfuscation to enable speedy transactions with a

| Subsidy | Block | Budget | Circulation | Note |
|---------|-----------------|--------|----------------|---------------|
| 37.500 | 182701-259200 | 0% | 11805225 | Year 1 |
| 31.250 | 259201-345600 | 0% | 14505225 | Year 1 |
| 25.000 | 345601-432000 | 10% | 16665225 | Year 2 |
| 21.875 | 432001-518400 | 10% | 18555225 | Year 2 |
| 18.750 | 518401-604800 | 10% | 20175225 | Year 2 |
| 15.625 | 604801-691200 | 10% | 21525225 | Year 2 |
| 12.50 | 691201-777600 | 10% | 22380225 | Year 3 |
| 10.938 | 777601-864000 | 10% | 23325268.2 | Year 3 |
| 9.3750 | 864001-950400 | 10% | 24135268.2 | Year 3 |
| 7.8120 | 950401-1036800 | 10% | 24810225 | Year 3 |
| 6.2500 | 1036801-1123200 | 10% | 25350225 | Year 4 |
| 5.4690 | 1123201-1209600 | 10% | 25822746.6 | Year 4 |
| 4.6880 | 1209601-1296000 | 10% | 26227789.8 | Year 4 |
| 3.9060 | 1296000-1382400 | 10% | 26565268.2 | Year 4 |
| 3.1250 | 1382401-1468800 | 10% | 26835268.2 | Year 5 |
| 2.7340 | 1468801-1555200 | 10% | 27071485.8 | Year 5 |
| 2.3440 | 1555201-1641600 | 10% | 27274007.4 | Year 5 |
| 1.9530 | 1641601-1728000 | 10% | 27442746.6 | Year 5 |
| 1.6250 | 1728001+ | 10% || In Perpetuity |

*During the PoS phase, the divide between staking rewards and masternodes will be decided by the SeeSaw mechanic described in chapter 6.7 of our whitepaper.
| 37.500 | 182701-200000 | 0% | SeeSaw | Year 1 |
| 37.500 | 200001-259200 | 0% | 35/65 | Year 1 |
| 31.250 | 259201-345600 | 0% | 35/65 | Year 1 |
| 25.000 | 345601-432000 | 10% | 30/60 | Year 2 |
| 21.875 | 432001-518400 | 10% | 30/60 | Year 2 |
| 18.750 | 518401-604800 | 10% | 30/60 | Year 2 |
| 15.625 | 604801-691200 | 10% | 30/60 | Year 2 |
| 12.50 | 691201-777600 | 10% | 30/60 | Year 3 |
| 10.938 | 777601-864000 | 10% | 30/60 | Year 3 |
| 9.3750 | 864001-950400 | 10% | 30/60 | Year 3 |
| 7.8120 | 950401-1036800 | 10% | 30/60 | Year 3 |
| 6.2500 | 1036801-1123200 | 10% | 30/60 | Year 4 |
| 5.4690 | 1123201-1209600 | 10% | 30/60 | Year 4 |
| 4.6880 | 1209601-1296000 | 10% | 30/60 | Year 4 |
| 3.9060 | 1296000-1382400 | 10% | 30/60 | Year 4 |
| 3.1250 | 1382401-1468800 | 10% | 30/60 | Year 5 |
| 2.7340 | 1468801-1555200 | 10% | 30/60 | Year 5 |
| 2.3440 | 1555201-1641600 | 10% | 30/60 | Year 5 |
| 1.9530 | 1641601-1728000 | 10% | 30/60 | Year 5 |
| 1.6250 | 1728000+ | 10% | 30/60 | In Perpetuity |
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -2,7 +2,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 1)
define(_CLIENT_VERSION_MINOR, 3)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_REVISION, 1)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2018)
Expand Down
6 changes: 3 additions & 3 deletions depends/packages/openssl.mk
@@ -1,8 +1,8 @@
package=openssl
$(package)_version=1.0.1k
$(package)_version=1.0.2o
$(package)_download_path=https://www.openssl.org/source
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=8f9faeaebad088e772f4ef5e38252d472be4d878c6b3a2718c10a4fcebe7a41c
$(package)_sha256_hash=ec3f5c9714ba0fd45cb4e087301eb1336c317e0d20b575a125050470e8089e4d

define $(package)_set_vars
$(package)_config_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)"
Expand Down Expand Up @@ -66,7 +66,7 @@ define $(package)_config_cmds
endef

define $(package)_build_cmds
$(MAKE) -j1 build_libs libcrypto.pc libssl.pc openssl.pc
$(MAKE) depend -j1 build_libs libcrypto.pc libssl.pc openssl.pc
endef

define $(package)_stage_cmds
Expand Down
6 changes: 3 additions & 3 deletions doc/README.md
Expand Up @@ -26,9 +26,9 @@ Drag Bulwark-Qt to your applications folder, and then run Bulwark-Qt.

### Need Help?

* See the documentation at the [Bulwark Wiki](https://github.com/bulwark-crypto/Bulwark/wiki)
* See the documentation at the [Bulwark KB](https://kb.bulwarkcrypto.com)
for help and more information.
* Ask for help on [BitcoinTalk](FIXME Add official BCT URL on ANN) or on the [Bulwark Discord](https://discord.gg/a7vhegP).
* Ask for help on [BitcoinTalk](https://bitcointalk.org/index.php?topic=2499481.0) or on the [Bulwark Discord](https://discord.gg/a7vhegP).

Building
---------------------
Expand All @@ -54,7 +54,7 @@ The Bulwark repo's [root README](https://github.com/bulwark-crypto/Bulwark/blob/

### Resources

* Discuss on the [BitcoinTalk](FIXME with URL after ANN) or the [Bulwark Subreddit](http://reddit.com/r/bulwarkcoin).
* Discuss on the [BitcoinTalk](https://bitcointalk.org/index.php?topic=2499481.0) or the [Bulwark Subreddit](http://reddit.com/r/bulwarkcoin).

### Miscellaneous
- [Assets Attribution](assets-attribution.md)
Expand Down
2 changes: 1 addition & 1 deletion doc/build-osx.md
Expand Up @@ -44,7 +44,7 @@ Instructions: Homebrew

1. Clone the github tree to get the source code and go into the directory.

git clone https://FIXME_EATBATTERYS
git clone https://github.com/bulwark-crypto/Bulwark
cd Bulwark

2. Build bulwarkd:
Expand Down
4 changes: 4 additions & 0 deletions src/Makefile.am
Expand Up @@ -75,6 +75,7 @@ endif
# bulwark core #
BITCOIN_CORE_H = \
activemasternode.h \
addrdb.h \
addrman.h \
alert.h \
allocators.h \
Expand Down Expand Up @@ -104,6 +105,7 @@ BITCOIN_CORE_H = \
db.h \
eccryptoverify.h \
ecwrapper.h \
fs.h \
hash.h \
init.h \
kernel.h \
Expand Down Expand Up @@ -184,11 +186,13 @@ libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
# server: shared between bulwarkd and bulwark-qt
libbitcoin_server_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
libbitcoin_server_a_SOURCES = \
addrdb.cpp \
addrman.cpp \
alert.cpp \
bloom.cpp \
chain.cpp \
checkpoints.cpp \
fs.cpp \
init.cpp \
leveldbwrapper.cpp \
main.cpp \
Expand Down
3 changes: 3 additions & 0 deletions src/Makefile.qt.include
Expand Up @@ -57,6 +57,7 @@ QT_MOC_CPP = \
qt/moc_addressbookpage.cpp \
qt/moc_addresstablemodel.cpp \
qt/moc_askpassphrasedialog.cpp \
qt/moc_bantablemodel.cpp \
qt/moc_bip38tooldialog.cpp \
qt/moc_bitcoinaddressvalidator.cpp \
qt/moc_bitcoinamountfield.cpp \
Expand Down Expand Up @@ -141,6 +142,7 @@ BITCOIN_QT_H = \
qt/addressbookpage.h \
qt/addresstablemodel.h \
qt/askpassphrasedialog.h \
qt/bantablemodel.h \
qt/bip38tooldialog.h \
qt/bitcoinaddressvalidator.h \
qt/bitcoinamountfield.h \
Expand Down Expand Up @@ -287,6 +289,7 @@ RES_ICONS = \
qt/res/icons/unit_tubulwark.png

BITCOIN_QT_CPP = \
qt/bantablemodel.cpp \
qt/bitcoinaddressvalidator.cpp \
qt/bitcoinamountfield.cpp \
qt/bitcoingui.cpp \
Expand Down
114 changes: 114 additions & 0 deletions src/addrdb.cpp
@@ -0,0 +1,114 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include "addrdb.h"

#include "addrman.h"
#include "chainparams.h"
#include "clientversion.h"
#include "fs.h"
#include "hash.h"
#include "random.h"
#include "streams.h"
#include "tinyformat.h"
#include "util.h"


CBanDB::CBanDB()
{
pathBanlist = GetDataDir() / "banlist.dat";
}

bool CBanDB::Write(const banmap_t& banSet)
{
// Generate random temporary filename
unsigned short randv = 0;
GetRandBytes((unsigned char*)&randv, sizeof(randv));
std::string tmpfn = strprintf("banlist.dat.%04x", randv);

// serialize banlist, checksum data up to that point, then append csum
CDataStream ssBanlist(SER_DISK, CLIENT_VERSION);
ssBanlist << FLATDATA(Params().MessageStart());
ssBanlist << banSet;
uint256 hash = Hash(ssBanlist.begin(), ssBanlist.end());
ssBanlist << hash;

// open temp output file, and associate with CAutoFile
fs::path pathTmp = GetDataDir() / tmpfn;
FILE *file = fsbridge::fopen(pathTmp, "wb");
CAutoFile fileout(file, SER_DISK, CLIENT_VERSION);
if (fileout.IsNull())
return error("%s: Failed to open file %s", __func__, pathTmp.string());

// Write and commit header, data
try {
fileout << ssBanlist;
}
catch (const std::exception& e) {
return error("%s: Serialize or I/O error - %s", __func__, e.what());
}
FileCommit(fileout.Get());
fileout.fclose();

// replace existing banlist.dat, if any, with new banlist.dat.XXXX
if (!RenameOver(pathTmp, pathBanlist))
return error("%s: Rename-into-place failed", __func__);

return true;
}

bool CBanDB::Read(banmap_t& banSet)
{
// open input file, and associate with CAutoFile
FILE *file = fsbridge::fopen(pathBanlist, "rb");
CAutoFile filein(file, SER_DISK, CLIENT_VERSION);
if (filein.IsNull())
return error("%s: Failed to open file %s", __func__, pathBanlist.string());

// use file size to size memory buffer
uint64_t fileSize = fs::file_size(pathBanlist);
uint64_t dataSize = 0;
// Don't try to resize to a negative number if file is small
if (fileSize >= sizeof(uint256))
dataSize = fileSize - sizeof(uint256);
std::vector<unsigned char> vchData;
vchData.resize(dataSize);
uint256 hashIn;

// read data and checksum from file
try {
filein.read((char *)&vchData[0], dataSize);
filein >> hashIn;
}
catch (const std::exception& e) {
return error("%s: Deserialize or I/O error - %s", __func__, e.what());
}
filein.fclose();

CDataStream ssBanlist(vchData, SER_DISK, CLIENT_VERSION);

// verify stored checksum matches input data
uint256 hashTmp = Hash(ssBanlist.begin(), ssBanlist.end());
if (hashIn != hashTmp)
return error("%s: Checksum mismatch, data corrupted", __func__);

unsigned char pchMsgTmp[4];
try {
// de-serialize file header (network specific magic number) and ..
ssBanlist >> FLATDATA(pchMsgTmp);

// ... verify the network matches ours
if (memcmp(pchMsgTmp, Params().MessageStart(), sizeof(pchMsgTmp)))
return error("%s: Invalid network magic number", __func__);

// de-serialize ban data
ssBanlist >> banSet;
}
catch (const std::exception& e) {
return error("%s: Deserialize or I/O error - %s", __func__, e.what());
}

return true;
}
90 changes: 90 additions & 0 deletions src/addrdb.h
@@ -0,0 +1,90 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_ADDRDB_H
#define BITCOIN_ADDRDB_H

#include "fs.h"
#include "serialize.h"

#include <string>
#include <map>

class CSubNet;
class CAddrMan;
class CDataStream;

typedef enum BanReason
{
BanReasonUnknown = 0,
BanReasonNodeMisbehaving = 1,
BanReasonManuallyAdded = 2
} BanReason;

class CBanEntry
{
public:
static const int CURRENT_VERSION = 1;
int nVersion;
int64_t nCreateTime;
int64_t nBanUntil;
uint8_t banReason;

CBanEntry()
{
SetNull();
}

CBanEntry(int64_t nCreateTimeIn)
{
SetNull();
nCreateTime = nCreateTimeIn;
}

ADD_SERIALIZE_METHODS;

template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(this->nVersion);
READWRITE(nCreateTime);
READWRITE(nBanUntil);
READWRITE(banReason);
}

void SetNull()
{
nVersion = CBanEntry::CURRENT_VERSION;
nCreateTime = 0;
nBanUntil = 0;
banReason = BanReasonUnknown;
}

std::string banReasonToString()
{
switch (banReason) {
case BanReasonNodeMisbehaving:
return "node misbehaving";
case BanReasonManuallyAdded:
return "manually added";
default:
return "unknown";
}
}
};

typedef std::map<CSubNet, CBanEntry> banmap_t;

/** Access to the banlist database (banlist.dat) */
class CBanDB
{
private:
fs::path pathBanlist;
public:
CBanDB();
bool Write(const banmap_t& banSet);
bool Read(banmap_t& banSet);
};

#endif // BITCOIN_ADDRDB_H
2 changes: 2 additions & 0 deletions src/chainparams.cpp
Expand Up @@ -115,6 +115,7 @@ class CMainParams : public CChainParams
nTargetSpacing = 1 * 90; // Bulwark: 1.5min after block 300
nLastPOWBlock = 182700;
nLastPOWBlockOld = 345600; // 1 year
nLastSeeSawBlock = 200000; // last block for seesaw rewards
nRampToBlock = 960; // Slow start, ramp linearly to this block
nMaturity = 66; // 99 Minutes
nMasternodeCountDrift = 4;
Expand Down Expand Up @@ -211,6 +212,7 @@ class CTestNetParams : public CMainParams

nLastPOWBlock = 1000;
nLastPOWBlockOld = 1100;
nLastSeeSawBlock = 1200;
nMaturity = 15;
nMaxMoneyOut = 33284220 * COIN; // 2032 Maximum
nRampToBlock = 100;
Expand Down

0 comments on commit 4d51264

Please sign in to comment.