Author

Topic: Mincoin difficulty coaster exploit script (Read 2170 times)

member
Activity: 98
Merit: 10
MNC is changing the scheme from "Pump and Dump" to "Crash and Burn."
full member
Activity: 224
Merit: 100
Why are we even discussing mincoin? Check first day block reward and diff and you have to be a lunatic to ever touch that shit. Block reward goes from 100/block to 2/block in 3 days ha ha..  'Developer' (and I am using the term loosely) must have been smoking fucking Meth when he threw that piece of dung out on the forum.

Yeah but look how much meth money he has now by selling his failcoins on noobs?


If you want to giggle for a second, check out this screenshot of the 'mincoin mafia' (such cute kids) bragging about calling me out as a scammer and trying to discredit me on BTC-E:
https://i.imgur.com/UOYpl7B.png

Priceless! Altcoins - It's serious business Smiley
legendary
Activity: 1190
Merit: 1000
www.bitcointrading.com
Why are we even discussing mincoin? Check first day block reward and diff and you have to be a lunatic to ever touch that shit. Block reward goes from 100/block to 2/block in 3 days ha ha..  'Developer' (and I am using the term loosely) must have been smoking fucking Meth when he threw that piece of dung out on the forum.

Yeah but look how much meth money he has now by selling his failcoins on noobs?
full member
Activity: 224
Merit: 100
Why are we even discussing mincoin? Check first day block reward and diff and you have to be a lunatic to ever touch that shit. Block reward goes from 100/block to 2/block in 3 days ha ha..  'Developer' (and I am using the term loosely) must have been smoking fucking Meth when he threw that piece of dung out on the forum.
sr. member
Activity: 261
Merit: 250
Interesting.....
interesting...
full member
Activity: 126
Merit: 100
All Bitcoin chains suffer from this same thing, its just easier to do in Mincoin. It doesn't harm the chain it just means more coins can be released faster over a period if the miner doing it has enough power. As the mining network grows this is more and more difficult to do like tacotime pointed out. Not a big deal at all.
hero member
Activity: 630
Merit: 500
The trash bin.

I checked but all I found there was midget porn. (I delete that regularly).
full member
Activity: 182
Merit: 100
The trash bin.
hero member
Activity: 630
Merit: 500
This is the only thread on the entire forum that contains the word 'mincoind'.

Where does one get a copy of this for Windows? Smiley  Feeling very lame right now.
legendary
Activity: 2270
Merit: 1363
Your Litecoin & Mincoin Code examples read identic to me , is this intended?

Yes, it's a problem with litecoin (and bitcoin) as diff changes are ONLY based upon the retarget period.  However, if your retarget period is long enough it's not a problem -- the shorter the retarget, the more exploitable the chain.  About 5 months ago the problem was bad for litecoin, but now as litecoin is worth much more than bitcoin, chain hopping is discouraged and it's not really a problem.  PPcoin (and now with Sunny King's help, TRC) addressed this by basing retarget on longer moving average periods.

thx, i thought at first mincoin changed something after forking from litecoin and where now susceptible to this attack.
hero member
Activity: 617
Merit: 531
Thanks for that Taco. Very interesting.
legendary
Activity: 1484
Merit: 1005
Your Litecoin & Mincoin Code examples read identic to me , is this intended?

Yes, it's a problem with litecoin (and bitcoin) as diff changes are ONLY based upon the retarget period.  However, if your retarget period is long enough it's not a problem -- the shorter the retarget, the more exploitable the chain.  About 5 months ago the problem was bad for litecoin, but now as litecoin is worth much more than bitcoin, chain hopping is discouraged and it's not really a problem.  PPcoin (and now with Sunny King's help, TRC) addressed this by basing retarget on longer moving average periods.

Was used successfully for TRC here: https://bitcointalksearch.org/topic/terracoin-difficulty-question-157449

Although not by me, I only wrote the script.
legendary
Activity: 2270
Merit: 1363
Whoops, forgot to change a couple of lines, should work now

Not that anyone is mining mincoin anyway

Your Litecoin & Mincoin Code examples read identic to me , is this intended?
legendary
Activity: 1484
Merit: 1005
Whoops, forgot to change a couple of lines, should work now

Not that anyone is mining mincoin anyway
legendary
Activity: 1484
Merit: 1005
Quote from: manface
Considering you were one of the first posters in here complaining about how you couldn't work out how to download the blockchain I doubt you could do much of anything.

Litecoin:
Code:
unsigned int ComputeMinWork(unsigned int nBase, int64 nTime)
{
    // Testnet has min-difficulty blocks
    // after nTargetSpacing*2 time between blocks:
    if (fTestNet && nTime > nTargetSpacing*2)
        return bnProofOfWorkLimit.GetCompact();

    CBigNum bnResult;
    bnResult.SetCompact(nBase);
    while (nTime > 0 && bnResult < bnProofOfWorkLimit)
    {
        // Maximum 400% adjustment...
        bnResult *= 4;
        // ... in best-case exactly 4-times-normal target time
        nTime -= nTargetTimespan*4;
    }
    if (bnResult > bnProofOfWorkLimit)
        bnResult = bnProofOfWorkLimit;
    return bnResult.GetCompact();
}

unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlock *pblock)
{
    unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();

    // Genesis block
    if (pindexLast == NULL)
        return nProofOfWorkLimit;

    // Only change once per interval
    if ((pindexLast->nHeight+1) % nInterval != 0)
    {
        // Special difficulty rule for testnet:
        if (fTestNet)
        {
            // If the new block's timestamp is more than 2* 10 minutes
            // then allow mining of a min-difficulty block.
            if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2)
                return nProofOfWorkLimit;
            else
            {
                // Return the last non-special-min-difficulty-rules-block
                const CBlockIndex* pindex = pindexLast;
                while (pindex->pprev && pindex->nHeight % nInterval != 0 && pindex->nBits == nProofOfWorkLimit)
                    pindex = pindex->pprev;
                return pindex->nBits;
            }
        }

        return pindexLast->nBits;
    }

Mincoin:
Code:
unsigned int ComputeMinWork(unsigned int nBase, int64 nTime)
{
    // Testnet has min-difficulty blocks
    // after nTargetSpacing*2 time between blocks:
    if (fTestNet && nTime > nTargetSpacing*2)
        return bnProofOfWorkLimit.GetCompact();

    CBigNum bnResult;
    bnResult.SetCompact(nBase);
    while (nTime > 0 && bnResult < bnProofOfWorkLimit)
    {
        // Maximum 400% adjustment...
        bnResult *= 4;
        // ... in best-case exactly 4-times-normal target time
        nTime -= nTargetTimespan*4;
    }
    if (bnResult > bnProofOfWorkLimit)
        bnResult = bnProofOfWorkLimit;
    return bnResult.GetCompact();
}

unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlock *pblock)
{
    unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();

    // Genesis block
    if (pindexLast == NULL)
        return nProofOfWorkLimit;

    // Only change once per interval
    if ((pindexLast->nHeight+1) % nInterval != 0)
    {
        // Special difficulty rule for testnet:
        if (fTestNet)
        {
            // If the new block's timestamp is more than 2* 10 minutes
            // then allow mining of a min-difficulty block.
            if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2)
                return nProofOfWorkLimit;
            else
            {
                // Return the last non-special-min-difficulty-rules-block
                const CBlockIndex* pindex = pindexLast;
                while (pindex->pprev && pindex->nHeight % nInterval != 0 && pindex->nBits == nProofOfWorkLimit)
                    pindex = pindex->pprev;
                return pindex->nBits;
            }
        }

        return pindexLast->nBits;
    }

--> Chain is still vulnerable to coaster exploit, in fact even more so because of the faster retarget

Code for exploit (Unix, Python 2.7)
Code:
from subprocess import Popen, PIPE, STDOUT
import time
import json
import math

class Min(object):
    def __init__(self, blocks):
        self.blocks = blocks

scan_time = 5

while(True):
    ### Get the initial block number from mincoind, store in output_j['blocks']
    cmd = './mincoind getinfo' ### Command for dumping info from mincoind in json format; we use this lots
    p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) ### Execute command
    output = p.stdout.read() ### Read the stdout that output gives us
    output_j = json.loads(output) ### Convert from json to python values; we call block number using the class given above
    print("Current block is " + str(output_j['blocks']))

    if (math.floor(output_j['blocks']/720) % 2 == 0): ### During exploit period of 720 blocks, mine MinCoin
        print ("Exploit block, mining mincoin...")

        mincoin_config = open('minmine.conf','r')
        card_config = open('cardconf.conf','r')
        configuration = open('litecoin.conf', 'w')

        ### Copy the reaper configuration to litecoin.conf for mincoin
        for line in mincoin_config:
            configuration.write(line)
        for line in card_config:
            configuration.write(line)

        mincoin_config.close()
        card_config.close()
        configuration.close()

        miner_cmd = './reaper' ### Command for your miner to mine NVC
        miner_thread = Popen(miner_cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)

        ### Loop below checks to see when block we're on, terminates miner if we are on an off number block
        while(True):
            p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
            output = p.stdout.read()
            output_j = json.loads(output)
            if not(math.floor(output_j['blocks']/720) % 2 == 0):
                miner_thread.terminate()
                break
            else:
                print("Block height still in exploit period, mining mincoin.")
                time.sleep(scan_time)

    else: ### Block is not exploit, mine something else
        print ("Non-exploit block, mining another chain...")

        mincoin_config = open('elsemine.conf','r')
        card_config = open('cardconf.conf','r')
        configuration = open('litecoin.conf', 'w')

        ### Copy the reaper configuration to litecoin.conf for other chain
        for line in mincoin_config:
            configuration.write(line)
        for line in card_config:
            configuration.write(line)

        mincoin_config.close()
        card_config.close()
        configuration.close()

        miner_cmd = './reaper' ### Command for your miner to mine something else; the same here because we use reaper
        miner_thread = Popen(miner_cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)

        ### Loop below checks to see when block we're on, terminates miner if we are on an exploit number block
        while(True):
            p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
            output = p.stdout.read()
            output_j = json.loads(output)
            if (math.floor(output_j['blocks']/720) % 2 == 0):
                miner_thread.terminate()
                break
            else:
                print("Block not exploit height, mining another chain.")
                time.sleep(scan_time)

Code for exploit (Windows, Python 2.7)
Code:
from subprocess import Popen, PIPE, STDOUT
import time
import json
import math

class Min(object):
    def __init__(self, blocks):
        self.blocks = blocks

scan_time = 5

while(True):
    ### Get the initial block number from mincoind, store in output_j['blocks']
    cmd = 'mincoind.exe getinfo' ### Command for dumping info from mincoind in json format; we use this lots
    p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) ### Execute command
    output = p.stdout.read() ### Read the stdout that output gives us
    output_j = json.loads(output) ### Convert from json to python values; we call block number using the class given above
    print("Current block is " + str(output_j['blocks']))

    if (math.floor(output_j['blocks']/720) % 2 == 0): ### During exploit period of 720 blocks, mine MinCoin
        print ("Exploit block, mining mincoin...")

        mincoin_config = open('minmine.conf','r')
        card_config = open('cardconf.conf','r')
        configuration = open('litecoin.conf', 'w')

        ### Copy the reaper configuration to litecoin.conf for mincoin
        for line in mincoin_config:
            configuration.write(line)
        for line in card_config:
            configuration.write(line)

        mincoin_config.close()
        card_config.close()
        configuration.close()

        miner_cmd = 'reaper.exe' ### Command for your miner to mine NVC
        miner_thread = Popen(miner_cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)

        ### Loop below checks to see when block we're on, terminates miner if we are on an off number block
        while(True):
            p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
            output = p.stdout.read()
            output_j = json.loads(output)
            if not(math.floor(output_j['blocks']/720) % 2 == 0):
                miner_thread.terminate()
                break
            else:
                print("Block height still in exploit period, mining mincoin.")
                time.sleep(scan_time)

    else: ### Block is not exploit, mine something else
        print ("Non-exploit block, mining another chain...")

        mincoin_config = open('elsemine.conf','r')
        card_config = open('cardconf.conf','r')
        configuration = open('litecoin.conf', 'w')

        ### Copy the reaper configuration to litecoin.conf for other chain
        for line in mincoin_config:
            configuration.write(line)
        for line in card_config:
            configuration.write(line)

        mincoin_config.close()
        card_config.close()
        configuration.close()

        miner_cmd = 'reaper.exe' ### Command for your miner to mine something else; the same here because we use reaper
        miner_thread = Popen(miner_cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)

        ### Loop below checks to see when block we're on, terminates miner if we are on an exploit number block
        while(True):
            p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
            output = p.stdout.read()
            output_j = json.loads(output)
            if (math.floor(output_j['blocks']/720) % 2 == 0):
                miner_thread.terminate()
                break
            else:
                print("Block not exploit height, mining another chain.")
                time.sleep(scan_time)

Requires the following files to exist:
mincoind executable that is running prior to executing the python code above
reaper executable
reaper.conf (configured as per normal)
Requires reaper and mincoind to be in the same directory

minmine.conf:
Code:
host minecoinhost
port ????
user username
pass password
elsemine.conf (mines litecoin or whatever with reaper)
Code:
host litecoinhost
port ????
user username
pass password
cardconf.conf (configuration for scrypt):
Code:

protocol litecoin

worksize 256
vectors 1
aggression 20
threads_per_gpu 1
sharethreads 32
lookup_gap 2
gpu_thread_concurrency ####
Jump to: