Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it work again! #7

Open
AndrexYT opened this issue Sep 7, 2023 · 9 comments
Open

Make it work again! #7

AndrexYT opened this issue Sep 7, 2023 · 9 comments

Comments

@AndrexYT
Copy link

AndrexYT commented Sep 7, 2023

Hi, can you @Jody7 Make the code work again and tell instructions to add it to rolbox game? I saw you in DuinoCoin chat, and you was making the miner, i want to you helped me with my mining game, and at leaset fixed code, please, i need it for my game!

@TBMbvioo3
Copy link

Yea it would be awesome!

@aldotoci
Copy link

aldotoci commented Mar 25, 2024

If you guys are still interested I can post the working code on my github and explain the implementation, but I do not think it is worth it. After modifing the code a little bit to make the hash go faster without crashing the server. The best I could get is an avarage of 300Hash per second, which is basically not even a dollar per weak.
I do not know why it is not going any faster. It propably has a limitation on the server side.

This is the modified code which basically does the brute force.
`
local hcount = 0
local fcount = 0

while nonce<4294967296 do
	if tick() - pastTime > 10 then
		wait()
		print('hcount', hcount)
		hcount = 0
		pastTime = tick()	
	end
	
	local header = little_endian_bytestr(Version)
		..tobinReverse(PreviousBlock)
		..tobinReverse(MerkleRoot)
		..little_endian_bytestr(Time,Bits,nonce)
	local hash=SHA(SHA(header)):reverse()
	if toDEC(hash)<MineTarget then
		print("FOUND HASH:", hash, "HEADER:", header)
		return hash
	else
		--print("Failed Hash: ", hash, "Nonce: ", nonce)
	end
	hcount = hcount + 1
	fcount = fcount + 1
	nonce= Random(1,4294967296)
end`

If you guys come up with some algorithm that would significantly improve the speed let me know.
if tick() - pastTime > 10 then wait() print('hcount', hcount) hcount = 0 pastTime = tick() end
I added this code because the loop would crash after approx 3000 iterations, since it was exceeding the iteration allowed.
This is a measure by roblox to stop infinite loops.

@AndrexYT
Copy link
Author

Hi thank you soooo much, finally someone helped me, ty! @aldotoci

@aldotoci
Copy link

aldotoci commented Mar 25, 2024

No problem, do you have any idea on how to imporve the performance, also where can I dm you @AndrexYT ?

@Legendary1401
Copy link

No problem, do you have any idea on how to imporve the performance, also where can I dm you @AndrexYT ?

How can I set this up ? Can you give any instructions ?

@aldotoci
Copy link

aldotoci commented Mar 27, 2024

This is the structure structure of the implementation

Screenshot 2024-03-27 204347

Replace the GetLastBlock file code with the one above
`local hs = game:GetService("HttpService")
-- Update the URL to Blockchain.com's API for the latest block
local url = "https://blockchain.info/latestblock"

return function()
local data = hs:GetAsync(url, true)
return hs:JSONDecode(data)
end`

It should work now.
To start hashing, type on the roblox chat: "start".

@Legendary1401
Copy link

This is the structure structure of the implementation

Screenshot 2024-03-27 204347

Replace the GetLastBlock file code with the one above `local hs = game:GetService("HttpService") -- Update the URL to Blockchain.com's API for the latest block local url = "https://blockchain.info/latestblock"

return function() local data = hs:GetAsync(url, true) return hs:JSONDecode(data) end`

It should work now. To start hashing, type on the roblox chat: "start".

Wow thank you also where does the mined coin go ?

@aldotoci
Copy link

If the hash exists it will just print on the terminal, but you can change it and store it into a script file or sth like that, but again this is not fast at all and you will propably need an eternity to mine a coin.

@AndrexYT
Copy link
Author

AndrexYT commented Apr 5, 2024

@aldotoci Hi, i tried your code, i am getting:
19:56:02.629 Merkle Root: 141f09e42fca6e4116d467baf91fbc0025d9de1cd426feff62793e7978300972 - Server - Main:29
19:56:02.763 ServerScriptService.Main:100: attempt to index nil with 'hash' - Server - Main:100
19:56:02.763 Stack Begin - Studio
19:56:02.763 Script 'ServerScriptService.Main', Line 100 - Studio - Main:100
19:56:02.763 Stack End - Studio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants