Author

Topic: Building An Altcoin: Some Assembly Required (Read 3010 times)

newbie
Activity: 15
Merit: 0
January 22, 2014, 08:45:41 AM
#5
Not to gripe, but you missed pnSeed[] in net.cpp.
I'm pretty sure that one might be important too Wink

Great tutorial though!
legendary
Activity: 2198
Merit: 1014
Franko is Freedom
December 15, 2013, 06:38:16 PM
#4
Smiley

hopefully i can get some peace for a while now.

Probably not. "Some assembly" is too much for alot. lol.
hero member
Activity: 686
Merit: 504
always the student, never the master.
December 15, 2013, 06:34:24 PM
#3
Smiley

hopefully i can get some peace for a while now.
legendary
Activity: 2198
Merit: 1014
Franko is Freedom
December 15, 2013, 06:32:01 PM
#2
Smiley
hero member
Activity: 686
Merit: 504
always the student, never the master.
December 15, 2013, 06:23:02 PM
#1
Foreword: No line numbers are given. You must use critical thinking to complete this guide. If you are unable to complete this guide, then programming is not for and you and you don't need to clone a cryptocoin anyway. there are far to many copy paste coins around already and your ideas are nothing special. if they were, you wouldn't be reading this guide.. surprise!

Step 1- Know thy source code.(required)
   -always read your sourcecode. its important that you gain atleast a simple understanding of what it does. the more time you spend reading code,     the better you become at writing it. study, practice, troubleshoot, ask questions in that order. No one has the time to cater to your ass, learn to do it yourself and be better for it in the long run.


Step 2- Find & Replace coin names, and replace/customize images as desired.(required)
   -if you need help with this, you probably have no business here in the first place. this is not rocket science, but critical thinking is required.

Step 3- Customize GUI with QT designer(optional)
   -blundertoe taught me how to use this tool, and its pretty intuitive. a bit confusing, but if you know your way around an xml style sheet, that's half the battle.

Step 4- Ports(required)

  a) bitcoinrpc.cpp
        -change RPC port.

    
Code:
ip::tcp::endpoint endpoint(bindAddress, GetArg("-rpcport", 55883));

    
Code:
if (!d.connect(GetArg("-rpcconnect", "127.0.0.1"), GetArg("-rpcport", "55883")))

  b) init.cpp
       -change RPC port
    
    
Code:
-rpcport= " + _("Listen for JSON-RPC connections on  (default: 55883)") + "\n" +

       -change Testnet and Common port(P2P).

    
Code:
-port= " + _("Listen for connections on  (default: 55884 or testnet: 45884)") + "\n" +
 
  c) protocol.h

      -Testnet and P2P port again.

    
Code:
return testnet ? 45883 : 55884;

Step 5- Add a seednode(optional, but recommended)
   net.cpp
     -add a seednode using ip or dns name.
    
Code:
{"some website name", "somewebsite.org or ip x.x.x.x"},

Step 6- Set your coins parameters
   a)main.cpp
      -set your block rewards. once you've set the initial subsidy, you can set optional parameters in this scope, and use conditional statements. critical thinking required, but this is probably the easiest aspect of programming C++ as there is. you can do it. just try.
    
    
Code:
int64 nSubsidy = 1 * COIN;

     -if you want an example template for conditional rewards, here is an example from when i was working on OSC and needed some feedback from some friends in IRC. please be advised additional steps are required for Proof Of Stake coins.
    Example
    http://pastebin.com/QMdAiGzP

   b)main.cpp
     -set target spacing and other vital coin parameters.pretty self explanatory. most source's this will be commented to help you understand what it means. if you are not used to seeing algebra or math in programming, it may look a bit confusing at first.
    
Code:
static const int64 nTargetSpacing = 120;
static const int64 nTargetTimespan = 1 * 24 * 60 * 60;

   c)main.cpp
     -you need to change your coins network id to make it unique. find this in your source.

    
Code:
unsigned char pchMessageStart[4] =
     this will be followed by four  4 charachter hex codes(representing ascii charachters) inside a set of brackets. such as
    
Code:
{ 0xe4, 0xe8, 0xe9, 0xe5 };
    -change a few of the hexadecimal codes, but make sure they are valid, eg. - 0xdd, 0xff, 0xfe, 0xf3, 0xda, 0xff, 0xle, etc.
  
   d)main.h
   - change first the number of total coins ever to be produced.
   find this:
  
Code:
static const int64 MAX_MONEY =
  and this:
  
Code:
return dPriority > COIN *
  e)base58.h
       -change the starting letter for the addresses of your coin. for a list of values, google base58 charachter codes, or better yet, see this link from the bitcoin wiki. https://en.bitcoin.it/wiki/Base58Check_encoding
  
Code:
PUBKEY_ADDRESS =

Step 7- Review, and complete additional steps.
   completing the bare minimum steps
    -once you've made it this far, its time to hop on over to this guide http://devtome.com/doku.php?id=scrypt_altcoin_cloning_guide and make sure you've done everything in this guide now

Step 8- Finishing touches


if (POS === true)
{
Do these steps to setup a checkpoint server:
assuming you've already compiled, open your client. open the debug window(or from the command prompt/shell if using daemon)
type
Code:
makekeypair

you will get an output like this

Code:


{
"PrivateKey" : "308201130201010420a9a674c69c336384f86a0d7bf47b2248e95c2c0cd568cf6c20455c63990a2471a081a53081a2020101302c06072a8648ce3d0101022100ffffffffffffffffffffdddddffffffffffffffffffffffffffffffffffefffffc2f300604010004010704410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8022100fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141020101a1333342000408ebd69d4e1564efczzz0a77a876496713a1ggg58c47aeb3abb57e2ee83d72df0d73fe7f33d3dc33fa97502d961e7251fe12ccf0f9a15b2a96d7895078aed81c",
"PublicKey" : "0408ebd69d4e1564efcbee0a77a876496713a10ae58c47aebfffb57e2ee83d72df0d73fe7f33d3dc33fa97502d961e7251fe12ccf0f9a15b2a96d7895078aed81c"
}



save this in a text document.

close the client.

open your configuration file for your coin(if you haven't created one, now would be a great time to start.). paste in your privatekey in the following format
Code:
checkpointkey=
now save and exit, then restart the client.

now you must reflect this in the sourcecode, by adding your public key as the checkpoint master. without this, it will not work at all.
checkpoints.cpp
find this and add your public key( do not add your private key in the source, only in your conf file.
Code:
const std::string CSyncCheckpoint::strMasterPubKey =
there will be a public key already there. delete it, and put yours in its place. now save, and recompile the clients. congratulations, you are finished.
}else{

//you're done!
}
Jump to: