Bitcoin Forum
July 16, 2024, 06:53:39 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Alternate cryptocurrencies / Mining (Altcoins) / Re: primecoin- deciphering the block to get the origin on: January 14, 2014, 10:39:36 AM
I sent a PM yesterday, but now I can reply for the public:

Here is the Go source to compute Header hash:

Code:
type BlockHeader struct {
   // Standard Bitcoin fields.
   Version        uint32
   HashPrevBlock  []byte
   HashMerkleRoot []byte
   Timestamp      uint32
   Bits           uint32
   Nonce          uint32
}

// HeaderHash calculates the block header hash.
// This is the fixed multiplier when searching for primes.
// NOTE: When converting to an Int the hash must be reversed.
func (bh *BlockHeader) HeaderHash() []byte {
   hash := sha256.New()
   binary.Write(hash, binary.LittleEndian, bh.Version)
   hash.Write(bh.HashPrevBlock)
   hash.Write(bh.HashMerkleRoot)
   binary.Write(hash, binary.LittleEndian, bh.Timestamp)
   binary.Write(hash, binary.LittleEndian, bh.Bits)
   binary.Write(hash, binary.LittleEndian, bh.Nonce)

   data := sha256.Sum256(hash.Sum(nil))
   return data[:]
}

Get the values of the fields from the block:
http://primecoin.21stcenturymoneytalk.org/index.php?block_hash=963d17ba4dc753138078a2f56afb3af9674e2546822badff26837db9a0152106

To get an integer from the hash you need to do:

Code:
// hashToBig converts a hash number to an integer
func hashToBig(hash []byte) *big.Int {
   tmp := make([]byte, len(hash))
   copy(tmp, hash)
   reverse(tmp)
   return new(big.Int).SetBytes(tmp)
}


Hope it helps, I can give more examples if still unclear when I have time.
2  Alternate cryptocurrencies / Mining (Altcoins) / What is the XPT protocol? on: January 13, 2014, 04:09:02 PM
First, hi all! I recently joined this forum and I'm interested in crytocurrencies more from a technical point of view rather than hopping to get rich.

I'm currently writing my own primecoin poolminer and I'd like to know what is the XPT (x.pushthrough) protocol that is used by some mining pools (e.g. ypool.net, primecoin). I have googled but could not find any reference to the details of XPT. What is the protocol to be able to write a basic client?
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!