Bitcoin Forum

Bitcoin => Project Development => Topic started by: sinisterchipmunk on August 29, 2011, 09:27:24 PM



Title: Bitcoin Mining Pool Developer's Reference
Post by: sinisterchipmunk on August 29, 2011, 09:27:24 PM
I've been working on a new mining pool, written in Ruby. Yesterday, it passed its first major milestone: with 2 miners connected, the pool's first block was minted on testnet. This proved that the pool knew the difference between good blocks and bad, and what to do with the data.

I'm not yet ready for a live test, but am hoping to recruit some beta testers at some point in the not-too-distant future to run the pool in the Real World.

For now, there's lots more to be implemented. The software in its current state is a basic, no-frills pool. Now that it's demonstrated at least the minimum expected capabilities of a pool (that is, turning shares into blocks and appropriately converting both into credits), I'm ready to start implementing more advanced capabilities such as long polling.

After digging deep into the wiki and forums for an ungodly number of hours, I realized I had to dump everything I've learned about Bitcoin development (at least, from a mining pool's perspective) somewhere. Besides helping me remember what I was thinking when I have to maintain the code 6 months from now, it's my hope that my brain-dump will be helpful to other developers out there. It's nothing new, it just takes everything I've discovered (through trial and error, reading raw data dumps, crawling the Wiki and scouring the forums) and puts it all in one place.

So without rambling on too much more, here're the links to both:

  • the project itself, which I've dubbed Bitpool: http://github.com/sinisterchipmunk/bitpool
  • my information dump, which I've decided to make use of Bitpool's wiki for: https://github.com/sinisterchipmunk/bitpool/wiki/Bitcoin-Mining-Pool-Developer%27s-Reference. (I wasn't sure whether this belonged in the official Bitcoin wiki, so I figured I'd let someone else make that call.)

In addition to hopefully being of some help to someone out there, I'd also really appreciate anyone correcting me where I've got my facts wrong and/or pointing out where I need to elaborate. The existing documentation is woefully sparse, and as someone with fairly little Bitcoin experience, I've had to do a moderate amount of guesswork.


Title: Re: Bitcoin Mining Pool Developer's Reference
Post by: willphase on August 29, 2011, 09:47:09 PM
Nice guide. The getwork completion response error value isn't always null - it can contain a json array consisting of e.g.

"error": {
  "code": int,
  "message": string
}

Not sure what miners do with this though, probably throw it away.

Will


Title: Re: Bitcoin Mining Pool Developer's Reference
Post by: sinisterchipmunk on August 29, 2011, 10:10:20 PM
Thanks!

--and nice catch! I completely overlooked error handling. I've now added a section to the guide.