porkcoin (OP)
|
|
January 05, 2015, 07:46:42 AM |
|
#include <iostream>
using namespace std;
int main() { srand((unsigned)time(NULL)); int xxx=rand()%160; cout << xxx << endl; return 0; }
$ ./a.out 155 $ ./a.out 2 $ ./a.out 9 $ ./a.out 16
it is correct,He was able to meet the need, purpose is to don't know in which position the position of between 160 and 320. The purpose of this code adjustment is in selective miners mining You should find someone more experienced to review and fix the code, then re-luanch this coin.
Won't go to re-luanch this coin., because it is very important to a one-time luanch, in order to protect have been mined the coin.
|
|
|
|
porkcoin (OP)
|
|
January 05, 2015, 07:58:04 AM Last edit: January 05, 2015, 11:01:49 AM by porkcoin |
|
github:https://github.com/porkcoin/porkcoin
The seed is based on the previous block hash https://github.com/porkcoin/porkcoin/blob/master/src/main.cpp#L936
int64 GetProofOfWorkReward(int nHeight, int64 nFees, uint256 prevHash) { int64 nSubsidy = 1 * COIN;
srand((unsigned)time(NULL)); int xxx=rand()%160;
if(nHeight == 1) { nSubsidy = 100000 * COIN; }else if(nHeight < 10000) { if(nHeight % (160 + xxx) ==0) nSubsidy = 1024 * COIN; else nSubsidy = 1 * COIN; }else if(nHeight > 10000 && nHeight < 20000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 512 * COIN; else nSubsidy = 1 * COIN; }else if(nHeight > 20000 && nHeight < 40000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 256 * COIN; else nSubsidy = 1 * COIN; }else if(nHeight > 40000 && nHeight < 80000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 128 * COIN; else nSubsidy = 1 * COIN; } else if(nHeight > 80000 && nHeight < 160000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 64 * COIN; else nSubsidy = 1 * COIN; } else if(nHeight > 160000 && nHeight < 320000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 32 * COIN; else nSubsidy = 1 * COIN; } else if(nHeight > 320000 && nHeight < 640000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 16 * COIN; else nSubsidy = 1 * COIN; }else if(nHeight > 640000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 8 * COIN; else nSubsidy = 1 * COIN; }
return nSubsidy + nFees; }
|
|
|
|
porkcoin (OP)
|
|
January 05, 2015, 08:06:05 AM |
|
@tuaris Do you understand, I found that I need to be modified to come over. this is correct that result is different each time. by this way srand((unsigned)time(NULL)); int xxx=rand()%160;
|
|
|
|
porkcoin (OP)
|
|
January 05, 2015, 08:51:58 AM |
|
https://mega.co.nz/#!SUdTRQjJ!lGsyCQXUvAtj_n_loYwOzmKeKye1IrfNzrgQ5guh2j8github:https://github.com/porkcoin/porkcoin The seed is based on the previous block hash https://github.com/porkcoin/porkcoin/blob/master/src/main.cpp#L936int64 GetProofOfWorkReward(int nHeight, int64 nFees, uint256 prevHash) { int64 nSubsidy = 1 * COIN;
srand((unsigned)time(NULL)); int xxx=rand()%160;
if(nHeight == 1) { nSubsidy = 100000 * COIN; }else if(nHeight < 10000) { if(nHeight % (160 + xxx) ==0) nSubsidy = 1024 * COIN; else nSubsidy = 1 * COIN; }else if(nHeight > 10000 && nHeight < 20000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 512 * COIN; else nSubsidy = 1 * COIN; }else if(nHeight > 20000 && nHeight < 40000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 256 * COIN; else nSubsidy = 1 * COIN; }else if(nHeight > 40000 && nHeight < 80000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 128 * COIN; else nSubsidy = 1 * COIN; } else if(nHeight > 80000 && nHeight < 160000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 64 * COIN; else nSubsidy = 1 * COIN; } else if(nHeight > 160000 && nHeight < 320000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 32 * COIN; else nSubsidy = 1 * COIN; } else if(nHeight > 320000 && nHeight < 640000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 16 * COIN; else nSubsidy = 1 * COIN; }else if(nHeight > 640000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 8 * COIN; else nSubsidy = 1 * COIN; }
return nSubsidy + nFees; } this is correct, The last is this
|
|
|
|
porkcoin (OP)
|
|
January 05, 2015, 09:42:38 AM |
|
yes, when srand((unsigned)time(NULL)); int xxx=rand()%160; REORGANIZE: Disconnect 0 blocks; 00000005adc217e7fe13..00000005adc217e7fe13 REORGANIZE: Connect 1 blocks; 00000005adc217e7fe13..00000003f98fd5ec5db9 ERROR: Reorganize() : ConnectBlock 00000003f98fd5ec5db9 failed InvalidChainFound: invalid block=00000000d5038f442aab height=162 trust=17437 date=01/01/15 09:07:00 InvalidChainFound: current best=00000005adc217e7fe13 height=159 trust=15104 date=01/01/15 09:06:44 ERROR: SetBestChain() : Reorganize failed ERROR: AcceptBlock() : AddToBlockIndex failed ERROR: ProcessBlock() : AcceptBlock FAILED received block 00000002af30632c88b9 so ,It's incorrect to seed the random number generator with the current time. i agree. so The seed is based on the previous block hash is correct. I will fix it. thanks you tuaris
|
|
|
|
tuaris
|
|
January 05, 2015, 09:45:45 AM |
|
yes, when srand((unsigned)time(NULL)); int xxx=rand()%160; REORGANIZE: Disconnect 0 blocks; 00000005adc217e7fe13..00000005adc217e7fe13 REORGANIZE: Connect 1 blocks; 00000005adc217e7fe13..00000003f98fd5ec5db9 ERROR: Reorganize() : ConnectBlock 00000003f98fd5ec5db9 failed InvalidChainFound: invalid block=00000000d5038f442aab height=162 trust=17437 date=01/01/15 09:07:00 InvalidChainFound: current best=00000005adc217e7fe13 height=159 trust=15104 date=01/01/15 09:06:44 ERROR: SetBestChain() : Reorganize failed ERROR: AcceptBlock() : AddToBlockIndex failed ERROR: ProcessBlock() : AcceptBlock FAILED received block 00000002af30632c88b9 so ,It's incorrect to seed the random number generator with the current time. i agree. so The seed is based on the previous block hash is correct. I will fix it. thanks you tuaris I'll try to build from the latest github and see if I can setup a pool.
|
|
|
|
porkcoin (OP)
|
|
January 05, 2015, 11:03:41 AM Last edit: January 05, 2015, 11:49:58 AM by porkcoin |
|
yes, when srand((unsigned)time(NULL)); int xxx=rand()%160; REORGANIZE: Disconnect 0 blocks; 00000005adc217e7fe13..00000005adc217e7fe13 REORGANIZE: Connect 1 blocks; 00000005adc217e7fe13..00000003f98fd5ec5db9 ERROR: Reorganize() : ConnectBlock 00000003f98fd5ec5db9 failed InvalidChainFound: invalid block=00000000d5038f442aab height=162 trust=17437 date=01/01/15 09:07:00 InvalidChainFound: current best=00000005adc217e7fe13 height=159 trust=15104 date=01/01/15 09:06:44 ERROR: SetBestChain() : Reorganize failed ERROR: AcceptBlock() : AddToBlockIndex failed ERROR: ProcessBlock() : AcceptBlock FAILED received block 00000002af30632c88b9 so ,It's incorrect to seed the random number generator with the current time. i agree. so The seed is based on the previous block hash is correct. I will fix it. thanks you tuaris I'll try to build from the latest github and see if I can setup a pool. @tuaris thanks All have been submitted static const int CUTOFF_HEIGHT = POW_CUTOFF_HEIGHT; // miner's coin base reward based on nBits int64 GetProofOfWorkReward(int nHeight, int64 nFees, uint256 prevHash) { if(nHeight<1267) { int64 nSubsidy = 1 * COIN; if(nHeight % 160 ==0) nSubsidy = 1024 * COIN; else nSubsidy = 1 * COIN;
double num = nHeight / 10000 + 2 ; if(nHeight % 160 ==0)nSubsidy = (1024 / num ) * COIN; else nSubsidy = 1* COIN;
if(nHeight > 100000 ==0) { if(nHeight % 160 ==0) nSubsidy = 8 * COIN; else nSubsidy = 1 * COIN; } if(nHeight == 1) nSubsidy = 100000 * COIN;
return nSubsidy + nFees; }
int64 nSubsidy = 1 * COIN;
std::string cseed_str = prevHash.ToString().substr(7,7); const char* cseed = cseed_str.c_str(); long seed = hex2long(cseed); int xxx = generateMTRandom(seed, 99999);
if(nHeight == 1) { nSubsidy = 100000 * COIN; }else if(nHeight < 10000) { if(nHeight % (160 + xxx) ==0) nSubsidy = 1024 * COIN; else nSubsidy = 1 * COIN; }else if(nHeight > 10000 && nHeight < 20000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 512 * COIN; else nSubsidy = 1 * COIN; }else if(nHeight > 20000 && nHeight < 40000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 256 * COIN; else nSubsidy = 1 * COIN; }else if(nHeight > 40000 && nHeight < 80000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 128 * COIN; else nSubsidy = 1 * COIN; } else if(nHeight > 80000 && nHeight < 160000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 64 * COIN; else nSubsidy = 1 * COIN; } else if(nHeight > 160000 && nHeight < 320000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 32 * COIN; else nSubsidy = 1 * COIN; } else if(nHeight > 320000 && nHeight < 640000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 16 * COIN; else nSubsidy = 1 * COIN; }else if(nHeight > 640000 ) { if(nHeight % (160 + xxx) ==0) nSubsidy = 8 * COIN; else nSubsidy = 1 * COIN; }
return nSubsidy + nFees; }
windows wallets: https://mega.co.nz/#!7Bl1FAzK!QmUB5Eu3-Jva10Euy0qATeCiW5-ss4iDFx670uxyHgogithub: https://github.com/porkcoin/porkcoin/blob/master/src/main.cpp#L938
|
|
|
|
porkcoin (OP)
|
|
January 05, 2015, 01:11:33 PM |
|
And finally wallet synced! with rpc port: 9442 but in my all vps . it is still 1267 at now . ip 121.40.35.171,61.147.91.25,61.132.13.28 host: I don't know how to solve it ,Anyone who Know the reason and how to solve it?
|
|
|
|
logocreator
Legendary
Offline
Activity: 1134
Merit: 1000
www.cryptodesign.cc
|
|
January 05, 2015, 02:31:11 PM Last edit: January 05, 2015, 02:50:11 PM by logocreator |
|
Yes, i know, PorkCoin needs to be mined by solo or by pool, that's how chain will be moved. No other way. By solo mining chain is moving forward. tested: View My Video
|
|
|
|
porkcoin (OP)
|
|
January 05, 2015, 02:50:01 PM |
|
Yes, i know, PorkCoin needs to be mined by solo or by pool, that's how chain will be moved. No other way. By solo mining chain is moving forward. tested.
oh,that is ok. i will sleep. All of this to you
|
|
|
|
logocreator
Legendary
Offline
Activity: 1134
Merit: 1000
www.cryptodesign.cc
|
|
January 05, 2015, 02:50:29 PM |
|
|
|
|
|
porkcoin (OP)
|
|
January 05, 2015, 08:37:55 PM |
|
I will change him, pow pos hybrids. So at any time, also can work. The current pattern of pow, he can't, the automation of the work, very sorry.
|
|
|
|
logocreator
Legendary
Offline
Activity: 1134
Merit: 1000
www.cryptodesign.cc
|
|
January 05, 2015, 08:41:02 PM |
|
Any block explorer ?, it seems that i am missing coins on address: PTKaNNepuW1PDjMeWgRiu9qWVQCfuib89k
|
|
|
|
porkcoin (OP)
|
|
January 06, 2015, 02:04:47 AM |
|
Any block explorer ?, it seems that i am missing coins on address: PTKaNNepuW1PDjMeWgRiu9qWVQCfuib89k
do't mising . i will fix it.it could work ,
|
|
|
|
porkcoin (OP)
|
|
January 06, 2015, 02:16:18 AM |
|
it go to 1428. it working we need a pool
|
|
|
|
tuaris
|
|
January 06, 2015, 02:18:20 AM |
|
it go to 1428. it working we need a pool I am working on that. The source code has problems building in Linux/Unix.
|
|
|
|
porkcoin (OP)
|
|
January 06, 2015, 02:26:13 AM |
|
it go to 1428. it working we need a pool I am working on that. The source code has problems building in Linux/Unix. I will try build it int linux after I get up,then fix it. Thank you for your
|
|
|
|
tuaris
|
|
January 06, 2015, 06:48:29 AM |
|
it go to 1428. it working we need a pool I am working on that. The source code has problems building in Linux/Unix. I will try build it int linux after I get up,then fix it. Thank you for your I think there is something wrong with the makefile, it's failing for me here: c++ -c -O2 -pthread -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -g -DBOOST_SPIRIT_THREADSAFE -I/home/user/porkcoin/work/porkcoin-porkcoin-a60f73d/src -I/home/user/porkcoin/work/porkcoin-porkcoin-a60f73d/src/obj -I/usr/local/include -I/usr/local/include/db48 -DUSE_IPV6=1 -I/home/user/porkcoin/work/porkcoin-porkcoin-a60f73d/src/leveldb/include -I/home/user/porkcoin/work/porkcoin-porkcoin-a60f73d/src/leveldb/helpers -DHAVE_BUILD_INFO -fno-stack-protector -fstack-protector-all -Wstack-protector -D_FORTIFY_SOURCE=2 -O2 -pipe -fstack-protector -fno-strict-aliasing -I/usr/local/include -I/usr/local/include/db48 -L/usr/local/lib -L/usr/local/lib/db48 -Wno-invalid-offsetof -fpermissive -MMD -MF obj/cubehash.d -o obj/cubehash.o cubehash.c c++: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
cubehash.c:601:6: error: assigning to 'unsigned char *' from incompatible type 'void *' out = dst; ^ ~~~ cubehash.c:610:2: error: no matching function for call to 'cubehash_init' cubehash_init(cc, IV224); ^~~~~~~~~~~~~ cubehash.c:535:1: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'sph_cubehash_context *' cubehash_init(sph_cubehash_context *sc, const sph_u32 *iv) ^ cubehash.c:617:2: error: no matching function for call to 'cubehash_core' cubehash_core(cc, data, len); ^~~~~~~~~~~~~ cubehash.c:542:1: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'sph_cubehash_context *' cubehash_core(sph_cubehash_context *sc, const void *data, size_t len) ^ cubehash.c:631:2: error: no matching function for call to 'cubehash_close' cubehash_close(cc, ub, n, dst, 7); ^~~~~~~~~~~~~~ cubehash.c:579:1: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'sph_cubehash_context *' cubehash_close(sph_cubehash_context *sc, unsigned ub, unsigned n, ^ cubehash.c:639:2: error: no matching function for call to 'cubehash_init' cubehash_init(cc, IV256); ^~~~~~~~~~~~~ cubehash.c:535:1: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'sph_cubehash_context *' cubehash_init(sph_cubehash_context *sc, const sph_u32 *iv) ^ cubehash.c:646:2: error: no matching function for call to 'cubehash_core' cubehash_core(cc, data, len); ^~~~~~~~~~~~~ cubehash.c:542:1: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'sph_cubehash_context *' cubehash_core(sph_cubehash_context *sc, const void *data, size_t len) ^ cubehash.c:660:2: error: no matching function for call to 'cubehash_close' cubehash_close(cc, ub, n, dst, 8); ^~~~~~~~~~~~~~ cubehash.c:579:1: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'sph_cubehash_context *' cubehash_close(sph_cubehash_context *sc, unsigned ub, unsigned n, ^ cubehash.c:668:2: error: no matching function for call to 'cubehash_init' cubehash_init(cc, IV384); ^~~~~~~~~~~~~ cubehash.c:535:1: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'sph_cubehash_context *' cubehash_init(sph_cubehash_context *sc, const sph_u32 *iv) ^ cubehash.c:675:2: error: no matching function for call to 'cubehash_core' cubehash_core(cc, data, len); ^~~~~~~~~~~~~ cubehash.c:542:1: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'sph_cubehash_context *' cubehash_core(sph_cubehash_context *sc, const void *data, size_t len) ^ cubehash.c:689:2: error: no matching function for call to 'cubehash_close' cubehash_close(cc, ub, n, dst, 12); ^~~~~~~~~~~~~~ cubehash.c:579:1: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'sph_cubehash_context *' cubehash_close(sph_cubehash_context *sc, unsigned ub, unsigned n, ^ cubehash.c:697:2: error: no matching function for call to 'cubehash_init' cubehash_init(cc, IV512); ^~~~~~~~~~~~~ cubehash.c:535:1: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'sph_cubehash_context *' cubehash_init(sph_cubehash_context *sc, const sph_u32 *iv) ^ cubehash.c:704:2: error: no matching function for call to 'cubehash_core' cubehash_core(cc, data, len); ^~~~~~~~~~~~~ cubehash.c:542:1: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'sph_cubehash_context *' cubehash_core(sph_cubehash_context *sc, const void *data, size_t len) ^ cubehash.c:718:2: error: no matching function for call to 'cubehash_close' cubehash_close(cc, ub, n, dst, 16); ^~~~~~~~~~~~~~ cubehash.c:579:1: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'sph_cubehash_context *' cubehash_close(sph_cubehash_context *sc, unsigned ub, unsigned n, ^ 13 errors generated.
|
|
|
|
porkcoin (OP)
|
|
January 06, 2015, 07:44:06 AM |
|
i had fix it.Please clone it again
|
|
|
|
porkcoin (OP)
|
|
January 06, 2015, 07:58:06 AM Last edit: January 08, 2015, 03:22:39 PM by porkcoin |
|
git clone git clone https://github.com/porkcoin/porkcoin.git
install boost [root@iZ25vmpcmckZ xpc]# wget http://nchc.dl.sourceforge.net/project/boost/boost/1.48.0/boost_1_48_0.tar.gz tar -xzvf boost_1_48_0.tar.gz ./bootstrap.sh ./b2
install openssl and build [root@iZ25vmpcmckZ xpc]# wget https://www.openssl.org/source/openssl-1.0.0i.tar.gz tar tar -xzvf openssl-1.0.0i.tar.gz
install db and build [root@iZ25vmpcmckZ xpc]# wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz tar tar -xzvf openssl-1.0.0i.tar.gz
export BDB_INCLUDE_PATH=/usr/local/BerkeleyDB.4.8/include/ export BDB_LIB_PATH=/usr/local/BerkeleyDB.4.8/lib export BOOST_INCLUDE_PATH=/usr/include export BOOST_LIB_PATH=/root/xpc/boost_1_48_0/stage/lib export OPENSSL_LIB_PATH=/root/xpc/openssl-1.0.0i
build cd porkcoin/src make -f makefile.unix USE_UPNP=- ./porkcoind
|
|
|
|
|