Creating a SolidCoin Pool

From SolidCoin Wiki

Jump to: navigation, search

SolidCoin currently uses two RPC calls to receive work and submit work. These are sc_getwork and sc_testwork . sc_getwork returns a 128byte block header which has structure outlined at bottom of page.


Tips

1) Each time sc_getwork is called it determines if it needs to calculate a new merkle hash. If it doesn't it will simply increment nonce2 and update ntime. A merkle hash links your wallet to the block, and is also used internally to match sc_testwork to valid sc_getwork .

2) sc_testwork may return block_valid=true but until this block is confirmed at least 4 times it is possible it may not be included in the block chain. As such do not show your users you have won a block until it has 4 confirmations

3) sc_testwork fills in a transaction id if the block is valid, it will be in block_txid . You can use this to determine if that valid block actually won by calling sc_gettransaction and looking for "confirmations" to be 4 .

The trusted nodes will accept the first valid block sent to them, and it takes anywhere from 1 second to a minute to verify the block. During the time a trusted node is generating its "even" block you may find a valid solution to an odd block and send it out on the network. Even though it's a valid block since the trusted nodes may already have accepted another one you cannot be sure a valid block will win until you have 4 confirmations.

4) The RPC call getblocknumber may return that you have taken a valid odd block yet you are still working on an odd block. This is part of SolidCoin's design to ensure valid odd blocks will get sent to trusted nodes. All SolidCoin clients will keep trying to generate a valid odd block until a trusted node accepts one of them. As such it is possible you may find multiple valid blocks for the same block number, and its possible none of them will be accepted. Do not rely on getblocknumber to determine which block you are actually working on, instead look at the block data returned from sc_getwork to determine the block number.

Power Blocks

Power blocks are just like regular blocks except they are worth double the value. There is a 1 in 30.1 chance of generating a power block, and is based on the last two hashes. sc_testwork returns block_power=true if a valid block is one of these power blocks.

bool Block_IsPowerBlock(const uint256 &trustedhash,const uint256 &userhash)
{
    unsigned char trustedcount=trustedhash.SumOfBytes();
    unsigned char usercount=userhash.SumOfBytes();
    //1 in 16 chance for user, 1 in 2 for trusted, = 1 in 32 total
    if(trustedcount>=128 && usercount>=239) return true;        
    return false;
}

Pool Payout Types

There are 3 main ways to pay out users of your pool....