>> (p.1)
    Author Topic: Pooled/Remote Mining - Open Source - Updated 2010-12-24  (Read 59132 times)
    puddinpop (OP)
    Member
    **
    Offline Offline

    Activity: 103
    Merit: 17


    View Profile
    October 13, 2010, 11:27:32 PM
    Last edit: January 22, 2011, 05:49:50 PM by puddinpop
    Merited by OgNasty (5)
     #1

    Due to the small likelihood that an individual CPU miner will find a block in a reasonable amount of time, and the expectation from new users to see results quickly, I have developed a server/client for bitcoin that will allow many individual miners to cooperate on solving blocks.  This will effectively aggregate their hashing speed, allow solving blocks faster than individually possible, and distribute the generated bitcoins weighted by the contributing node's hash rate.  This can also be used by an individual who doesn't want to run the full bitcoin client on a computer, but would still like to generate blocks with it.

    Here is a basic overview of how it currently works.  Someone runs bitcoin as a server, with optional connection password, to accept connections from remote clients.  The server creates a unique block per client, keeps it in memory, and sends it to the client to hash.  The client then hashes the block, appends the first byte of the generated hash to a buffer, and creates a metahash of the buffer when it is full and sends it to the server for later verification.  The client increases the nonce of the block after every hash, but does not modify the block timestamp.  The server will periodically send new blocks for the client to hash, either every 2 minutes, or when the client requests a new block because the nonce is close to overflowing.  Every 10 seconds, the server picks a client with the oldest verified metahashes and verifies the last metahash from that client.  The server will also send status updates to every client every 10 seconds.

    Currently there are absolutely no built-in negative consequences for a client sending erroneous data, other than being disconnected for sending malformed packets.  The debug log will contain information about misbehaving nodes though.  However, at this early stage in development, it might be bugs causing the issues rather than malicious clients, so this should be taken into consideration.

    Some things to consider:
    • The generated coins are distributed either based on the contributing client's khash/s divided by all nodes khash/s, or by each clients total hashes contributed divided by all hashes contributed.  This means the generated coins will have precision all the way down to the smallest decimal place bitcoin allows.  Because of rounding issues inherit with floating point operations, the server will accrue all left over fractional coins, which almost always be a single digit number at the smallest decimal position.
    • Because of the metahashing and network activity, the miners will not be as fast as miners strictly dedicated to block hashing.
    • The generated blocks may hit the maximum block size if enough clients are connected.  I haven't looked into this deeply to see what the limit is, but just know that it could be possible to reach this limit.
    • The supplied remote clients are simple proof of concepts.  A client may be created in any language that is capable of handling socket connections and using json, and use any means of generating blocks available to it, such as GPU.
    • The bitcoin binary may have issues displaying and/or using coins generated that are less than 0.01 BTC.  I'm assuming they won't display in the client at all.  I haven't thoroughly tested this.
    • It is possible that the server will need lots of bandwidth if many clients are connected

    bitcoin server command line options
    • -remoteserver           Turns on remote server
    • -remotebindaddr=x.x.x.x Bind server to specific adapter.  The default is 127.0.0.1.  Note that this will only accept connections from the local computer.
    • -remotebindport=xxxxx   Bind server to specific port.  The default is 8335.
    • -remotepassword=xxxxx   Set a password to access the server.  The default is a blank password.
    • -distributiontype=connected|contributed    Sets method used to distribute bitcoins.  "connected" will distribute coins only to those clients that were connected when the block being solved was created.  The distribution is based on each connected clients calculated hash rate against the total hash rate at the time a new block is created.  "contributed" will accrue all hashes sent to the server for a given address since the last generated block.  A client may freely disconnect and reconnect and will continue accumulating hashes to whatever address the client specified.  The distribution of coins with this method is based on the hashes accrued by each address against the total hashes accured by everyone.  The server will save the values when it shuts down and load them back up on startup.
    • -resethashescontributed    Resets the count of hashes contributed from each address.

    client command line options
    • -server=x.x.x.x        The address of the server to connect to.  The default is 127.0.0.1.
    • -port=xxxxx            The port of the server.  The default is 8335.
    • -password=xxxxx        The password to use when connecting to the server.  The default is a blank password.
    • -address=xxxxxxx       The bitcoin address you want generated coins sent to.  The default is blank.  A blank address will make the client's share of generated coins be kept by the server.
    • -threads=x                Start this number of miner threads.  The default value is the number of cores on your processor if using the CPU miner, or 1 if using a GPU miner.

    There is one issue I haven't been able to resolve.  The hashing functions seem broken in release builds in Microsoft Visual Studio.  In particular, the midstate buffer contains a bogus midstate when sending to the client.  I have checked for buffer issues, and initialization issues, but I can see none.  Upon placing error checking code and logging AFTER the hashing takes place, the results come out correct.  Removing the checking code causes the issue to reappear and the midstate to be erroneous.  Go figure.  Anyway debug builds do not exhibit this issue.  There probably is a bug somewhere, so maybe someone else can spot it.

    Downloads (Updated 2010-12-24)
    Pooled Miner Server/Client source based on SVN 205
    Windows Binaries

    See the following thread for details on connecting the miner to a server run by doublec
    Join a pooled bitcoin mining effort

Page 1
Viewing Page: 1