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?

1 Answer 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.)

  • 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... Commented May 9, 2013 at 3: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. Commented May 9, 2013 at 5:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.