山寨币创世块的快速制作


       比特币在工作,首先是通过创世块来启动,所以要制作一个山寨币,首先要解决的第一个问题,就是创建创世块,在网上有大神已经分享了它的创世块工具,一段python脚本,在这个脚本中可以分别对莱特币使用的scrypt加密算法和比特币的使用SHA256进行快速的计算出创世块信息。有了创世块数据,就可以用于打造自己的山寨币了。首先需要准备一台linux系统,最好的方法是,准备一台虚拟机,在虚拟机安装最新的版的linux系统,我安装的是ubuntu14.04..

下载地址:一段python脚本,在这个脚本中可以分别对莱特币使用的scrypt加密算法和比特币的使用SHA256进行快速的计算出创世块信息。有了创世块数据,就可以用于打造自己的山寨币了。http://download.csdn.net/detail/vs9841/7261525

       要使用这段脚本,首先需要在linux系统中安装pip,然后为python安装scrypt模块,(重要提醒:升级最新版的openssl1.0.1g)。

       1、安装pip,方法如下:

sudo apt-get install python-pip python-dev build-essential 
sudo pip install --upgrade pip 
sudo pip install --upgrade virtualenv 
     2、安装scrypt模块为python

sudo pip install scrypt construct
3、接下来就可以使有脚本了,脚本使用方法,基本如下:

下面的命令是创建了一个SHA256,基于比特币的创世块信息,之后,你将这些信息替换到比特币源代码即可中,恭喜你已经山寨了一个比特币。。

    python genesis.py  -z "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks" -n 2083236893 -t 1231006505
Output:

    algorithm: sha256
    merkle hash: 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b
    pszTimestamp: The Times 03/Jan/2009 Chancellor on brink of second bailout for banks
    pubkey: 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f
    time: 1231006505
    bits: 0x1d00ffff
    Searching for genesis hash..
    genesis hash found!
    nonce: 2083236893
    genesis hash: 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f

=========================================
下面的命令用于创建scrypt加密算法的创世块命令格式,只是比上面的多了一个scrypt关键字。。

    python genesis.py --scrypt -z "NY Times 05/Oct/2011 Steve Jobs, Apple’s Visionary, Dies at 56" -p "040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9" -t 1317972665 -n 2084524493
    
在里说一下,-z参数后面的文本串,对应了比特币或是莱特币源代码中的,pszTimestamp变量值。

##命令参数选项说明
    python genesis.py -h
    
    使用: genesis.py [参数选项]

    参数选项:
    -h, --help            显示帮助提示信息并退出
    -t TIME, --time=TIME   TIME 是一个unix时间,可以通过python的time.time()得到。它是代表创世块的生成时间
    -z TIMESTAMP, --timestamp=TIMESTAMP
                          the pszTimestamp found in the coinbase of the
                          genesisblock
    -n NONCE, --nonce=NONCE
                          the first value of the nonce that will be incremented
                          when searching the genesis hash
    -s, --scrypt          calculate genesis block using scrypt
    -p PUBKEY, --pubkey=PUBKEY
                          The pubkey found in the output script






你可能感兴趣的:(python,C/C++)