←  Programs

ComputerCraft | Programmable Computers for Minecraft

»

Krist - Minable currency that works across...

sci4me's Photo sci4me 08 Mar 2015

Can you make it so that when you send a submit request to the server the server responds with either accept or reject based on whether that answer is correct (awards the submitter KST) or not?

Also, I'm not sure if this is true or not but I think there may be cases where the user isn't awarded for their answers. This may just be another user submitting it RIGHT before me but I kind of doubt it... it's happened twice now...

Once with the miner you linked, once with mine...

Great work! Keep it up! Thanks!


EDIT:

this is strange: my miner IS affecting the block chain... it is finishing blocks doing stuff... but I'm not getting rewarded any more? hmm...

EDIT 2:

wtf... my blocks are going to someone else?...

EDIT 3:

Okay, block 0000000356e6 was awarded to kxcvb7jec0 even though I solved it... why?


EDIT 4:

derp, I wasn't resetting the nonce when a new block is found... derpherp
Edited by sci4me, 08 March 2015 - 04:56 AM.
Quote

longbyte1's Photo longbyte1 08 Mar 2015

View Postslow-coder, on 08 March 2015 - 04:10 AM, said:

edit: if that's your best miner, someone should get to developing ;p

Don't worry, this address has already been blacklisted from KristWallet. :) Just make sure to delete the ransomware from the computer, or copy everything important out of it.
Quote

sci4me's Photo sci4me 08 Mar 2015

So I have a problem... sometimes it seems like I am not getting rewarded for my blocks...
I am really confused.

Looking at block 0000000110bb, it says that I got the 50 KST ...
but my miner doesn't. When my miner is on block 0000000110bb it says I have 850 KST and when it goes to block 0000000343a1, it still has 850 KST...

That 850 is coming directly from the server... so... uh... not sure why it's not wanting to work right...

and I'm really confused as to whether it is a problem with my code or yours...


Still looking into it.
Quote

Grim Reaper's Photo Grim Reaper 08 Mar 2015

View Postsci4me, on 08 March 2015 - 05:53 AM, said:

So I have a problem... sometimes it seems like I am not getting rewarded for my blocks...
I am really confused.

Looking at block 0000000110bb, it says that I got the 50 KST ...
but my miner doesn't. When my miner is on block 0000000110bb it says I have 850 KST and when it goes to block 0000000343a1, it still has 850 KST...

That 850 is coming directly from the server... so... uh... not sure why it's not wanting to work right...

and I'm really confused as to whether it is a problem with my code or yours...


Still looking into it.

Depending on the version you have, it may not tell you why the block has changed. It may change because someone else mined the block before you, not necessarily because you mined the block.
Quote

sci4me's Photo sci4me 08 Mar 2015

View PostGrim Reaper, on 08 March 2015 - 07:40 AM, said:

View Postsci4me, on 08 March 2015 - 05:53 AM, said:

So I have a problem... sometimes it seems like I am not getting rewarded for my blocks...
I am really confused.

Looking at block 0000000110bb, it says that I got the 50 KST ...
but my miner doesn't. When my miner is on block 0000000110bb it says I have 850 KST and when it goes to block 0000000343a1, it still has 850 KST...

That 850 is coming directly from the server... so... uh... not sure why it's not wanting to work right...

and I'm really confused as to whether it is a problem with my code or yours...


Still looking into it.

Depending on the version you have, it may not tell you why the block has changed. It may change because someone else mined the block before you, not necessarily because you mined the block.

I just find it kind of tough to believe that someone else mines the block RIGHT BEFORE I get the points for the block I just mined... doesn't that seem a little too coincidental to you?
Quote

rahph's Photo rahph 08 Mar 2015

k75qfs0fih
send me something :)
Quote

Grim Reaper's Photo Grim Reaper 08 Mar 2015

View Postlongbyte1, on 08 March 2015 - 03:33 AM, said:

View PostCrazedProgrammer, on 07 March 2015 - 05:41 PM, said:

Wow. I downloaded the new version of Grim's Krist Miner and now I'm mining with 4.1 MH/s instead of 1.1 MH/s
The recent commits fixed the speed calculation. It was wrong all along. Anyway, I've been trying to port the address generation algorithm to Java but I've been stumped. So far this is my method:
 /** * Generates a Krist v2 address using the original algorithm. * This was direclty ported from the KristWallet source (release 8). * @param key * KristWallet password * @return Krist address */ public static String generateAddress(String key) { ArrayList protein = new ArrayList(); //local protein = {} String stick = subSHA256(subSHA256(key, 64), 64); //local stick = sha256(sha256(key)) int link = 0; String v2 = "k"; //All keys start with 'k'. //Part 1 for (int n = 0; n < 9; n++) { //repeat...until n == 9 protein.add(stick.substring(0, 2)); //if n < 9 then protein[n] = string.sub(stick,0,2) stick = subSHA256(subSHA256(stick, 64), 64); //stick = sha256(sha256(stick)) end } System.out.println(stick); //Part 2 int n = 0; while(n < 9) { link = Integer.parseInt(stick.substring(1 + (2 * n), 2 + (2 * n) + 1), 16) % 9; //link = tonumber( string.sub( stick,1+(2*n),2+(2*n) ),16 ) % 9 if (protein.get(link).length() != 0) { //if string.len(protein[link]) ~= 0 then v2 += Integer.toString(Integer.parseInt(protein.get(link), 16), 36); //v2 = v2 .. hextobase36(tonumber(protein[link],16)) protein.set(link, ""); //protein[link] = '' n++; } else stick = subSHA256(stick, 64); //stick = sha256(stick) } return v2; } //Client code generateAddress(subSHA256("KRISTWALLET" + password, 64) + "-000"); 
I've tried to accomodate for Java's substring/array differences, but Part 2 always ends up generating some longer incorrect addresses for some reason, and I'm stumped. What is 1+(2*n),2+(2*n) ),16 ) % 9 for?

My code might be messy or inefficient, but I've managed to get it to work after mucking around with the wallet:
Spoiler
Quote

Ducky's Photo Ducky 08 Mar 2015

I'm currently mining at 4000000 hashes a second (with Grim's Krist Miner) but I don't seem to be getting very many coins.
After mining for about an hour I only have 50 KST :-(
Quote

Zambonie's Photo Zambonie 08 Mar 2015

So, trying to make a miner, asking Coss for help a little

From looking at other's code and Coss's help, I got this:

Get the latest block from http://65.26.252.225...lastblock
combine that like miner address + block + nonce concatenated
hash with sha256.
then get the contents on the page &quot;http://65.26.252.225/quest/dia/krist/?submitblock&amp;address=myaddressthing&amp;nonce=noncething
Something seems to be missing from here lol..
Someone *cough*@cossacksson*cough* needs to make that guide on the internals of Krist, so that others can understand how stuff works and how to work with it..
Edited by Zambonie, 08 March 2015 - 03:12 PM.
Quote

slow-coder's Photo slow-coder 08 Mar 2015

no offense tho, krist isn't MUCH of a currency. because it's so mass mineable, the worth of one krist goes down immensely for how much krist some people have, i would request over 1million krist for a dirt block..
Quote

Atenefyr's Photo Atenefyr 08 Mar 2015

View Postslow-coder, on 08 March 2015 - 03:00 PM, said:

i would request over 1million krist for a dirt block..
I seriously doubt that, if you look here you can clearly see that it's worth something (at least as of present), but you are right, the worth of 1 krist really isn't too much compared to currencies like Bitcoin.
Edited by Atenefyr, 08 March 2015 - 03:18 PM.
Quote

Yevano's Photo Yevano 08 Mar 2015

View PostZambonie, on 08 March 2015 - 02:53 PM, said:

So, trying to make a miner, asking Coss for help a little

From looking at other's code and Coss's help, I got this:

Get the latest block from http://65.26.252.225...lastblock
combine that like miner address + block + nonce concatenated
hash with sha256.
then get the contents on the page &quot;http://65.26.252.225/quest/dia/krist/?submitblock&amp;address=myaddressthing&amp;nonce=noncething
Something seems to be missing from here lol..
Someone *cough*@cossacksson*cough* needs to make that guide on the internals of Krist, so that others can understand how stuff works and how to work with it..

That's almost it. Here's a bit more detail using pseudocode.

start:
nonce = 0
addr = "ks372l1pfa" // Or some other address
lastBlock = nodeget("lastblock")
addrWithBlock = concat(addr, lastBlock)
while true do
	nonceString = tostring(nonce, 10)
	toHash = concat(addrWBlock, nonceString)
	hashBytes = sha256(toHash)	
	hashString = toLowerBase16(hashBytes)
	subHash = substr(hashString, 12)
	if(lexicographicallyLess(subHash, lastBlock)) {
		nodeget(concat("submitblock&address=ks372l1pfa&nonce=", nonceString))
		goto start
	}
	nonce++
end

nodeget(str) - Get the contents of the page whose url is the concatenation of "65.26.252.225/quest/dia/krist/?" with str.
concat(s1, s2) - Concatenate s1 with s2.
tostring(n, base) - Convert n to a string in some number base.
sha256(str) - Get the SHA-256 hash of str as an array of bytes.
toLowerBase16(bytes) - Convert a byte array to a hex string with lowercase a-f characters.
substr(str, n) - Get the first n characters of a string.
lexicographicallyLess(s1, s2) - Check if s1 is lexicographically less than s2. If s1 and s2 were words in a dictionary, return true if s1 would appear before s2 in that dictionary.

Example:
My address is "k3s72l1pfa"
The last block was "000000018600"
addrWithBlock = "k3s72l1pfa000000018600"
Let's try nonce = 1337
nonceString = "1337"
toHash = "k3s72l1pfa0000000186001337"
hashBytes = some weird garbage looking array of bytes
hashString = "9433d0c8a2a8c982841c46a118c38c9f0cb989d487724c844fd8bbb361ef9baa"
subHash = "9433d0c8a2a8"
Is the hash we found less than the last block?
In other words, is 9433d0c8a2a8 < 000000018600?
No, not even close. Rinse and repeat with another nonce until we find a good one.

This is just based off of what I've learned by looking at Grim's code and working on my own miner. Please let me know if anything is incorrect.
Quote

Atenefyr's Photo Atenefyr 08 Mar 2015

View PostYevano, on 08 March 2015 - 04:22 PM, said:

View PostZambonie, on 08 March 2015 - 02:53 PM, said:

So, trying to make a miner, asking Coss for help a little

From looking at other's code and Coss's help, I got this:

Get the latest block from http://65.26.252.225...lastblock
combine that like miner address + block + nonce concatenated
hash with sha256.
then get the contents on the page &quot;http://65.26.252.225/quest/dia/krist/?submitblock&amp;address=myaddressthing&amp;nonce=noncething
Something seems to be missing from here lol..
Someone *cough*@cossacksson*cough* needs to make that guide on the internals of Krist, so that others can understand how stuff works and how to work with it..

That's almost it. Here's a bit more detail using pseudocode.

start:
nonce = 0
addr = "ks372l1pfa" // Or some other address
lastBlock = nodeget("lastblock")
addrWithBlock = concat(addr, lastBlock)
while true do
	nonceString = tostring(nonce, 10)
	toHash = concat(addrWBlock, nonceString)
	hashBytes = sha256(toHash)	
	hashString = toLowerBase16(hashBytes)
	subHash = substr(hashString, 12)
	if(lexicographicallyLess(subHash, lastBlock)) {
		nodeget(concat("submitblock&address=ks372l1pfa&nonce=", nonceString))
		goto start
	}
	nonce++
end

nodeget(str) - Get the contents of the page whose url is the concatenation of "65.26.252.225/quest/dia/krist/?" with str.
concat(s1, s2) - Concatenate s1 with s2.
tostring(n, base) - Convert n to a string in some number base.
sha256(str) - Get the SHA-256 hash of str as an array of bytes.
toLowerBase16(bytes) - Convert a byte array to a hex string with lowercase a-f characters.
substr(str, n) - Get the first n characters of a string.
lexicographicallyLess(s1, s2) - Check if s1 is lexicographically less than s2. If s1 and s2 were words in a dictionary, return true if s1 would appear before s2 in that dictionary.

Example:
My address is "k3s72l1pfa"
The last block was "000000018600"
addrWithBlock = "k3s72l1pfa000000018600"
Let's try nonce = 1337
nonceString = "1337"
toHash = "k3s72l1pfa0000000186001337"
hashBytes = some weird garbage looking array of bytes
hashString = "9433d0c8a2a8c982841c46a118c38c9f0cb989d487724c844fd8bbb361ef9baa"
subHash = "9433d0c8a2a8"
Is the hash we found less than the last block?
In other words, is 9433d0c8a2a8 < 000000018600?
No, not even close. Rinse and repeat with another nonce until we find a good one.

This is just based off of what I've learned by looking at Grim's code and working on my own miner. Please let me know if anything is incorrect.
I just spent ~1 hour fixing my hash function in KristCMD because of your correction. ouchies.
thanks, though :P

Side note, I made a miner in-game, but it goes at a snails pace (0.000004 MH/s) literally because; it's Minecraft. While loops go super slow.
If anyone has any tips for optimization, feel free to let me know.
Posted Image
Edited by Atenefyr, 08 March 2015 - 07:14 PM.
Quote

Zambonie's Photo Zambonie 08 Mar 2015

View PostYevano, on 08 March 2015 - 04:22 PM, said:

View PostZambonie, on 08 March 2015 - 02:53 PM, said:

So, trying to make a miner, asking Coss for help a little

From looking at other's code and Coss's help, I got this:

Get the latest block from http://65.26.252.225...lastblock
combine that like miner address + block + nonce concatenated
hash with sha256.
then get the contents on the page &quot;http://65.26.252.225/quest/dia/krist/?submitblock&amp;address=myaddressthing&amp;nonce=noncething
Something seems to be missing from here lol..
Someone *cough*@cossacksson*cough* needs to make that guide on the internals of Krist, so that others can understand how stuff works and how to work with it..

That's almost it. Here's a bit more detail using pseudocode.

start:
nonce = 0
addr = "ks372l1pfa" // Or some other address
lastBlock = nodeget("lastblock")
addrWithBlock = concat(addr, lastBlock)
while true do
	nonceString = tostring(nonce, 10)
	toHash = concat(addrWBlock, nonceString)
	hashBytes = sha256(toHash)	
	hashString = toLowerBase16(hashBytes)
	subHash = substr(hashString, 12)
	if(lexicographicallyLess(subHash, lastBlock)) {
		nodeget(concat("submitblock&address=ks372l1pfa&nonce=", nonceString))
		goto start
	}
	nonce++
end

nodeget(str) - Get the contents of the page whose url is the concatenation of "65.26.252.225/quest/dia/krist/?" with str.
concat(s1, s2) - Concatenate s1 with s2.
tostring(n, base) - Convert n to a string in some number base.
sha256(str) - Get the SHA-256 hash of str as an array of bytes.
toLowerBase16(bytes) - Convert a byte array to a hex string with lowercase a-f characters.
substr(str, n) - Get the first n characters of a string.
lexicographicallyLess(s1, s2) - Check if s1 is lexicographically less than s2. If s1 and s2 were words in a dictionary, return true if s1 would appear before s2 in that dictionary.

Example:
My address is "k3s72l1pfa"
The last block was "000000018600"
addrWithBlock = "k3s72l1pfa000000018600"
Let's try nonce = 1337
nonceString = "1337"
toHash = "k3s72l1pfa0000000186001337"
hashBytes = some weird garbage looking array of bytes
hashString = "9433d0c8a2a8c982841c46a118c38c9f0cb989d487724c844fd8bbb361ef9baa"
subHash = "9433d0c8a2a8"
Is the hash we found less than the last block?
In other words, is 9433d0c8a2a8 < 000000018600?
No, not even close. Rinse and repeat with another nonce until we find a good one.

This is just based off of what I've learned by looking at Grim's code and working on my own miner. Please let me know if anything is incorrect.

So according to what you said.. I got this made in C# (syntax is like Java)

String newBlock = Utils.getBlock(); --Calls the Utils class which gets the latest block, works.
		    n = 0; --Resets the nonce everytime the program updates (the file im coding in will repeat itself every frame.) theres really no use since it will auto reset anyway to 1 in the loop. dont ask why I put it here...
		    for (n = 1; n <= 2000; n++) --For Loop. sets n to 1, while n is less then 2000, add n one time every loop. 
		    {
			    hashed = Utils.hashSha256(address + newBlock + n); --Calls the utils class to hash the thing.
			    Console.Out.WriteLine(n); --Writes out n for debuging purposes.
			    //Cut here
			    String hash = hashed.Substring(1, 12); --Splits the hash from 1 to 12.
			    //Check if shorter here.
			    if (String.Compare(newBlock, hash) < 0)              --Im pretty sure this is the way to lexicographicallly compare it.  If its less then one, that means the hash is less. Correct me on this if i'm wrong. Im pretty sure it is, becasue it will return true every single hash....
			    {
				    Console.Out.WriteLine("Sent " + hash + "!");
				    Utils.sendBlock(); --Gets the contents of http://65.26.252.225/quest/dia/krist/?submitblock&address=addresshere&nonce=insetnoncehere, what I saw in Grims code so its what I must do..
			    }
			   
		    }
		    //Console.Out.WriteLine("Hashed: " + hashed);
		    //Utils.sendBlock(hashed);
		    Console.Out.WriteLine(newBlock + " is done.");
		    Console.Out.WriteLine(Utils.getBalance());

Im pretty sure this is right, except the lexi. graphing,

Mind if someone makes sure that this is correct?
Quote

sci4me's Photo sci4me 08 Mar 2015

I have been working on a command line miner written in Java. It is REALLY fast... The highest speed I have seen it get is 6.17 MH/s. This is after a BUTT-TON of optimization of the SHA256 algorithm and some other parts of the miner. The code is written from scratch, but I did reference Grims miner to see what I was doing wrong when it wouldn't work, so some credit goes to him.

Like I said, it's a command line app. I have put the source code on github (there is not a distribution however, you will have to do that yourself if you want it).

https://github.com/sci4me/SKristMiner

It is still WIP. Let me know what you guys think! :)
Quote

Yevano's Photo Yevano 08 Mar 2015

Here's a jar for the lazy. http://yevano.me/shr/SKristMiner.jar
Quote

sci4me's Photo sci4me 08 Mar 2015

View PostYevano, on 08 March 2015 - 09:08 PM, said:

Here's a jar for the lazy. http://yevano.me/shr/SKristMiner.jar

Will soon be outdated :P
Quote

Atenefyr's Photo Atenefyr 08 Mar 2015

View Postsci4me, on 08 March 2015 - 08:18 PM, said:

I have been working on a command line miner written in Java. It is REALLY fast... The highest speed I have seen it get is 6.17 MH/s. This is after a BUTT-TON of optimization of the SHA256 algorithm and some other parts of the miner. The code is written from scratch, but I did reference Grims miner to see what I was doing wrong when it wouldn't work, so some credit goes to him.

Like I said, it's a command line app. I have put the source code on github (there is not a distribution however, you will have to do that yourself if you want it).

https://github.com/sci4me/SKristMiner

It is still WIP. Let me know what you guys think! :)
I'll be sure to check it out :)
EDIT: Just tested it, eats way too much CPU, and at 2 threads I only have ~1.52 MH/s (the speed of 2 cores on GKM, but the CPU of 3 cores on GKM), and 2 threads on yours takes as much CPU as 3 cores on GKM. It looks like an OK miner, but for my specs it really doesn't work that well.

View PostZambonie, on 08 March 2015 - 08:05 PM, said:

View PostYevano, on 08 March 2015 - 04:22 PM, said:

View PostZambonie, on 08 March 2015 - 02:53 PM, said:

So, trying to make a miner, asking Coss for help a little

From looking at other's code and Coss's help, I got this:

Get the latest block from http://65.26.252.225...lastblock
combine that like miner address + block + nonce concatenated
hash with sha256.
then get the contents on the page &quot;http://65.26.252.225/quest/dia/krist/?submitblock&amp;address=myaddressthing&amp;nonce=noncething
Something seems to be missing from here lol..
Someone *cough*@cossacksson*cough* needs to make that guide on the internals of Krist, so that others can understand how stuff works and how to work with it..

That's almost it. Here's a bit more detail using pseudocode.

start:
nonce = 0
addr = "ks372l1pfa" // Or some other address
lastBlock = nodeget("lastblock")
addrWithBlock = concat(addr, lastBlock)
while true do
	nonceString = tostring(nonce, 10)
	toHash = concat(addrWBlock, nonceString)
	hashBytes = sha256(toHash)	
	hashString = toLowerBase16(hashBytes)
	subHash = substr(hashString, 12)
	if(lexicographicallyLess(subHash, lastBlock)) {
		nodeget(concat("submitblock&address=ks372l1pfa&nonce=", nonceString))
		goto start
	}
	nonce++
end

nodeget(str) - Get the contents of the page whose url is the concatenation of "65.26.252.225/quest/dia/krist/?" with str.
concat(s1, s2) - Concatenate s1 with s2.
tostring(n, base) - Convert n to a string in some number base.
sha256(str) - Get the SHA-256 hash of str as an array of bytes.
toLowerBase16(bytes) - Convert a byte array to a hex string with lowercase a-f characters.
substr(str, n) - Get the first n characters of a string.
lexicographicallyLess(s1, s2) - Check if s1 is lexicographically less than s2. If s1 and s2 were words in a dictionary, return true if s1 would appear before s2 in that dictionary.

Example:
My address is "k3s72l1pfa"
The last block was "000000018600"
addrWithBlock = "k3s72l1pfa000000018600"
Let's try nonce = 1337
nonceString = "1337"
toHash = "k3s72l1pfa0000000186001337"
hashBytes = some weird garbage looking array of bytes
hashString = "9433d0c8a2a8c982841c46a118c38c9f0cb989d487724c844fd8bbb361ef9baa"
subHash = "9433d0c8a2a8"
Is the hash we found less than the last block?
In other words, is 9433d0c8a2a8 < 000000018600?
No, not even close. Rinse and repeat with another nonce until we find a good one.

This is just based off of what I've learned by looking at Grim's code and working on my own miner. Please let me know if anything is incorrect.

So according to what you said.. I got this made in C# (syntax is like Java)

String newBlock = Utils.getBlock(); --Calls the Utils class which gets the latest block, works.
			n = 0; --Resets the nonce everytime the program updates (the file im coding in will repeat itself every frame.) theres really no use since it will auto reset anyway to 1 in the loop. dont ask why I put it here...
			for (n = 1; n <= 2000; n++) --For Loop. sets n to 1, while n is less then 2000, add n one time every loop.
			{
				hashed = Utils.hashSha256(address + newBlock + n); --Calls the utils class to hash the thing.
				Console.Out.WriteLine(n); --Writes out n for debuging purposes.
				//Cut here
				String hash = hashed.Substring(1, 12); --Splits the hash from 1 to 12.
				//Check if shorter here.
				if (String.Compare(newBlock, hash) < 0)			  --Im pretty sure this is the way to lexicographicallly compare it.  If its less then one, that means the hash is less. Correct me on this if i'm wrong. Im pretty sure it is, becasue it will return true every single hash....
				{
					Console.Out.WriteLine("Sent " + hash + "!");
					Utils.sendBlock(); --Gets the contents of http://65.26.252.225/quest/dia/krist/?submitblock&address=addresshere&nonce=insetnoncehere, what I saw in Grims code so its what I must do..
				}
			  
			}
			//Console.Out.WriteLine("Hashed: " + hashed);
			//Utils.sendBlock(hashed);
			Console.Out.WriteLine(newBlock + " is done.");
			Console.Out.WriteLine(Utils.getBalance());

Im pretty sure this is right, except the lexi. graphing,

Mind if someone makes sure that this is correct?
you need to turn the sha into hex (base 16) before you trim it
Edited by Atenefyr, 08 March 2015 - 10:48 PM.
Quote

sci4me's Photo sci4me 08 Mar 2015

View PostAtenefyr, on 08 March 2015 - 10:15 PM, said:

EDIT: Just tested it, eats way too much CPU, and at 2 threads I only have ~1.52 MH/s (the speed of 2 cores on GKM, but the CPU of 3 cores on GKM), and 2 threads on yours takes as much CPU as 3 cores on GKM. It looks like an OK miner, but for my specs it really doesn't work that well.

Expecting good hash rates without dedicating much processing power is kind of strange...
Edited by sci4me, 08 March 2015 - 11:02 PM.
Quote

Yevano's Photo Yevano 08 Mar 2015

As a side-note to my method of obtaining block solutions, I suspect the nonces you select can actually be any string, not just base-10 numbers.
Quote