Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b32062f
WIP parse and validate SS58 with RPC
AmirAbrams Nov 22, 2021
fdd3c01
Move swap RPC commands to seperate code file
AmirAbrams Nov 27, 2021
f6732ef
Show swap transactions in Qt UI
AmirAbrams Nov 27, 2021
ad4741b
Get OP_RETURN data and convert to Base58
AmirAbrams Nov 27, 2021
2e908a4
Store swap transactions in leveldb
AmirAbrams Nov 29, 2021
f5a1855
Use a seperate SS58 class to parse the address
AmirAbrams Nov 30, 2021
0806e36
Remove swap RPC when wallet is disabled
AmirAbrams Dec 1, 2021
07aef59
Cleanup icons and stub swap menu item
AmirAbrams Dec 2, 2021
2be1101
Add icon to import mnemonic menu item
AmirAbrams Dec 2, 2021
6bae9c1
Swap all funds minus transaction fee
AmirAbrams Dec 3, 2021
c7d5a3d
Add swap balances and verbiage to UI
AmirAbrams Dec 6, 2021
c75aa1c
Do not count unspendable fluid fee tx outputs
AmirAbrams Oct 16, 2021
909da07
Change block stats in main readme
AmirAbrams Oct 19, 2021
453335b
Bump version to 2.5.0.1
AmirAbrams Oct 19, 2021
dd68c01
Only connect to clients with min protocol 72500
AmirAbrams Oct 19, 2021
f520578
backport: Switch all RNG code to the built-in PRNG (bitcoin#14955)
kwvg Dec 19, 2018
f9b1e58
SS58 calculate checksum and refactor class
AmirAbrams Dec 9, 2021
459e23c
Add SS58 format unit tests
AmirAbrams Dec 9, 2021
84cbf5e
Fix count in getswaps RPC
AmirAbrams Dec 9, 2021
c938286
Allow multiple SS58 validation errors
AmirAbrams Dec 10, 2021
760303f
Store fees paid in swap database
AmirAbrams Dec 10, 2021
0f4d425
Add get swap errors RPC for testing
AmirAbrams Dec 12, 2021
de40c26
Handle large swap with many utxos
AmirAbrams Dec 14, 2021
f13c5e8
Swap tx final fixes and adjustments
AmirAbrams Dec 15, 2021
f645dff
Increase max network data size
AmirAbrams Dec 16, 2021
6ade845
Use checksum in SS58 validation
AmirAbrams Dec 18, 2021
3c8f453
Fix audit 32-bit build error
AmirAbrams Dec 18, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,11 @@ What is [Dynamic](https://duality.solutions/dynamic)?
* PoW Mining Algorithm: Argon2d
* PoW Difficulty Algorithm: Digishield V3
* PoW Period: Unlimited
* PoW Target Spacing: 128 Seconds
* PoW Target Spacing: 75 Seconds
* PoW Reward per Block: Controlled via Fluid Protocol
* PoW Reward Start Height: Block 5,137
* PoS Mining Algorithm: Blake2b
* PoS Period: Unlimited
* PoS Target Spacing: 128 Seconds
* PoS Reward per Block: Controlled via Fluid Protocol
* PoS Reward Start Height: Controlled via SPORK activation
* Maturity: 10 Blocks
* PoW Blocks: ~675 per day
* PoS Blocks: ~675 per day
* Total Blocks Per Day: ~1350
* PoW Blocks: ~1152 per day
* Dynode Collateral Amount: 1000 DYN
* Dynode Min Confirmation: 17 Blocks
* Dynode Reward: Controlled via Fluid Protocol
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 2)
define(_CLIENT_VERSION_MINOR, 5)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_BUILD, 1)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2021)
AC_INIT([Dynamic],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/duality-solutions/dynamic/issues],[dynamic])
Expand Down
2 changes: 1 addition & 1 deletion contrib/gitian-descriptors/gitian-arm.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "dynamic-arm-2.5.0.0"
name: "dynamic-arm-2.5.0.1"
enable_cache: true
suites:
- "trusty"
Expand Down
2 changes: 1 addition & 1 deletion contrib/gitian-descriptors/gitian-linux.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "dynamic-linux-2.5.0.0"
name: "dynamic-linux-2.5.0.1"
enable_cache: true
suites:
- "trusty"
Expand Down
2 changes: 1 addition & 1 deletion contrib/gitian-descriptors/gitian-osx.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "dynamic-osx-2.5.0.0"
name: "dynamic-osx-2.5.0.1"
enable_cache: true
suites:
- "trusty"
Expand Down
2 changes: 1 addition & 1 deletion contrib/gitian-descriptors/gitian-win.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "dynamic-2.5.0.0"
name: "dynamic-2.5.0.1"
enable_cache: true
suites:
- "trusty"
Expand Down
5 changes: 4 additions & 1 deletion dynamic-qt.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
TEMPLATE = app
TARGET = dynamic
VERSION = 2.5.0.0
VERSION = 2.5.0.1
INCLUDEPATH += src \
src/crypto \
src/crypto/heavyhash \
Expand Down Expand Up @@ -309,6 +309,7 @@ HEADERS += \
src/qt/askpassphrasedialog.h \
src/qt/addresstablemodel.h \
src/qt/addressbookpage.h \
src/qt/swapdialog.h \
src/compat/byteswap.h \
src/compat/sanity.h \
src/consensus/consensus.h \
Expand Down Expand Up @@ -485,6 +486,7 @@ SOURCES += \
src/qt/sendcoinsentry.cpp \
src/qt/signverifymessagedialog.cpp \
src/qt/splashscreen.cpp \
src/qt/swapdialog.cpp \
src/qt/dynodelist.cpp \
src/qt/trafficgraphwidget.cpp \
src/qt/transactiondesc.cpp \
Expand Down Expand Up @@ -652,4 +654,5 @@ FORMS += \
src/qt/forms/sendcoinsdialog.ui \
src/qt/forms/sendcoinsentry.ui \
src/qt/forms/signverifymessagedialog.ui \
src/qt/forms/swapdialog.ui \
src/qt/forms/transactiondescdialog.ui
7 changes: 7 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ DYNAMIC_CORE_H = \
support/cleanse.h \
support/lockedpool.h \
support/events.h \
swap/ss58.h \
swap/swapdata.h \
swap/swapdb.h \
sync.h \
threadinterrupt.h \
threadsafety.h \
Expand Down Expand Up @@ -350,9 +353,13 @@ libdynamic_server_a_SOURCES = \
rpc/rawbdap.cpp \
rpc/rawtransaction.cpp \
rpc/server.cpp \
rpc/swap.cpp \
script/sigcache.cpp \
sendalert.cpp \
spork.cpp \
swap/ss58.cpp \
swap/swapdata.cpp \
swap/swapdb.cpp \
timedata.cpp \
torcontrol.cpp \
txdb.cpp \
Expand Down
7 changes: 4 additions & 3 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ QT_FORMS_UI = \
qt/forms/sendcoinsdialog.ui \
qt/forms/sendcoinsentry.ui \
qt/forms/signverifymessagedialog.ui \
qt/forms/swapdialog.ui \
qt/forms/transactiondescdialog.ui

QT_MOC_CPP = \
Expand Down Expand Up @@ -100,6 +101,7 @@ QT_MOC_CPP = \
qt/moc_sendcoinsentry.cpp \
qt/moc_signverifymessagedialog.cpp \
qt/moc_splashscreen.cpp \
qt/moc_swapdialog.cpp \
qt/moc_trafficgraphwidget.cpp \
qt/moc_transactiondesc.cpp \
qt/moc_transactiondescdialog.cpp \
Expand Down Expand Up @@ -179,6 +181,7 @@ DYNAMIC_QT_H = \
qt/sendcoinsentry.h \
qt/signverifymessagedialog.h \
qt/splashscreen.h \
qt/swapdialog.h \
qt/trafficgraphdata.h \
qt/trafficgraphwidget.h \
qt/transactiondesc.h \
Expand Down Expand Up @@ -242,13 +245,10 @@ RES_ICONS = \
qt/res/icons/drk/lock_open.png \
qt/res/icons/drk/notsynced.png \
qt/res/icons/drk/overview.png \
qt/res/icons/drk/pos.png \
qt/res/icons/drk/quit.png \
qt/res/icons/drk/receive.png \
qt/res/icons/drk/remove.png \
qt/res/icons/drk/send.png \
qt/res/icons/drk/staking_active.png \
qt/res/icons/drk/staking_inactive.png \
qt/res/icons/drk/synced.png \
qt/res/icons/drk/transaction_abandoned.png \
qt/res/icons/drk/transaction_conflicted.png \
Expand Down Expand Up @@ -332,6 +332,7 @@ DYNAMIC_QT_CPP += \
qt/transactionrecord.cpp \
qt/transactiontablemodel.cpp \
qt/transactionview.cpp \
qt/swapdialog.cpp \
qt/walletframe.cpp \
qt/walletmodel.cpp \
qt/walletmodeltransaction.cpp \
Expand Down
1 change: 1 addition & 0 deletions src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ DYNAMIC_TESTS =\
test/sighash_tests.cpp \
test/sigopcount_tests.cpp \
test/skiplist_tests.cpp \
test/ss58_tests.cpp \
test/streams_tests.cpp \
test/test_dynamic.cpp \
test/test_dynamic.h \
Expand Down
4 changes: 2 additions & 2 deletions src/bdap/audit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ bool BuildAuditJson(const CAudit& audit, UniValue& oAudit)
oAuditHashes.push_back(Pair("audit_hash" + std::to_string(counter), stringFromVch(vchAudit)));
}
oAudit.push_back(Pair("version", std::to_string(audit.Version())));
oAudit.push_back(Pair("audit_count", auditData.vAuditData.size()));
oAudit.push_back(Pair("audit_count", (int)auditData.vAuditData.size()));
oAudit.push_back(Pair("audit_hashes", oAuditHashes));
oAudit.push_back(Pair("timestamp", std::to_string(auditData.nTimeStamp)));
oAudit.push_back(Pair("owner", stringFromVch(audit.vchOwnerFullObjectPath)));
Expand All @@ -268,7 +268,7 @@ bool BuildVerifyAuditJson(const CAudit& audit, UniValue& oAudit)
CAuditData auditData = audit.GetAuditData();

oAudit.push_back(Pair("version", std::to_string(audit.Version())));
oAudit.push_back(Pair("audit_count", auditData.vAuditData.size()));
oAudit.push_back(Pair("audit_count", (int)auditData.vAuditData.size()));
oAudit.push_back(Pair("timestamp", std::to_string(auditData.nTimeStamp)));
oAudit.push_back(Pair("owner", stringFromVch(audit.vchOwnerFullObjectPath)));
oAudit.push_back(Pair("signed", audit.IsSigned() ? "True" : "False"));
Expand Down
1 change: 0 additions & 1 deletion src/bench/bench_dynamic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
int
main(int argc, char** argv)
{
RandomInit();
ECC_Start();
SetupEnvironment();
fPrintToDebugLog = false; // don't want to write to debug.log file
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define CLIENT_VERSION_MAJOR 2
#define CLIENT_VERSION_MINOR 5
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 0
#define CLIENT_VERSION_BUILD 1

//! Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE true
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/sha512.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CSHA512
uint64_t bytes;

public:
static const size_t OUTPUT_SIZE = 64;
static constexpr size_t OUTPUT_SIZE = 64;

CSHA512();
CSHA512& Write(const unsigned char* data, size_t len);
Expand Down
3 changes: 1 addition & 2 deletions src/fluid/fluid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ extern CWallet* pwalletMain;

bool IsTransactionFluid(const CScript& txOut)
{
return (txOut.IsProtocolInstruction(MINT_TX) || txOut.IsProtocolInstruction(DYNODE_MODFIY_TX) || txOut.IsProtocolInstruction(MINING_MODIFY_TX) ||
txOut.IsProtocolInstruction(BDAP_REVOKE_TX));
return txOut.IsFluid();
}

bool IsTransactionFluid(const CTransaction& tx, CScript& fluidScript)
Expand Down
23 changes: 23 additions & 0 deletions src/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,4 +396,27 @@ inline uint256 hash_Argon2d(const T1 pbegin, const T1 pend, const unsigned int&
return hashResult;
}

template<typename T1>
inline uint256 HashBlake2b_256(const T1 pbegin, const T1 pend)
{
static unsigned char pblank[1];
uint256 hash;
blake2b_state S[1];
blake2b_init( S, OUTPUT_BYTES ); // 32 Bytes -> 256-bit hash
blake2b_update( S, (pbegin == pend ? pblank : (unsigned char*)&pbegin[0]), (pend - pbegin) * sizeof(pbegin[0]) );
blake2b_final( S, (unsigned char*)&hash, OUTPUT_BYTES );
return hash;
}

template<typename T1>
inline uint512 HashBlake2b_512(const T1 pbegin, const T1 pend)
{
static unsigned char pblank[1];
uint512 hash;
blake2b_state S[1];
blake2b_init( S, 64 ); // 64 Bytes -> 512-bit hash
blake2b_update( S, (pbegin == pend ? pblank : (unsigned char*)&pbegin[0]), (pend - pbegin) * sizeof(pbegin[0]) );
blake2b_final( S, (unsigned char*)&hash, 64 );
return hash;
}
#endif // DYNAMIC_HASH_H
7 changes: 7 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
#include "script/sigcache.h"
#include "script/standard.h"
#include "spork.h"
#include "swap/swapdata.h"
#include "swap/swapdb.h"
#include "timedata.h"
#include "torcontrol.h"
#include "txdb.h"
Expand Down Expand Up @@ -377,6 +379,8 @@ void PrepareShutdown()
// LibTorrent DHT Netowrk Services
//delete pMutableDataDB;
//pMutableDataDB = NULL;
delete pSwapDB;
pSwapDB = NULL;
}
#ifdef ENABLE_WALLET
if (pwalletMain)
Expand Down Expand Up @@ -1739,6 +1743,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
delete pLinkManager;
// LibTorrent DHT Netowrk Services
//delete pMutableDataDB;
delete pSwapDB;

pblocktree = new CBlockTreeDB(nBlockTreeDBCache, false, fReindex);
pcoinsdbview = new CCoinsViewDB(nCoinDBCache, false, fReindex || fReindexChainState);
Expand All @@ -1760,6 +1765,8 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
pLinkManager = new CLinkManager();
// Init DHT Services DB
//pMutableDataDB = new CMutableDataDB(nTotalCache * 35, false, fReindex, obfuscate);
// Init SwapDB
pSwapDB = new CSwapDB(nTotalCache * 35, false, fReindex, obfuscate);

if (fReindex) {
pblocktree->WriteReindexing(true);
Expand Down
4 changes: 2 additions & 2 deletions src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ static const int FEELER_INTERVAL = 120;
static const unsigned int MAX_INV_SZ = 50000;
/** The maximum number of new addresses to accumulate before announcing. */
static const unsigned int MAX_ADDR_TO_SEND = 1000;
/** Maximum length of incoming protocol messages (no message over 2 MiB is currently acceptable). */
static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = 2 * 1024 * 1024;
/** Maximum length of incoming protocol messages (no message over 4 MB is currently acceptable). */
static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = (4 * 1024 * 1024) + 100;
/** Maximum length of strSubVer in `version` message */
static const unsigned int MAX_SUBVERSION_LENGTH = 256;
/** Maximum number of outgoing nodes */
Expand Down
2 changes: 1 addition & 1 deletion src/ntp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "utiltime.h"
#include "warnings.h"

extern int GetRandInt(int nMax);
extern int GetRandInt(int nMax) noexcept;

/*
* NTP uses two fixed point formats. The first (l_fp) is the "long"
Expand Down
3 changes: 3 additions & 0 deletions src/policy/policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ static const unsigned int STANDARD_LOCKTIME_VERIFY_FLAGS = LOCKTIME_VERIFY_SEQUE
/** Used for BDAP transactions. */
static const int BDAP_TX_VERSION = 0x3500;

/** Used for BDAP transactions. */
static const int SWAP_TX_VERSION = 0x3600;

bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType);
/**
* Check for standard transaction types
Expand Down
16 changes: 16 additions & 0 deletions src/primitives/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ bool CTxOut::GetBDAPOpCodes(int& opCode1, int& opCode2, std::vector<std::vector<
return DecodeBDAPScript(scriptPubKey, opCode1, opCode2, vvch);
}

bool CTxOut::IsFluid() const
{
return scriptPubKey.IsFluid();
}

bool CTxOut::IsData() const
{
opcodetype opcode;
Expand All @@ -101,6 +106,17 @@ bool CTxOut::IsData() const
return false;
}

bool CTxOut::GetData(std::vector<unsigned char>& vchData) const
{
if (!IsData())
return false;

if (GetOpReturnData(scriptPubKey, vchData))
return true;

return false;
}

std::string CTxOut::ToString() const
{
return strprintf("CTxOut(nValue=%d.%08d, scriptPubKey=%s, IsBDAP=%s, IsData=%s)", nValue / COIN, nValue % COIN
Expand Down
2 changes: 2 additions & 0 deletions src/primitives/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,10 @@ class CTxOut

bool IsBDAP() const;
bool IsData() const;
bool GetData(std::vector<unsigned char>& vchData) const;
bool GetBDAPOpCodes(int& opCode1, int& opCode2) const;
bool GetBDAPOpCodes(int& opCode1, int& opCode2, std::vector<std::vector<unsigned char>>& vvch) const;
bool IsFluid() const;

std::string ToString() const;
};
Expand Down
3 changes: 0 additions & 3 deletions src/qt/dynamic.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
<file alias="key">res/icons/drk/key.png</file>
<file alias="lock_closed">res/icons/drk/lock_closed.png</file>
<file alias="lock_open">res/icons/drk/lock_open.png</file>
<file alias="staking_active">res/icons/drk/staking_active.png</file>
<file alias="staking_inactive">res/icons/drk/staking_inactive.png</file>
<file alias="options">res/icons/drk/configure.png</file>
<file alias="history">res/icons/drk/history.png</file>
<file alias="overview">res/icons/drk/overview.png</file>
Expand All @@ -55,7 +53,6 @@
<file alias="transaction_4">res/icons/drk/clock4.png</file>
<file alias="transaction_5">res/icons/drk/clock5.png</file>
<file alias="tx_mined">res/icons/drk/tx_mined.png</file>
<file alias="pos">res/icons/drk/pos.png</file>
<file alias="bdap">res/icons/drk/bdap.png</file>
<file alias="tx_input">res/icons/drk/tx_input.png</file>
<file alias="tx_output">res/icons/drk/tx_output.png</file>
Expand Down
Loading