Skip to content

Instantly share code, notes, and snippets.

@uyjulian
Created March 5, 2014 18:34
Show Gist options
  • Save uyjulian/9373605 to your computer and use it in GitHub Desktop.
Save uyjulian/9373605 to your computer and use it in GitHub Desktop.
--Bitcoin checker wip
local httpService = game:GetService("HttpService");
local currentBitcoin = 0;
local encodedJSONString;
local decodedJSONTable;
local bitcoinAddress = "14fXxRQLPSNamBfR4F49vHFSVApV9a6asL";
local apiAddress = "https://blockchain.info/address/" .. bitcoinAddress .. "?format=json&limit=0";
local BitcoinValue = {
RECIEVED = 0,
UNCHANGED = 1,
SENT = 2
};
local status = BitcoinValue.UNCHANGED;
while true do
wait(60);
encodedJSONString = httpService:GetAsync(apiAddress, true);
decodedJSONTable = httpService:JSONDecode(encodedJSONString);
local tempBitcoin = tonumber(decodedJSONTable["final_balance"]);
if tempBitcoin >= currentBitcoin then
status = BitcoinValue.RECIEVED;
elseif tempBitcoin <= currentBitcoin then
status = BitcoinValue.SENT;
elseif tempBitcoin == currentBitcoin then
status = BitcoinValue.UNCHANGED;
end
currentBitcoin = tempBitcoin;
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment