Skip to content

Commit

Permalink
no message (+2 squashed commit)
Browse files Browse the repository at this point in the history
Squashed commit:

[a94a7f8] Update readme.md

[77aaf0d] no message (+1 squashed commits)

Squashed commits:

[14331d2] no message (+1 squashed commits)

Squashed commits:

[77640d7] no message (+6 squashed commit)
  • Loading branch information
alexeyneu committed Feb 18, 2018
1 parent efad01e commit 07b2c91
Show file tree
Hide file tree
Showing 17 changed files with 168 additions and 29 deletions.
11 changes: 8 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
- Sys Req:
Visual C++ 2010 redist
https://www.microsoft.com/en-us/download/details.aspx?id=14632
and openssl
![Screen1](/screens/Untitled%201.jpg)
![Screen1](/screens/Untitled%202.jpg)
![Screen1](/screens/Untitled%208.jpg)
## about
mines block that starts blockchain.
all options are in `MainFrm.h`
## build:
where are these tools were used?
https://github.com/DMDcoin/Diamond/blob/a1a7f6b8a3bad0df8fd8ddb9ead0347b1fa440f4/src/chainparams.cpp#L125
i.e.
## build:
Req: `.lib` out of openssl build

nmake holds well on non-2010
- ms visual studio 2010 (C++)
32/64-bit : conf manager/change active solution platform
Expand Down
Binary file modified screens/Untitled 1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screens/Untitled 2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screens/Untitled 8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 36 additions & 20 deletions tool3/MainFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "MainFrm.h"
#include <openssl/sha.h>
#include <iomanip>
#include "mount.h"

#ifdef _DEBUG
#define new DEBUG_NEW
Expand All @@ -22,6 +23,7 @@ BEGIN_MESSAGE_MAP(CMainFrame, CWnd)
ON_WM_CREATE()
ON_BN_CLICKED(2133,tr)
ON_BN_CLICKED(233,w)
ON_BN_CLICKED(2233,uw)
ON_WM_DESTROY()
ON_WM_CLOSE()
END_MESSAGE_MAP()
Expand Down Expand Up @@ -49,16 +51,18 @@ CMainFrame::~CMainFrame()

// CMainFrame message handlers


mount *mount_tx;

HWND hc,hz;
CButton *bh;
CButton *q;
CStatic *b7[3];
HANDLE cl;
CButton *finA;

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
mount_tx=NULL;
cl=CreateEvent(NULL,1,0,NULL);
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
Expand All @@ -69,20 +73,22 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
b7[2]=new CStatic();
q=new CButton();
CBitmap wq[2];
finA=new CButton();

wq[0].LoadBitmap(IDB_BITMAP1);
wq[1].LoadBitmap(IDB_BITMAP4);

wchar_t w[140];

bh->Create(L"start",BS_BITMAP|WS_CHILD|WS_VISIBLE,CRect(50,50,170,100),this,2133);
bh->Create(L"start",BS_BITMAP|WS_CHILD|WS_VISIBLE|WS_DISABLED,CRect(50,50,170,100),this,2133);
bh->SetBitmap(wq[0]);
q->Create(L"stop",BS_BITMAP|WS_CHILD|WS_VISIBLE|WS_DISABLED,CRect(50+170,50,170+170,100),this,233);
q->SetBitmap(wq[1]);
b7[0]->Create(L"to go :",WS_CHILD|WS_VISIBLE|SS_WHITEFRAME|SS_SIMPLE,CRect(3,290,473,320),this);
b7[1]->Create(L"to go :",WS_CHILD|WS_VISIBLE|SS_WHITEFRAME|SS_SIMPLE,CRect(3,290-70,473,320-70),this);
b7[2]->Create(L"to go :",WS_CHILD|WS_VISIBLE|SS_WHITEFRAME|SS_SIMPLE,CRect(3,290-35,473,320-35),this);
hc=CreateWindowEx(WS_EX_NOPARENTNOTIFY, MSFTEDIT_CLASS,NULL,
finA->Create(L"init",BS_TEXT|WS_CHILD|WS_VISIBLE,CRect(0+280,20+292,59+280,48+292),this,2233);
hc=CreateWindowEx(WS_EX_NOPARENTNOTIFY, MSFTEDIT_CLASS,NULL,
ES_MULTILINE|ES_AUTOVSCROLL| WS_VISIBLE | WS_CHILD |WS_TABSTOP|WS_VSCROLL,
1, 350, 450, 201, this->m_hWnd, NULL, h, NULL);
HFONT newFont = CreateFont(22, 0, 0, 0,0 , FALSE, FALSE, FALSE, DEFAULT_CHARSET,
Expand Down Expand Up @@ -170,14 +176,17 @@ VOID c(VOID *x)
SETTEXTEX fw;
fw.flags=4;
fw.codepage=1200;
Transaction *transaction;

Transaction *transaction;
unsigned char hash1[32];
uint32_t timestamp_len = 0, scriptSig_len = 0, pubkey_len = 0, pubkeyScript_len = 0;

pubkey_len = strlen(pubkey) / 2; // One byte is represented as two hex characters, thus we divide by two to get real length.
timestamp_len = strlen(timestamp);
pubkey_len = wcslen(mount_tx->m_pubkey) / 2; // One byte is represented as two hex characters, thus we divide by two to get real length.
timestamp_len = wcslen(mount_tx->m_timestamp);
CW2A timestamp((LPCWSTR)mount_tx->m_timestamp);
CW2A pubkey((LPCWSTR)mount_tx->m_pubkey);

transaction = InitTransaction();
transaction = InitTransaction();
scriptSig_len = timestamp_len;

// Encode pubkey to binary and prepend pubkey size, then append the OP_CHECKSIG byte
Expand All @@ -193,27 +202,27 @@ VOID c(VOID *x)


// This is basically how I believe the size of the nBits is calculated
if (nBits < 0x100)
if (mount_tx->m_nb < 0x100)
{
transaction->scriptSig[scriptSig_pos++] = 0x01;
transaction->scriptSig[scriptSig_pos++] = (uint8_t)nBits;
transaction->scriptSig[scriptSig_pos++] = (uint8_t)mount_tx->m_nb;
}
else if(nBits < 0x10000)
else if(mount_tx->m_nb < 0x10000)
{
transaction->scriptSig[scriptSig_pos++] = 0x02;
memcpy(transaction->scriptSig+scriptSig_pos, &nBits, 2);
memcpy(transaction->scriptSig+scriptSig_pos, &mount_tx->m_nb, 2);
scriptSig_pos+=2;
}
else if(nBits < 0x1000000)
else if(mount_tx->m_nb < 0x1000000)
{
transaction->scriptSig[scriptSig_pos++] = 0x03;
memcpy(transaction->scriptSig+scriptSig_pos, &nBits, 3);
memcpy(transaction->scriptSig+scriptSig_pos, &mount_tx->m_nb, 3);
scriptSig_pos+=3;
}
else //else if(nBits < 4294967296LL)
else //else if(mount_tx->m_nb < 4294967296)
{
transaction->scriptSig[scriptSig_pos++] = 0x04;
memcpy(transaction->scriptSig+scriptSig_pos, &nBits, 4);
memcpy(transaction->scriptSig+scriptSig_pos, &mount_tx->m_nb, 4);
scriptSig_pos+=4;
}
//below works only if structure alignment turned off .
Expand All @@ -224,12 +233,10 @@ VOID c(VOID *x)
// It should essentially mean PUSH 1 byte on the stack which in this case is 0x04 or just 4
transaction->scriptSig[scriptSig_pos++] = 0x01;
transaction->scriptSig[scriptSig_pos++] = 0x04;

transaction->scriptSig[scriptSig_pos++] = (uint8_t)scriptSig_len;

scriptSig_len += scriptSig_pos;
transaction->scriptSig = (uint8_t*)realloc(transaction->scriptSig, scriptSig_len);
memcpy(transaction->scriptSig+scriptSig_pos, (const unsigned char *)timestamp, timestamp_len);
memcpy(transaction->scriptSig+scriptSig_pos, timestamp, timestamp_len);

uint32_t serializedLen =
4 // tx version
Expand Down Expand Up @@ -281,7 +288,7 @@ VOID c(VOID *x)
PostMessage(hc, WM_VSCROLL, SB_BOTTOM, 0);

unsigned char block_hash1[32];
blockheader block_header={/* drift */ 1 , {} , {} , unixtime == 0 ? time(NULL) + c : unixtime + c, nBits , startNonce };
blockheader block_header={/* drift */ 1 , {} , {} , mount_tx->m_ut == 0 ? time(NULL) + c : mount_tx->m_ut + c, mount_tx->m_nb , mount_tx->m_nonce };
blockhash block_hashf;
unsigned char* block_headerp=(unsigned char*)&block_header;
unsigned char* block_hashfp=(unsigned char*)&block_hashf;
Expand Down Expand Up @@ -377,7 +384,8 @@ void CMainFrame::OnDestroy()
delete b7[1];
delete b7[2];
// delete rew;

delete finA;
if(mount_tx) delete mount_tx;
// TODO: Add your message handler code here
}

Expand Down Expand Up @@ -407,3 +415,11 @@ void CMainFrame::OnClose()
}
}

void CMainFrame::uw()
{
mount_tx=new mount(NULL);
int c=mount_tx->DoModal();
if(c!=IDOK) { delete mount_tx ; mount_tx = NULL; bh->EnableWindow(0); return;}
bh->EnableWindow();

}
11 changes: 6 additions & 5 deletions tool3/MainFrm.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const uint32_t nBits = 486604799;
const uint32_t startNonce=0; //= 2083236893;
const uint32_t unixtime=0; //= 1231006505;
const char timestamp[]="The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
const char pubkey[131]="04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f";
//const uint32_t nBits = 486604799;
//const uint32_t startNonce=0; //= 2083236893;
//const uint32_t unixtime=0; //= 1231006505;
//const char timestamp[]="The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
//const char pubkey[131]="04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f";


// MainFrm.h : interface of the CMainFrame class
Expand Down Expand Up @@ -52,6 +52,7 @@ class CMainFrame : public CWnd
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void tr();
afx_msg void w();
afx_msg void uw();
afx_msg void OnDestroy();
protected:
public:
Expand Down
9 changes: 8 additions & 1 deletion tool3/ReadMe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@ For the main frame window:

MainFrm.h, MainFrm.cpp
These files contain the frame class CMainFrame, which is derived from
CFrameWnd and controls all SDI frame features.
CFrameWnd

also

tool3.h:
structures to represent all that. defines're there so to make it compatible with hash functions. transaction structure
doesn't need that.same define statements there to ensure that nothing more is in memory so first : it can be copied as memory block wo care (not a big deal) ,
second : if structure has alignment you can copy it as block too but it gives nothing in this case.

/////////////////////////////////////////////////////////////////////////////

Expand Down
59 changes: 59 additions & 0 deletions tool3/mount.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// mount.cpp : implementation file
//

#include "stdafx.h"
#include "tool3.h"
#include "mount.h"
#include "afxdialogex.h"


// mount dialog

IMPLEMENT_DYNAMIC(mount, CDialogEx)

mount::mount(CWnd* pParent /*=NULL*/)
: CDialogEx(mount::IDD, pParent)
{
m_nonce = 0;
m_ut = 0;
m_nb = 0;
m_timestamp = _T("");
m_pubkey = _T("");
}

mount::~mount()
{
}

void mount::OnFinalRelease()
{
// When the last reference for an automation object is released
// OnFinalRelease is called. The base class will automatically
// deletes the object. Add additional cleanup required for your
// object before calling the base class.

CDialogEx::OnFinalRelease();
}

void mount::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT5, m_nonce);
DDX_Text(pDX, IDC_EDIT4, m_ut);
DDX_Text(pDX, IDC_EDIT3, m_nb);
DDX_Text(pDX, IDC_EDIT2, m_timestamp);
DDV_MaxChars(pDX, m_timestamp, 254);
DDX_Text(pDX, IDC_EDIT1, m_pubkey);
DDV_MaxChars(pDX, m_pubkey, 130);
}

BEGIN_MESSAGE_MAP(mount, CDialogEx)
ON_BN_CLICKED(IDC_BUTTON1, &mount::OnBnClickedButton1)
END_MESSAGE_MAP()

// mount message handlers

void mount::OnBnClickedButton1()
{
this->OnOK();
}
30 changes: 30 additions & 0 deletions tool3/mount.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once


// mount dialog

class mount : public CDialogEx
{
DECLARE_DYNAMIC(mount)

public:
mount(CWnd* pParent = NULL); // standard constructor
virtual ~mount();

virtual void OnFinalRelease();

// Dialog Data
enum { IDD = IDD_DIALOGBAR };

protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support

DECLARE_MESSAGE_MAP()
public:
UINT m_nonce;
afx_msg void OnBnClickedButton1();
UINT m_ut;
UINT m_nb;
CString m_timestamp;
CString m_pubkey;
};
Binary file modified tool3/resource.h
Binary file not shown.
1 change: 1 addition & 0 deletions tool3/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <afxcontrolbars.h>

//#include <afxcontrolbars.h> // MFC support for ribbons and control bars
#ifdef _MSC_VER
Expand Down
4 changes: 4 additions & 0 deletions tool3/tool3.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

#include "resource.h" // main symbols

/*structures to represent all that. defines're there so to make it compatible with hash functions. transaction structure
doesn't need that.same define statements there to ensure that nothing more is in memory so first : it can be copied as memory block wo care (not a big deal) ,
second : if structure has alignment you can copy it as block too but it gives nothing in this case.*/

struct Transaction{
#ifdef _MSC_VER
#pragma pack(1)
Expand Down
Binary file modified tool3/tool3.rc
Binary file not shown.
4 changes: 4 additions & 0 deletions tool3/tool3.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,14 @@
</ItemDefinitionGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
<None Include="res\9.bmp" />
<None Include="res\hyg.bmp" />
<None Include="res\tool3.ico" />
<None Include="res\tool3.rc2" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="MainFrm.h" />
<ClInclude Include="mount.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
Expand All @@ -212,6 +215,7 @@
<ClCompile Include="MainFrm.cpp">
<WholeProgramOptimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</WholeProgramOptimization>
</ClCompile>
<ClCompile Include="mount.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
Expand Down
12 changes: 12 additions & 0 deletions tool3/tool3.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
<None Include="res\tool3.ico">
<Filter>Resource Files</Filter>
</None>
<None Include="res\hyg.bmp">
<Filter>Resource Files</Filter>
</None>
<None Include="res\9.bmp">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ClInclude Include="tool3.h">
Expand All @@ -39,6 +45,9 @@
<ClInclude Include="Resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="mount.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="tool3.cpp">
Expand All @@ -50,6 +59,9 @@
<ClCompile Include="MainFrm.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="mount.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="tool3.rc">
Expand Down
Binary file added x64/Release/libcrypto-1_1-x64.dll
Binary file not shown.
Binary file modified x64/Release/tool3.exe
Binary file not shown.

0 comments on commit 07b2c91

Please sign in to comment.