Open rawnullbyte opened 1 year ago
Yea it would be awesome!
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.
Hi thank you soooo much, finally someone helped me, ty! @aldotoci
No problem, do you have any idea on how to imporve the performance, also where can I dm you @AndrexYT ?
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 ?
This is the structure structure of the implementation
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".
This is the structure structure of the implementation
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 ?
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.
@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
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!