Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
129 changes: 106 additions & 23 deletions README.md
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,128 @@
DigitalNote [XDN] integration/staging tree
=====================================
DigitalNote [XDN] 2014-2018 (CryptoNote Base), 2018-2019 (Current) integration/staging tree
===========================================================================================

http://www.digitalnote.biz

What is the DigitalNote [XDN] Blockchain?
---------------------------
-----------------------------------------
*TODO: Update documentation regarding implemented tech as this section is out of date and much progress and upgrades have been made to mentioned sections...*

### Overview
DigitalNote is a blockchain project with the goal of offering secured messaging, Darksend, masternodes and an overall pleasing experience to the user.

### Blockchain Technology
The DigitalNote [XDN] Blockchain is an experimental smart contract platform protocol that enables
instant payments to anyone, anywhere in the world in a private, secure manner.
DigitalNote [XDN] uses peer-to-peer blockchain technology developed by DigitalNote to operate
with no central authority: managing transactions, execution of contracts, and
issuing money are carried out collectively by the network. DigitalNote [XDN] is the name of
open source software which enables the use of this protocol.

Specifications and General info
------------------
DigitalNote uses libsecp256k1,
libgmp,
Boost1.63,
OR Boost1.57,
Openssl1.02k,
Berkeley DB 6.2.23,
QT5.8 to compile
### Custom Difficulty Retarget Algorithm “VRX”
VRX is designed from the ground up to integrate properly with the Velocity parameter enforcement system to ensure users no longer receive orphan blocks.

### Velocity Block Constraint System
Ensuring Insane stays as secure and robust as possible the CryptoCoderz team have implemented what's known as the Velocity block constraint system. This system acts as third and final check for both mined and peer-accepted blocks ensuring that all parameters are strictly enforced.

Block Spacing: 5 Minutes
Stake Minimum Age: 15 Confirmations (PoS-v3) | 30 Minutes (PoS-v2)

Port: 18092
RPC Port: 18094
### Wish (bmw512) Proof-of-Work Algorithm
Wish or bmw512 hashing algorithm is utilized for the Proof-of-Work function and also replaces much of the underlying codebase hashing functions as well that normally are SHA256. By doing so this codebase is able to be both exponentially lighter and more secure in comparison to reference implementations.

### Echo512 Proof-of-Stake Algorithm
DigitnalNote's proof of stake system utilizes Echo512 which is a super lightweight and secure hashing algorithm.

Specifications and General info
------------------
DigitalNote uses

libsecp256k1,
libgmp,
Boost1.68, OR Boost1.58,
Openssl1.02o,
Berkeley DB 6.2.32,
QT5.11,
to compile
=======
BUILD LINUX
-----------
1) git clone https://github.com/DigitalNoteXDN/DigitalNote-1

2) cd XDN/src

3) sudo make -f makefile.unix # Headless
General Specs

(optional)
Block Spacing: 5 Minutes
Stake Minimum Age: 15 Confirmations (PoS-v3) | 30 Minutes (PoS-v2)
Port: 18092
RPC Port: 18094

4) strip DigitalNoted

5) sudo cp DigitalNoted /usr/local/bin
BUILD LINUX
-----------
### Compiling DigitalNote "SatoshiCore" daemon on Ubunutu 18.04 LTS Bionic
### Note: guide should be compatible with other Ubuntu versions from 14.04+

### Become poweruser
```
sudo -i
```
### CREATE SWAP FILE FOR DAEMON BUILD (if system has less than 2GB of RAM)
```
cd ~; sudo fallocate -l 3G /swapfile; ls -lh /swapfile; sudo chmod 600 /swapfile; ls -lh /swapfile; sudo mkswap /swapfile; sudo swapon /swapfile; sudo swapon --show; sudo cp /etc/fstab /etc/fstab.bak; echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
```

### Dependencies install
```
cd ~; sudo apt-get install -y ntp git build-essential libssl-dev libdb-dev libdb++-dev libboost-all-dev libqrencode-dev libcurl4-openssl-dev curl libzip-dev; apt-get update -y; apt-get install -y git make automake build-essential libboost-all-dev; apt-get install -y yasm binutils libcurl4-openssl-dev openssl libssl-dev; sudo apt-get install -y libgmp-dev; sudo apt-get install -y libtool;
```

### Dependencies build and link
```
cd ~; wget http://download.oracle.com/berkeley-db/db-6.2.32.NC.tar.gz; tar zxf db-6.2.32.NC.tar.gz; cd db-6.2.32.NC/build_unix; ../dist/configure --enable-cxx; make; sudo make install; sudo ln -s /usr/local/BerkeleyDB.6.2/lib/libdb-6.2.so /usr/lib/libdb-6.2.so; sudo ln -s /usr/local/BerkeleyDB.6.2/lib/libdb_cxx-6.2.so /usr/lib/libdb_cxx-6.2.so; export BDB_INCLUDE_PATH="/usr/local/BerkeleyDB.6.2/include"; export BDB_LIB_PATH="/usr/local/BerkeleyDB.6.2/lib"
```

### GitHub pull (Source Download)
```
cd ~; git clone https://github.com/CryptoCoderz/DigitalNote
```

### Build DigitalNote daemon
```
cd ~; cd ~/DigitalNote/src; chmod a+x obj; chmod a+x leveldb/build_detect_platform; chmod a+x secp256k1; chmod a+x leveldb; chmod a+x ~/DigitalNote/src; chmod a+x ~/DigitalNote; make -f makefile.unix USE_UPNP=-; cd ~; cp -r ~/DigitalNote/src/DigitalNoted /usr/local/bin/DigitalNoted;
```

### Create config file for daemon
```
cd ~; sudo ufw allow 18092/tcp; sudo ufw allow 18094/tcp; sudo ufw allow 22/tcp; sudo mkdir ~/.XDN; cat << "CONFIG" >> ~/.XDN/DigitalNote.conf
listen=1
server=1
daemon=1
testnet=0
rpcuser=XDNrpcuser
rpcpassword=SomeCrazyVeryVerySecurePasswordHere
rpcport=18094
port=18092
rpcconnect=127.0.0.1
rpcallowip=127.0.0.1
CONFIG
chmod 700 ~/.XDN/DigitalNote.conf; chmod 700 ~/.XDN; ls -la ~/.XDN
```

### Run DigitalNote daemon
```
cd ~; DigitalNoted; DigitalNoted getinfo
```

### Troubleshooting
### for basic troubleshooting run the following commands when compiling:
### this is for minupnpc errors compiling

```
make clean -f makefile.unix USE_UPNP=-
make -f makefile.unix USE_UPNP=-
```
### Updating daemon in bin directory
```
cd ~; cp -r ~/DigitalNote/src/DigitalNoted /usr/local/bin
```

License
-------
Expand All@@ -64,6 +143,10 @@ The developer [mailing list](https://lists.linuxfoundation.org/mailman/listinfo/
should be used to discuss complicated or controversial changes before working
on a patch set.

<<
Developer Discord can be found at https://discord.gg/eSb7nEx.

=======
Testing
-------

Expand All@@ -86,4 +169,4 @@ in Python, that are run automatically on the build server.
Changes should be tested by somebody other than the developer who wrote the
code. This is especially important for large or high-risk changes. It is useful
to add a test plan to the pull request description if testing the changes is
not straightforward.
not straightforward.
14 changes: 7 additions & 7 deletions src/main.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -115,7 +115,7 @@ namespace {

struct CMainSignals {
// Notifies listeners of updated transaction data (passing hash, transaction, and optionally the block it is found in.
boost::signals2::signal<void (const CTransaction &, const CBlock *, bool)> SyncTransaction;
boost::signals2::signal<void (const CTransaction &, const CBlock *, bool, bool)> SyncTransaction;
// Notifies listeners of an erased transaction (currently disabled, requires transaction replacement).
boost::signals2::signal<void (const uint256 &)> EraseTransaction;
// Notifies listeners of an updated transaction without new data (for now: a coinbase potentially becoming visible).
Expand All@@ -130,7 +130,7 @@ struct CMainSignals {
}

void RegisterWallet(CWalletInterface* pwalletIn) {
g_signals.SyncTransaction.connect(boost::bind(&CWalletInterface::SyncTransaction, pwalletIn, _1, _2, _3));
g_signals.SyncTransaction.connect(boost::bind(&CWalletInterface::SyncTransaction, pwalletIn, _1, _2, _3, _4));
g_signals.EraseTransaction.connect(boost::bind(&CWalletInterface::EraseFromWallet, pwalletIn, _1));
g_signals.UpdatedTransaction.connect(boost::bind(&CWalletInterface::UpdatedTransaction, pwalletIn, _1));
g_signals.SetBestChain.connect(boost::bind(&CWalletInterface::SetBestChain, pwalletIn, _1));
Expand All@@ -144,7 +144,7 @@ void UnregisterWallet(CWalletInterface* pwalletIn) {
g_signals.SetBestChain.disconnect(boost::bind(&CWalletInterface::SetBestChain, pwalletIn, _1));
g_signals.UpdatedTransaction.disconnect(boost::bind(&CWalletInterface::UpdatedTransaction, pwalletIn, _1));
g_signals.EraseTransaction.disconnect(boost::bind(&CWalletInterface::EraseFromWallet, pwalletIn, _1));
g_signals.SyncTransaction.disconnect(boost::bind(&CWalletInterface::SyncTransaction, pwalletIn, _1, _2, _3));
g_signals.SyncTransaction.disconnect(boost::bind(&CWalletInterface::SyncTransaction, pwalletIn, _1, _2, _3, _4));
}

void UnregisterAllWallets() {
Expand All@@ -156,8 +156,8 @@ void UnregisterAllWallets() {
g_signals.SyncTransaction.disconnect_all_slots();
}

void SyncWithWallets(const CTransaction &tx, const CBlock *pblock, bool fConnect) {
g_signals.SyncTransaction(tx, pblock, fConnect);
void SyncWithWallets(const CTransaction &tx, const CBlock *pblock, bool fConnect, bool fFixSpentCoins) {
g_signals.SyncTransaction(tx, pblock, fConnect, fFixSpentCoins);
}

void ResendWalletTransactions(bool fForce) {
Expand DownExpand Up@@ -819,7 +819,7 @@ int64_t GetMinFee(const CTransaction& tx, unsigned int nBytes, bool fAllowFree,


bool AcceptToMemoryPool(CTxMemPool& pool, CTransaction &tx, bool fLimitFree,
bool* pfMissingInputs, bool fRejectInsaneFee, bool ignoreFees)
bool* pfMissingInputs, bool fRejectInsaneFee, bool ignoreFees, bool fFixSpentCoins)
{
AssertLockHeld(cs_main);
if (pfMissingInputs)
Expand DownExpand Up@@ -984,7 +984,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CTransaction &tx, bool fLimitFree,
pool.addUnchecked(hash, tx);
setValidatedTx.insert(hash);

SyncWithWallets(tx, NULL);
SyncWithWallets(tx, NULL, true, fFixSpentCoins);

LogPrint("mempool", "AcceptToMemoryPool : accepted %s (poolsz %u)\n",
hash.ToString(),
Expand Down
6 changes: 3 additions & 3 deletions src/main.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -126,7 +126,7 @@ void UnregisterWallet(CWalletInterface* pwalletIn);
/** Unregister all wallets from core */
void UnregisterAllWallets();
/** Push an updated transaction to all registered wallets */
void SyncWithWallets(const CTransaction& tx, const CBlock* pblock = NULL, bool fConnect = true);
void SyncWithWallets(const CTransaction& tx, const CBlock* pblock = NULL, bool fConnect = true, bool fFixSpentCoins = false);
/** Ask wallets to resend their transactions */
void ResendWalletTransactions(bool fForce = false);
/** Register with a network node to receive its signals */
Expand DownExpand Up@@ -157,7 +157,7 @@ void ThreadStakeMiner(CWallet *pwallet);

/** (try to) add transaction to memory pool **/
bool AcceptToMemoryPool(CTxMemPool& pool, CTransaction &tx, bool fLimitFree,
bool* pfMissingInputs, bool fRejectinsaneFee=false, bool ignoreFees=false);
bool* pfMissingInputs, bool fRejectinsaneFee=false, bool ignoreFees=false, bool fFixSpentCoins=false);

bool AcceptableInputs(CTxMemPool& pool, const CTransaction &txo, bool fLimitFree,
bool* pfMissingInputs, bool fRejectinsaneFee=false, bool isDSTX=false);
Expand DownExpand Up@@ -1452,7 +1452,7 @@ class CValidationState {

class CWalletInterface {
protected:
virtual void SyncTransaction(const CTransaction &tx, const CBlock *pblock, bool fConnect) =0;
virtual void SyncTransaction(const CTransaction &tx, const CBlock *pblock, bool fConnect, bool fFixSpentCoins) =0;
virtual void EraseFromWallet(const uint256 &hash) =0;
virtual void SetBestChain(const CBlockLocator &locator) =0;
virtual bool UpdatedTransaction(const uint256 &hash) =0;
Expand Down
2 changes: 1 addition & 1 deletion src/rpcrawtransaction.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -590,7 +590,7 @@ Value sendrawtransaction(const Array& params, bool fHelp)
else
{
// push to local node
if (!AcceptToMemoryPool(mempool, tx, true, NULL))
if (!AcceptToMemoryPool(mempool, tx, true, NULL, false, false, true))
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX rejected");
}
RelayTransaction(tx, hashTx);
Expand Down
16 changes: 15 additions & 1 deletion src/wallet.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -751,7 +751,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
return false;
}

void CWallet::SyncTransaction(const CTransaction& tx, const CBlock* pblock, bool fConnect)
void CWallet::SyncTransaction(const CTransaction& tx, const CBlock* pblock, bool fConnect, bool fFixSpentCoins)
{
LOCK2(cs_main, cs_wallet);
if (!AddToWalletIfInvolvingMe(tx, pblock, true))
Expand All@@ -778,6 +778,20 @@ void CWallet::SyncTransaction(const CTransaction& tx, const CBlock* pblock, bool
}

AddToWalletIfInvolvingMe(tx, pblock, true);

if (fFixSpentCoins)
{
// Mark old coins as spent
set<CWalletTx*> setCoins;
BOOST_FOREACH(const CTxIn& txin, tx.vin)
{
CWalletTx &coin = mapWallet[txin.prevout.hash];
coin.BindWallet(this);
coin.MarkSpent(txin.prevout.n);
coin.WriteToDisk();
NotifyTransactionChanged(this, coin.GetHash(), CT_UPDATED);
}
}
}

void CWallet::EraseFromWallet(const uint256 &hash)
Expand Down
2 changes: 1 addition & 1 deletion src/wallet.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -254,7 +254,7 @@ class CWallet : public CCryptoKeyStore, public CWalletInterface

void MarkDirty();
bool AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet=false);
void SyncTransaction(const CTransaction& tx, const CBlock* pblock, bool fConnect = true);
void SyncTransaction(const CTransaction& tx, const CBlock* pblock, bool fConnect = true, bool fFixSpentCoins = false);
bool AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate);
void EraseFromWallet(const uint256 &hash);
int ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate = false);
Expand Down