It was the Bitcointalk forum that inspired us to create Bitcointalksearch.org - Bitcointalk is an excellent site that should be the default page for anybody dealing in cryptocurrency, since it is a virtual gold-mine of data. However, our experience and user feedback led us create our site; Bitcointalk's search is slow, and difficult to get the results you need, because you need to log in first to find anything useful - furthermore, there are rate limiters for their search functionality.
The aim of our project is to create a faster website that yields more results and faster without having to create an account and eliminate the need to log in - your personal data, therefore, will never be in jeopardy since we are not asking for any of your data and you don't need to provide them to use our site with all of its capabilities.
We created this website with the sole purpose of users being able to search quickly and efficiently in the field of cryptocurrency so they will have access to the latest and most accurate information and thereby assisting the crypto-community at large.
function bitcoin_fun_create_raw_transaction(inputs, outputs)
-- Because Lua dictionaries cannot have a predefined order we must
-- construct this request manually.
local outputlist = "{";
local k, v;
local mapping = {};
local order = {};
local index;
local index_hex;
local hex;
local salt = "MPGdJA7KX9TwBB7i";
for i=1, #outputs do
k, v = next(outputs[i], nil);
index_hex = hash_SHA256(i..salt, false);
index_hex = string.sub(index_hex, 1, 40);
index = string.fromhex(index_hex);
index = Bitcoin.stringToAddress(index);
hex = Bitcoin.addressToString(k);
hex = string.tohex(hex);
mapping[index_hex] = hex;
table.insert(order, index_hex);
--log("mapping["..index_hex.."] = "..hex);
outputlist = outputlist..'"'..index..'": '..v;
if (i < #outputs) then
outputlist = outputlist .. ", ";
end;
end;
outputlist = outputlist .. "}";
local inputlist = JSON:encode(inputs);
local request = '{\n'..
' "id": 1, \n'..
' "jsonrpc": "2.0", \n'..
' "method": "createrawtransaction", \n'..
' "params": [ '..inputlist..', '..outputlist..' ]\n'..
'}';
--warn(request);
response = url_post("http://"..bitcoin.rpc_user..":"
..bitcoin.rpc_password.."@"
..bitcoin.rpc_ip..":"
..bitcoin.rpc_port.."/", request);
--warn(response);
if (response ~= nil) then
local t = JSON:decode(response);
if (t ~= nil and type(t) == "table") then
if (type(t.error) == "table" and type(t.error.message) == "string" ) then
log("Bitcoin createrawtransaction: "..t.error.message);
else
local k,v;
local s = 1;
local e;
local bad = nil;
-- Replace indexes with real output hex representations that may
-- contain duplicates.
for i=1, #order do
k = order[i];
v = mapping[k];
s, e = string.find(t.result, k, s, true);
if (s ~= nil and e ~= nil) then
t.result = t.result:sub(1, s-1) .. v .. t.result:sub(e+1);
s = e + 1;
else
bad = k;
end;
end;
--warn(t.result);
if (bad ~= nil) then
warn("Index hex "..bad.." not found from raw transaction.");
return nil;
end;
end;
return t.result;
end;
end;
return nil;
end;
return;