Yarkos Altcoin Guide
Yarkos Altcoin Guide
Yarkos Altcoin Guide
by
YarkoL
v.0.1
Build dependencies
lets install
Newer coins use autotools, introduced in Bitcoin 0.9. However Peercoin is based on older builds
and they still have makefiles. read build instructions in doc/build-unix.txt
Now you can check that you can build the headless client
cd stanislaw/src
then
$ make -f makefile.unix USE_UPNP=-
-printtoconsole will print out what the node is doing, and -debug will show some special messages,
that can be useful
After getting up and opening databases, it will exit with this message about missing conf file
rpcuser=rpc
rpcpassword=pwd
testnet=1
Just remember to replace the password with something reasonable (like a random string ) when you
run a node out there in the wild
Install QT Creator
It will ask you to make a developer account, then it will start to install
go to peercoin directory
open the pro file in qt creator
configure the project, select qt5 for the build, then projects > build steps and add
"USE_UPNP=-"
to qmake additional arguments
/src/qt/bitcoinunits
QString BitcoinUnits::name(int unit)
{
switch(unit)
{
case BTC: return QString("PPC");
case mBTC: return QString("mPPC");
case uBTC: return QString::fromUtf8("PPC");
default: return QString("???");
}
}
If base58.h is not showing up in the file window of qt creator, Search for CBase58Data and it
should open that
// DNS seeds
// Each pair gives a source name and a seed name.
// The first name is used as information source for addrman.
// The second name should resolve to a list of seed addresses.
// testnet dns seed begins with 't', all else are ppcoin dns
seeds.
static const char *strDNSSeed[][2] = {
{"seed", "seed.fencoin.net"},
};
/src/net.cpp
seed.<yourcoinname>.net
A Record
14400
<IP of your node>
)
there is a lot of Peercoin/Bitcoin history in the source code, that is totally superfluous, but since
were only learning stuff, it doesnt matter.
However, regarding these network identifiers, replace with something like this. (Dont use these
values, though, they are taken from Fencoin, a coin that Im developing now, and I dont want it to
collide with your coin out there. Think up some hex values of your own, OK?)
Then, replace
with
Then delete the second argument fPersistent, and do so in declaration in the header file too
Search for usage of GetMessageStart and remove the boolean where it occurs
#include "version.h"
// Name of client reported in the 'version' message. Report the
same name
// for both bitcoind and bitcoin-qt, to make it harder for
attackers to
// target servers or GUI users specifically.
const std::string CLIENT_NAME("Satoshi");
after that you switch to header and if you wish you can edit
#define PPCOIN_VERSION_MAJOR 0
#define PPCOIN_VERSION_MINOR 0
#define PPCOIN_VERSION_REVISION 0
#define PPCOIN_VERSION_BUILD 1
Back to qcreator
replace in checkpoints cpp
// sync-checkpoint master key
const std::string CSyncCheckpoint::strMasterPubKey =
"04c0c707c28533fd5c9f79d2d3a2d80dff259ad8f915241cd14608fb9bc07c748
30efe8438f2b272a866b4af5e0c2cc2a9909972aefbd976937e39f46bb38c277c"
;
Put the private key to safekeeping, you're going to use it on your server
with checkpointkey=<the private key> in the conf file
Changing PoS
//
// Init with genesis block
//
if (mapBlockIndex.empty())
{
if (!fAllowNew)
return false;
// Genesis Block:
// CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000,
hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893,
vtx=1)
// CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1,
nLockTime=0)
// CTxIn(COutPoint(000000, -1), coinbase
04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72
206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73)
// CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B)
// vMerkleTree: 4a5e1e
// Genesis block
const char* pszTimestamp = "Matonis 07-AUG-2012 Parallel Currencies And
The Roadmap To Monetary Freedom";
CTransaction txNew;
txNew.nTime = 1345083810;
txNew.vin.resize(1);
txNew.vout.resize(1);
txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(9999) <<
vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned
char*)pszTimestamp + strlen(pszTimestamp));
txNew.vout[0].SetEmpty();
CBlock block;
block.vtx.push_back(txNew);
block.hashPrevBlock = 0;
block.hashMerkleRoot = block.BuildMerkleTree();
block.nVersion = 1;
block.nTime = 1345084287;
block.nBits = bnProofOfWorkLimit.GetCompact();
block.nNonce = 2179302059u;
if (fTestNet)
{
block.nTime = 1345090000;
block.nNonce = 122894938;
}
Then the magic ingredient the genesis-mining-code , paste this above debug print
$ date +%s
1493226199
if (fTestNet)
{
block.nTime = 1493226199;
block.nNonce = 0;
}
And then
My beautiful block hash
14c563d82d3dc1f75185b60dd081130690a116c36ce590555b65ca9d1a38cb3d
hashGenesisBlock (hardcoded)
00000001f757bb737f6596503e17cd17b0658ce630cc727c0cca81aec47c9f06
block merkle root
172bffb461d76bffadc16d8f78bb2650288b434c3441603302903e29eb2fab42
ppcoind: main.cpp:2355: bool LoadBlockIndex(bool): Assertion
`block.hashMerkleRoot ==
uint256("0x3c2d8f85fab4d17aac558cc648a1a58acff0de6deb890c29985690052c5993c2")'
failed.
we need only the merkle root. Put it into the assertion code.
assert(block.hashMerkleRoot ==
uint256("0x172bffb461d76bffadc16d8f78bb2650288b434c3441603302903e2
9eb2fab42"));
Lets change the PoW limit to something easy that we dont have to wait all day for it to mine
again build the client and run. Now the mining for genesis starts. This is what I got
Mining genesis
nonce 00010000: hash =
a795e25979854e9a3b282905682a7bd2a5d39b9191c4c247848de70d7dbf3310
nonce 00020000: hash =
a48b7db1d24e06838e7889e7bfa5238e040ba76ca86d1b48f21de5ba37027a84
nonce 00030000: hash =
35d0c768e02f46f47d161f53544fe0f9ca2272d3deee3358d6660ac4aad03c2d
nonce 00040000: hash =
34fea0087334542d614adc002e6d9aed4956367bb0e1532025f65a77c9838f72
nonce 00050000: hash =
90a85eb12331b2971f76d7dfcbf422994c1059b37df3018b0df6dcb67f551498
nonce 00060000: hash =
2790491ca7e08b9dc169e161398422178809a18b9f826c16188b4f592890b358
We have a winner here. Put the My beautiful block hash into genesis block hash, in this case
in main.h
if (fTestNet)
{
block.nTime = 1493226199;
block.nNonce = 68425;
}
You have now an unique coin, with an identity, network and genesis of its own.
$ md5sum mini32.iso
a2502844750ecb6477d8fb4ff6b9aaf8 mini32.iso
Start virtualbox
After it has installed, close the VM. Go to settings and remove the iso file under controller IDE
and restart. Log in with the details you entered during the installation.
Reboot.
Network with the guest virtual machine
So we can mine some blocks!
Follow this
https://2buntu.com/articles/1513/accessing-your-virtualbox-guest-from-your-host-os/
GRAPHICS etc
BitcoinGUI::BitcoinGUI(QWidget *parent):
QMainWindow(parent),
clientModel(0),
walletModel(0),
encryptWalletAction(0),
changePassphraseAction(0),
unlockWalletAction(0),
lockWalletAction(0),
aboutQtAction(0),
trayIcon(0),
notificator(0),
rpcConsole(0)
{
resize(850, 550);
setWindowTitle(tr("Fencoin"));
/src/qt/res/icons - This is the folder that contains all the icons for your wallet
/src/qt/res/images - This is the splash (loading) screen for your new coin
Set up server
Get one from online.net or somewhere, for example here (no affiliate)
https://www.online.net/en/dedicated-cloud#starter-cloud