Skip to content

Commit

Permalink
Burgerhash V6 Update (ACE-LIGHT)
Browse files Browse the repository at this point in the history
Burgerhash V6 Update (ACE-LIGHT).
We are adding ACE-LIGHT (first version of the Algo Composer Engine) to Burgerhash V5.
  • Loading branch information
zettel-kasten committed Apr 15, 2019
1 parent 6e90879 commit 60eaccc
Show file tree
Hide file tree
Showing 12 changed files with 1,138 additions and 80 deletions.
4 changes: 2 additions & 2 deletions src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 9
#define CLIENT_VERSION_REVISION 19
#define CLIENT_VERSION_REVISION 20
#define CLIENT_VERSION_BUILD 1

// Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE true

// Copyright year (2009-this)
// Todo: update this when changing our copyright comments in the source
#define COPYRIGHT_YEAR 2018
#define COPYRIGHT_YEAR 2019

// Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro!
Expand Down
40 changes: 39 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ map<uint256, set<uint256> > mapOrphanTransactionsByPrev;

std::map<uint256,uint256> SDKPGABSPCSSWSSBP_keymap; //SDKPGABSPCSSWSSBP_keymap for onetime calculated privkey/pubkey

std::vector<unsigned int> SDKPGABSPCSSWSSBP_ACELIGHT_INSTRUCTION_CHAIN; //instructions for ACELIGHT are stored in this vector


// Constant stuff for coinbase transactions we create:
CScript COINBASE_FLAGS;

Expand Down Expand Up @@ -1568,7 +1571,42 @@ uint256 CBlock::GetPoWHash() const
SDKPGABSPC_sinetable_pos = nHeight%64;
nHeight_even = (nHeight%2 == 0);

if (nHeight >= SDKPGABSPCSSWSSBP_START_HEIGHT)
if (nHeight >= SDKPGABSPCSSWSSBP_ACELIGHT_START_HEIGHT)
{
bytes = GetABCBytesForSDKPGABFromHash(hashPrevBlock);

const uint32_t dist = (nHeight-SDKPGABSPCSSWSSBP_ACELIGHT_START_HEIGHT);
const uint32_t instr_i = (dist/SDKPGABSPCSSWSSBP_ACELIGHT_SPACING);

if(SDKPGABSPCSSWSSBP_ACELIGHT_INSTRUCTION_CHAIN.size() < (instr_i+1)){

SDKPGABSPCSSWSSBP_ACELIGHT_INSTRUCTION_CHAIN.resize(instr_i+1);

const uint32_t ace_first_height = SDKPGABSPCSSWSSBP_ACELIGHT_START_HEIGHT-SDKPGABSPCSSWSSBP_ACELIGHT_DISTANCE;

for(int i = 0; i<=instr_i;i++){
SDKPGABSPCSSWSSBP_ACELIGHT_INSTRUCTION_CHAIN.at(i) =
FindBlockByHeight(ace_first_height
+(i*SDKPGABSPCSSWSSBP_ACELIGHT_SPACING))->GetBlockHash().Get64(0);
}
}

if(!SDKPGABSPCSSWSSBP_keymap.count(hashPrevBlock)){
pubkey_hashPrevBlock = SDKPGABSPCSSWSSBP_GetPublicKeyFromPrivateKey(hashPrevBlock);
SDKPGABSPCSSWSSBP_keymap.insert(std::make_pair(hashPrevBlock,pubkey_hashPrevBlock));
};

pubkey_hashPrevBlock = SDKPGABSPCSSWSSBP_keymap[hashPrevBlock];

return HashSDKPGABSPCSSWSSBP_ACELIGHT(Header.begin(), Header.end(),
nHeight_even,
bytes.A, bytes.B,
SDKPGABSPC_sinetable_pos,
pubkey_hashPrevBlock,
&SDKPGABSPCSSWSSBP_ACELIGHT_INSTRUCTION_CHAIN,instr_i+1);
}

else if (nHeight >= SDKPGABSPCSSWSSBP_START_HEIGHT)
{
bytes = GetABCBytesForSDKPGABFromHash(hashPrevBlock);

Expand Down
5 changes: 5 additions & 0 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ class CMasterNodeVote;

struct CBlockIndexWorkComparator;

/** Block Height (>=) for SDKPGABSPCSSWSSBP_ACELIGHT start height */
static const unsigned int SDKPGABSPCSSWSSBP_ACELIGHT_START_HEIGHT = 555555;
static const unsigned int SDKPGABSPCSSWSSBP_ACELIGHT_DISTANCE = 1440;
static const unsigned int SDKPGABSPCSSWSSBP_ACELIGHT_SPACING = 360;

/** Block Height (>=) for SDKPGABSPCSSWSSBP start height */
static const unsigned int SDKPGABSPCSSWSSBP_START_HEIGHT = 400000;

Expand Down
17 changes: 4 additions & 13 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1256,19 +1256,10 @@ void ThreadDNSAddressSeed()
unsigned int pnSeed[] =
{

0x03F92305,0x0CF4FCD5,0x15DB70C1,
0x17CCC3CB,0x17D770C1,0x1ACBB6D9,
0x1D46E052,0x1EE8C3CB,0x259AC3CB,
0x349B54C6,0x42A3C3CB,0x4B13D350,
0x4DA3C3CB,0x5C7D26B2,0x679AC3CB,
0x6ECDEF91,0x6EE6C3CB,0x8D1FA479,
0x93F770C1,0x9C713A4D,0xA7A0C3CB,
0xB5E8C3CB,0xB5F4FCD5,0xB72D1C95,
0xB73219B9,0xC13219B9,0xC5E6C3CB,
0xC811A51F,0xC8E8C3CB,0xC91C4C2D,
0xCEFD2305,0xD0F770C1,0xDBFFEF91,
0xE98451AC,0xEE3319B9,0xF10F0908,
0xFBB8202D,
0x4B13D350,0xAB52FA5B,0x53EB13C2,
0x9C713A4D,0x3C56FA5B,0x7CDAA51F,
0x3B8E3895,0x4C4E6347,0xCE53FA5B,
0x7359F122,

};

Expand Down
627 changes: 627 additions & 0 deletions src/pow.h

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions src/qt/forms/miningpage.ui
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,88 @@
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_ace_light">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>ACE LIGHT STRENGTH: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_ace_light_strength">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_recent_instructions">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>5 most recent instructions:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_recent_instructions_list">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
Expand Down
162 changes: 135 additions & 27 deletions src/qt/miningpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,23 +205,27 @@ void MiningPage::timerEvent(QTimerEvent *)
ui->labelNextBlock->setText(NextBlockTime);


uint nHeight = pindexBest->nHeight+1;

uint nHeight = pindexBest->nHeight+1;
ui->label_SDKPRAB_1->setVisible(false);
ui->label_SDKPRAB_2->setVisible(false);
ui->label_SDKPRAB_3->setVisible(false);
ui->label_SDKPRAB_4->setVisible(false);
ui->label_SDKPRAB_5->setVisible(false);
ui->label_SDKPRAB_6->setVisible(false);
ui->label_SDKPRAB_7->setVisible(false);
ui->label_SDKPRAB_8->setVisible(false);

ui->label_SDKPRAB_1->setVisible(false);
ui->label_SDKPRAB_2->setVisible(false);
ui->label_SDKPRAB_3->setVisible(false);
ui->label_SDKPRAB_4->setVisible(false);
ui->label_SDKPRAB_5->setVisible(false);
ui->label_SDKPRAB_6->setVisible(false);
ui->label_SDKPRAB_7->setVisible(false);
ui->label_SDKPRAB_8->setVisible(false);
ui->label_hashalgo->setText("mining block with height "+QString::number(nHeight)+" using SpreadDoubleKetchup");

ui->label_hashalgo->setText("mining block with height "+QString::number(nHeight)+" using SpreadDoubleKetchup");

ui->label_SDKPRABSPC_1->setVisible(false);
ui->label_SDKPRABSPC_2->setVisible(false);

ui->label_SDKPRABSPC_1->setVisible(false);
ui->label_SDKPRABSPC_2->setVisible(false);
ui->label_ace_light->setVisible(false);
ui->label_ace_light_strength->setVisible(false);
ui->label_recent_instructions->setVisible(false);
ui->label_recent_instructions_list->setVisible(false);

if(nHeight >= SDKPGAB_START_HEIGHT){
ui->label_SDKPRAB_1->setVisible(true);
Expand Down Expand Up @@ -261,6 +265,30 @@ void MiningPage::timerEvent(QTimerEvent *)
ui->label_inputsize_2->setText("64 + "+QString::number(64-SDKPGABSPC_sinetable[nHeight%64]));
}

//ACE-LIGHT INSTRUCTION CHAIN for mininginfo:
std::vector<unsigned int> SDKPGABSPCSSWSSBP_ACELIGHT_INSTRUCTION_CHAIN;
unsigned int ace_light_strength;

if(nHeight >=SDKPGABSPCSSWSSBP_ACELIGHT_START_HEIGHT){

const uint32_t dist = (nHeight-SDKPGABSPCSSWSSBP_ACELIGHT_START_HEIGHT);
const uint32_t instr_i = (dist/SDKPGABSPCSSWSSBP_ACELIGHT_SPACING);

if(SDKPGABSPCSSWSSBP_ACELIGHT_INSTRUCTION_CHAIN.size() < (instr_i+1)){
SDKPGABSPCSSWSSBP_ACELIGHT_INSTRUCTION_CHAIN.resize(instr_i+1);

const uint32_t ace_first_height = SDKPGABSPCSSWSSBP_ACELIGHT_START_HEIGHT-SDKPGABSPCSSWSSBP_ACELIGHT_DISTANCE;

for(int i = 0; i<=instr_i;i++){
SDKPGABSPCSSWSSBP_ACELIGHT_INSTRUCTION_CHAIN.at(i) =
FindBlockByHeight(ace_first_height
+(i*SDKPGABSPCSSWSSBP_ACELIGHT_SPACING))->GetBlockHash().Get64(0);
};
};

ace_light_strength = SDKPGABSPCSSWSSBP_ACELIGHT_INSTRUCTION_CHAIN.size();
}

if(nHeight >= SDKPGABSPCSSWS_START_HEIGHT){
ui->label_hashalgo->setText("mining block with height "+QString::number(nHeight)+" using SpreadDoubleKetchupPrimeGradeABeefStickyPuffyCheeseSomethingSomethingWordSalad");

Expand All @@ -283,33 +311,113 @@ void MiningPage::timerEvent(QTimerEvent *)

CBufferStream<185> Header = pindexBest->GetBlockHeader().SerializeHeaderForHash2();

wordsalad = GetWordSalad_SDKPGABSPCSSWS(Header.begin(), Header.end(),
(prev_height%2 == 0),
bytes.A, bytes.B,
SDKPGABSPC_sinetable_pos);
if(prev_height >=SDKPGABSPCSSWS_START_HEIGHT && prev_height < SDKPGABSPCSSWSSBP_ACELIGHT_START_HEIGHT){
wordsalad = GetWordSalad_SDKPGABSPCSSWS(Header.begin(), Header.end(),
(prev_height%2 == 0),
bytes.A, bytes.B,
SDKPGABSPC_sinetable_pos);
}

if(prev_height >=SDKPGABSPCSSWSSBP_ACELIGHT_START_HEIGHT){

//attention, calculated for previous block:
const uint32_t dist = (prev_height-SDKPGABSPCSSWSSBP_ACELIGHT_START_HEIGHT);
const uint32_t instr_i = (dist/SDKPGABSPCSSWSSBP_ACELIGHT_SPACING);
ace_light_strength = instr_i+1;

wordsalad = GetWordSalad_SDKPGABSPCSSWSSBP_ACELIGHT(Header.begin(), Header.end(),
(prev_height%2 == 0),
bytes.A, bytes.B,
SDKPGABSPC_sinetable_pos,
&SDKPGABSPCSSWSSBP_ACELIGHT_INSTRUCTION_CHAIN, ace_light_strength);
}

ui->label_wordsalad_title->setText("Block #"+QString::number(prev_height)+" wordsalad:");
ui->label_wordsalad->setText(wordsalad.c_str());
}
}
}

if(nHeight >= SDKPGABSPCSSWSSBP_START_HEIGHT){
ui->label_hashalgo->setText("mining block with height "+QString::number(nHeight)+" using SpreadDoubleKetchupPrimeGradeABeefStickyPuffyCheeseSomethingSomethingWordSaladSenoritaBonitaPepita");
if(nHeight >= SDKPGABSPCSSWSSBP_START_HEIGHT){
ui->label_hashalgo->setText("mining block with height "+QString::number(nHeight)+" using SpreadDoubleKetchupPrimeGradeABeefStickyPuffyCheeseSomethingSomethingWordSaladSenoritaBonitaPepita");

ui->label_inputsize_1->setText("185 + "+QString::number(SDKPGABSPC_sinetable[nHeight%64]));
ui->label_inputsize_2->setText("185 + 32 + "+QString::number(64-SDKPGABSPC_sinetable[nHeight%64]));

ui->label_pepita_title->setText("hashPrevBlock keypair:");

ui->label_inputsize_1->setText("185 + "+QString::number(SDKPGABSPC_sinetable[nHeight%64]));
ui->label_inputsize_2->setText("185 + 32 + "+QString::number(64-SDKPGABSPC_sinetable[nHeight%64]));
uint256 hashPrevBlock = pindexBest->GetBlockHash();
ui->label_pepita_privkey->setText(hashPrevBlock.GetHex().c_str());

ui->label_pepita_title->setText("hashPrevBlock keypair:");
uint256 pubkey_hashPrevBlock;

uint256 hashPrevBlock = pindexBest->GetBlockHash();
ui->label_pepita_privkey->setText(hashPrevBlock.GetHex().c_str());
pubkey_hashPrevBlock = SDKPGABSPCSSWSSBP_GetPublicKeyFromPrivateKey(hashPrevBlock);

uint256 pubkey_hashPrevBlock;
ui->label_pepita_pubkey->setText(pubkey_hashPrevBlock.GetHex().c_str());
}

pubkey_hashPrevBlock = SDKPGABSPCSSWSSBP_GetPublicKeyFromPrivateKey(hashPrevBlock);
if(nHeight >= SDKPGABSPCSSWSSBP_ACELIGHT_START_HEIGHT){
ui->label_hashalgo->setText("mining block with height "+QString::number(nHeight)+" using SpreadDoubleKetchupPrimeGradeABeefStickyPuffyCheeseSomethingSomethingWordSaladSenoritaBonitaPepita-AlgoComposerEngineLight");

ui->label_pepita_pubkey->setText(pubkey_hashPrevBlock.GetHex().c_str());
}
ui->label_ace_light->setVisible(true);
ui->label_ace_light_strength->setVisible(true);
ui->label_recent_instructions->setVisible(true);
ui->label_recent_instructions_list->setVisible(true);

ui->label_ace_light_strength->setText(QString::number(ace_light_strength));
QString ace_instructions_str = "...";

int ace_instruction_count_start = ace_light_strength-5;

if(ace_instruction_count_start<=0){
ace_instruction_count_start = 0;
}

unsigned char ACELIGHT_METHOD;
unsigned short ACELIGHT_BYTE_A; //modulo 46
unsigned short ACELIGHT_BYTE_B; //modulo 46
unsigned short ACELIGHT_BYTE_A_FULL;
unsigned short ACELIGHT_BYTE_B_FULL;
unsigned short ACELIGHT_BIT; //modulo 368

for (int i = ace_instruction_count_start; i<ace_light_strength;i++){
uint32_t instruction = SDKPGABSPCSSWSSBP_ACELIGHT_INSTRUCTION_CHAIN.at(i);
ACELIGHT_METHOD = (((unsigned char*)&instruction)[0])>>5;
ACELIGHT_BYTE_A_FULL = ((unsigned char*)&instruction)[1];
ACELIGHT_BYTE_B_FULL = ((unsigned char*)&instruction)[2];
ACELIGHT_BYTE_A = ACELIGHT_BYTE_A_FULL%46;
ACELIGHT_BYTE_B = ACELIGHT_BYTE_B_FULL%46;
ACELIGHT_BIT = ((ACELIGHT_BYTE_A_FULL<<8) + ACELIGHT_BYTE_B_FULL) % 368;

ace_instructions_str.append(" - (");
if(ACELIGHT_METHOD == 0){
ace_instructions_str.append("SWAP.BYTES "+QString::number(ACELIGHT_BYTE_A,16)+" "+QString::number(ACELIGHT_BYTE_B,16));
}
else if(ACELIGHT_METHOD == 1){
ace_instructions_str.append("ROTL.BYTES "+QString::number(ACELIGHT_BYTE_A,16)+" "+QString::number(ACELIGHT_BYTE_B,16));
}
else if(ACELIGHT_METHOD == 2){
ace_instructions_str.append("ROTR.BYTES "+QString::number(ACELIGHT_BYTE_A,16)+" "+QString::number(ACELIGHT_BYTE_B,16));
}
else if(ACELIGHT_METHOD == 3){
ace_instructions_str.append("INV.BYTES "+QString::number(ACELIGHT_BYTE_A,16)+" "+QString::number(ACELIGHT_BYTE_B,16));
}
else if(ACELIGHT_METHOD == 4){
ace_instructions_str.append("SET.BIT "+QString::number(ACELIGHT_BIT,16));
}
else if(ACELIGHT_METHOD == 5){
ace_instructions_str.append("UNSET.BIT "+QString::number(ACELIGHT_BIT,16));
}
else if(ACELIGHT_METHOD == 6){
ace_instructions_str.append("INV.BIT "+QString::number(ACELIGHT_BIT,16));
}
else if(ACELIGHT_METHOD == 7){
ace_instructions_str.append("REV.BYTES "+QString::number(ACELIGHT_BYTE_A,16)+" "+QString::number(ACELIGHT_BYTE_B,16));
}
ace_instructions_str.append(")");
}

ui->label_recent_instructions_list->setText(ace_instructions_str);
}

}
Loading

0 comments on commit 60eaccc

Please sign in to comment.