1

I'm trying to learn how litecoins work (and learn new programming language at same time by writing a crappy little miner).

I'm stuck with getdata. Here http://litecoin.info/wiki/Scrypt it says that data is 160 characters long. But its not. Its quite a bit longer than that.

So my questions are:

  • 1.) What is nonce and how do I use it?
  • 2.) What is bits?
  • 3.) What are all the 0's after the bits.

EDIT: Ok, I think I have to use just first 160 characters of data and ignore the rest. Correct?

Murch
  • 75,206
  • 34
  • 186
  • 622

1 Answers1

1

A nonce is just a value that you keep changing in the hope that after you hash all the data the hash will be less than the target value. See https://en.bitcoin.it/wiki/Block_hashing_algorithm (litecoin is similar only uses scrypt instead of sha256 hash function.)

nanotube
  • 2,260
  • 14
  • 13
  • 1
    It's also worth noting that nonce is a general term in cryptography, referring to any number or bit string used only once. The word "nonce" is still in use outside the U.S. as a simple English word meaning "time being." Of course in certain parts of the world it's also slang for a pedophile, so maybe it's better if we leave etymology out of this one... – David Perry May 09 '13 at 03:26
  • Okay, so when I try to resolve a block, I use first 160 hex chars from data in getdata and than have worker try to resolve it doing scrypt hashing of it. So my nonce starts with 1 and goes up by one till I rich the value specified in bits? I hash little endian version of previous block hash+merkleroot+timestamp+nonce? Correct me if Im wrong, Im just trying to figure out how this works. – if __name__ is None May 09 '13 at 05:31