Refactoring, new translations, cleaning up warnings.

Refactored to standard Maven layout:
src/main/java
src/main/resources
src/test/java
etc.

New translation code that uses locale-specific ResourceBundles
to load translations on demand.

Reworked API error/exceptions code to a shorter, simpler
@ApiErrors annotation. Processing of @ApiErrors annotations
produces an example for each possible API error and includes
API error string in HTTP response code, e.g.
400 INVALID_SIGNATURE
Missing API error cases added to each API call.

Translation of openAPI.json removed (for now).

block-explorer.html and BIP39 wordlists now read as resources
instead of direct from disk.

Java compile warnings fixed.
Some runtime warnings remain:

WARNING: A provider api.resource.ApiDefinition registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime.
WARNING: A provider api.resource.AnnotationPostProcessor registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime.
WARN org.reflections.Reflections - given scan urls are empty. set urls in the configuration
This commit is contained in:
catbref
2018-12-21 11:14:16 +00:00
parent aab6b69da1
commit c4ed4b378c
284 changed files with 835 additions and 2781 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,776 @@
<!DOCTYPE html>
<html>
<head>
<title>Block Explorer</title>
<style>
body { color: #404040; font-family: sans-serif; }
table { width: 100%; border-collapse: collapse; border: 1px solid #dddddd; margin-bottom: 40px; }
tr:nth-child(odd) { background-color: #eeeeee; }
th { background-color: #eeeeee; }
td { text-align: center; }
.sig { font-size: 60%; color: #405906; }
.ref { font-size: 60%; color: #609040; }
</style>
<script>
// USEFUL CODE STARTS HERE
function publicKeyToAddress(publicKey) {
var ADDRESS_VERSION = 58; // For normal user accounts starting with "Q"
// var ADDRESS_VERSION = 23; // For Automated Transaction accounts starting with "A"
var publicKeyHashSHA256 = SHA256.digest(publicKey);
var ripemd160 = new RIPEMD160(); // 'Grandfathered' broken implementation of MD160
var publicKeyHash = ripemd160.digest(publicKeyHashSHA256);
var addressArray = new Uint8Array();
addressArray = appendBuffer(addressArray, [ADDRESS_VERSION]);
addressArray = appendBuffer(addressArray, publicKeyHash);
var checkSum = SHA256.digest(SHA256.digest(addressArray));
addressArray = appendBuffer(addressArray, checkSum.subarray(0, 4));
return Base58.encode(addressArray);
}
function renderAddressTransactions(e) {
var transactions = e.target.response;
var address = this.responseURL.split("/")[5];
if (transactions.length == 0) {
document.body.innerHTML += 'No transactions involving address';
return;
}
var html = '<table id="transactions"><tr><th>Type</th><th>Timestamp</th><th>Creator</th><th>Fee</th><th>Signature</th><th>Reference</th></tr>';
for (var i=0; i<transactions.length; ++i) {
var tx = transactions[i];
var txTimestamp = new Date(tx.timestamp).toUTCString();
var row = '<tr><td>' + tx.type + '</td>' +
'<td>' + txTimestamp + '</td>' +
'<td class="addr">' + addressAsLink(tx.creatorAddress) + '</td>' +
'<td>' + tx.fee + ' QORA</td>' +
'<td class="sig">' + tx.signature + '</td>' +
'<td class="ref">' + tx.reference + '</td></tr>';
html += row;
}
html += '</table>';
document.body.innerHTML += html;
}
function renderAddressInfo(e) {
var balances = e.target.response;
var address = this.responseURL.split("/")[5];
var html = '<h1>Address ' + address + '</h1>';
html += '<table><tr><th>Asset ID</th><th>Balance</th></tr>';
for (var i=0; i<balances.length; ++i) {
var balanceInfo = balances[i];
html += '<tr><td>' + balanceInfo.assetId + '</td><td>' + balanceInfo.balance + '</td></tr>';
}
html += '</table>';
document.body.innerHTML = html;
XHR({
url: "/transactions/search?address=" + address,
onload: renderAddressTransactions,
responseType: "json"
});
}
function fetchAddressInfo(address) {
XHR({
url: "/addresses/assets/" + address,
onload: renderAddressInfo,
responseType: "json"
});
}
function addressAsLink(address) {
return '<a href="#" onclick="fetchAddressInfo(' + "'" + address + "'" + ')">' + address + '</a>';
}
function renderBlockTransactions(e) {
var transactions = e.target.response;
if (transactions.length == 0) {
document.body.innerHTML += 'No transactions in block';
return;
}
var html = '<table id="transactions"><tr><th>Type</th><th>Timestamp</th><th>Creator</th><th>Fee</th><th>Signature</th><th>Reference</th></tr>';
for (var i=0; i<transactions.length; ++i) {
var tx = transactions[i];
var txTimestamp = new Date(tx.timestamp).toUTCString();
var row = '<tr><td>' + tx.type + '</td>' +
'<td>' + txTimestamp + '</td>' +
'<td class="addr">' + addressAsLink(tx.creatorAddress) + '</td>' +
'<td>' + tx.fee + ' QORA</td>' +
'<td class="sig">' + tx.signature + '</td>' +
'<td class="ref">' + tx.reference + '</td></tr>';
html += row;
}
html += '</table>';
document.body.innerHTML += html;
}
function renderBlockInfo(e) {
var blockData = e.target.response.block;
var html = '<h1>Block ' + blockData.height + '</h1>';
html += '<table id="block"><tr><th>Property</th><th>Value</th></tr>';
for (var p in blockData) {
html += '<tr><td>' + p + '</td>';
if (p.indexOf("ignature") != -1) {
html += '<td class="sig">';
} else if (p.indexOf("eference") != -1) {
html += '<td class="ref">';
} else {
html += '<td>';
}
if (p == "generatorAddress") {
html += addressAsLink(blockData[p]);
} else {
html += blockData[p];
}
if (p.indexOf("ees") != -1)
html += " QORA";
html += '</td></tr>';
}
html += '</table>';
document.body.innerHTML = html;
// Fetch block's transactions
XHR({
url: "/transactions/block/" + blockData.signature,
onload: renderBlockTransactions,
responseType: "json"
});
}
function fetchBlockInfo(height) {
XHR({
url: "/blocks/byheight/" + height,
onload: renderBlockInfo,
responseType: "json"
});
}
function listBlock(e) {
var blockData = e.target.response.block;
var ourHeight = blockData.height;
var blockTimestamp = new Date(blockData.timestamp).toUTCString();
var ourRow = document.createElement('TR');
ourRow.innerHTML = '<td><a href="#" onclick="fetchBlockInfo(' + ourHeight + ')">' + ourHeight + '</a></td>' +
'<td>' + blockTimestamp + '</td>' +
'<td class="addr">' + addressAsLink(blockData.generatorAddress) + '</td>' +
'<td>' + blockData.generatingBalance + '</td>' +
'<td>' + blockData.transactionCount + '</td>' +
'<td>' + blockData.totalFees + ' QORA</td>';
var table = document.getElementById('blocks');
var rows = table.getElementsByTagName('TR');
for (var r = 1; r < rows.length; ++r)
if (ourHeight > rows[r].cells[0].innerText) {
table.insertBefore(ourRow, rows[r]);
return;
}
table.appendChild(ourRow);
}
function showShutdown() {
document.body.innerHTML = '<h1>Shutdown</h1>';
}
function shutdownAPI() {
XHR({
url: "/admin/stop",
onload: showShutdown,
responseType: "json"
});
}
function listBlocksFrom(height) {
document.body.innerHTML = '<h1>Blocks</h1>';
document.body.innerHTML += '<table id="blocks"><tr><th>Height</th><th>Time</th><th>Generator</th><th>Gen.Balance</th><th>TX</th><th>Fees</th></tr></table>';
if (height > 20)
document.body.innerHTML += '<a href="#" onclick="listBlocksFrom(' + (height - 20) + ')">Previous blocks...</a>';
document.body.innerHTML += '<p><a href="#" onclick="fetchBlockInfo(356928)">Block with lots of transactions</a>';
document.body.innerHTML += '<p><a href="#" onclick="shutdownAPI()">Shutdown</a>';
for (var h = height; h > 0 && h >= height - 20; --h)
XHR({
url: "/blocks/byheight/" + h,
onload: listBlock,
responseType: "json"
});
return false;
}
function initialBlocks(e) {
var height = e.target.response;
console.log("initial block height: " + height);
listBlocksFrom(height);
}
function windowOnLoad() {
XHR({
url: "/blocks/height",
onload: initialBlocks,
responseType: "json"
});
}
window.addEventListener('load', windowOnLoad, false);
// UTILITY FUNCTIONS BELOW (Base64, Base58, SHA256, etc.)
function base64ToArray(base64) {
var raw = window.atob(base64);
var rawLength = raw.length;
var array = new Uint8Array(new ArrayBuffer(rawLength));
for(i = 0; i < rawLength; i++) {
array[i] = raw.charCodeAt(i);
}
return array;
}
function appendBuffer (buffer1, buffer2) {
buffer1 = new Uint8Array(buffer1);
buffer2 = new Uint8Array(buffer2);
var tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength);
tmp.set(buffer1, 0);
tmp.set(buffer2, buffer1.byteLength);
return tmp;
}
// BASE58
(function() {
var ALPHABET, ALPHABET_MAP, Base58, i;
Base58 = (typeof module !== "undefined" && module !== null ? module.exports : void 0) || (window.Base58 = {});
ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
ALPHABET_MAP = {};
i = 0;
while (i < ALPHABET.length) {
ALPHABET_MAP[ALPHABET.charAt(i)] = i;
i++;
}
Base58.encode = function(buffer) {
var carry, digits, j;
if (buffer.length === 0) {
return "";
}
i = void 0;
j = void 0;
digits = [0];
i = 0;
while (i < buffer.length) {
j = 0;
while (j < digits.length) {
digits[j] <<= 8;
j++;
}
digits[0] += buffer[i];
carry = 0;
j = 0;
while (j < digits.length) {
digits[j] += carry;
carry = (digits[j] / 58) | 0;
digits[j] %= 58;
++j;
}
while (carry) {
digits.push(carry % 58);
carry = (carry / 58) | 0;
}
i++;
}
i = 0;
while (buffer[i] === 0 && i < buffer.length - 1) {
digits.push(0);
i++;
}
return digits.reverse().map(function(digit) {
return ALPHABET[digit];
}).join("");
};
Base58.decode = function(string) {
var bytes, c, carry, j;
if (string.length === 0) {
return new (typeof Uint8Array !== "undefined" && Uint8Array !== null ? Uint8Array : Buffer)(0);
}
i = void 0;
j = void 0;
bytes = [0];
i = 0;
while (i < string.length) {
c = string[i];
if (!(c in ALPHABET_MAP)) {
throw "Base58.decode received unacceptable input. Character '" + c + "' is not in the Base58 alphabet.";
}
j = 0;
while (j < bytes.length) {
bytes[j] *= 58;
j++;
}
bytes[0] += ALPHABET_MAP[c];
carry = 0;
j = 0;
while (j < bytes.length) {
bytes[j] += carry;
carry = bytes[j] >> 8;
bytes[j] &= 0xff;
++j;
}
while (carry) {
bytes.push(carry & 0xff);
carry >>= 8;
}
i++;
}
i = 0;
while (string[i] === "1" && i < string.length - 1) {
bytes.push(0);
i++;
}
return new (typeof Uint8Array !== "undefined" && Uint8Array !== null ? Uint8Array : Buffer)(bytes.reverse());
};
}).call(this);
// SHA256
SHA256 = {};
SHA256.K = [
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b,
0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01,
0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7,
0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152,
0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc,
0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819,
0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08,
0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f,
0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];
// The digest function returns the hash value (digest)
// as a 32 byte (typed) array.
// message: the string or byte array to hash
SHA256.digest = function(message) {
var h0 = 0x6a09e667;
var h1 = 0xbb67ae85;
var h2 = 0x3c6ef372;
var h3 = 0xa54ff53a;
var h4 = 0x510e527f;
var h5 = 0x9b05688c;
var h6 = 0x1f83d9ab;
var h7 = 0x5be0cd19;
var K = SHA256.K;
if (typeof message == 'string') {
var s = unescape(encodeURIComponent(message)); // UTF-8
message = new Uint8Array(s.length);
for (var i = 0; i < s.length; i++) {
message[i] = s.charCodeAt(i) & 0xff;
}
}
var length = message.length;
var byteLength = Math.floor((length + 72) / 64) * 64;
var wordLength = byteLength / 4;
var bitLength = length * 8;
var m = new Uint8Array(byteLength);
m.set(message);
m[length] = 0x80;
m[byteLength - 4] = bitLength >>> 24;
m[byteLength - 3] = (bitLength >>> 16) & 0xff;
m[byteLength - 2] = (bitLength >>> 8) & 0xff;
m[byteLength - 1] = bitLength & 0xff;
var words = new Int32Array(wordLength);
var byteIndex = 0;
for (var i = 0; i < words.length; i++) {
var word = m[byteIndex++] << 24;
word |= m[byteIndex++] << 16;
word |= m[byteIndex++] << 8;
word |= m[byteIndex++];
words[i] = word;
}
var w = new Int32Array(64);
for (var j = 0; j < wordLength; j += 16) {
for (i = 0; i < 16; i++) {
w[i] = words[j + i];
}
for (i = 16; i < 64; i++) {
var v = w[i - 15];
var s0 = (v >>> 7) | (v << 25);
s0 ^= (v >>> 18) | (v << 14);
s0 ^= (v >>> 3);
v = w[i - 2];
var s1 = (v >>> 17) | (v << 15);
s1 ^= (v >>> 19) | (v << 13);
s1 ^= (v >>> 10);
w[i] = (w[i - 16] + s0 + w[i - 7] + s1) & 0xffffffff;
}
var a = h0;
var b = h1;
var c = h2;
var d = h3;
var e = h4;
var f = h5;
var g = h6;
var h = h7;
for (i = 0; i < 64; i++) {
s1 = (e >>> 6) | (e << 26);
s1 ^= (e >>> 11) | (e << 21);
s1 ^= (e >>> 25) | (e << 7);
var ch = (e & f) ^ (~e & g);
var temp1 = (h + s1 + ch + K[i] + w[i]) & 0xffffffff;
s0 = (a >>> 2) | (a << 30);
s0 ^= (a >>> 13) | (a << 19);
s0 ^= (a >>> 22) | (a << 10);
var maj = (a & b) ^ (a & c) ^ (b & c);
var temp2 = (s0 + maj) & 0xffffffff;
h = g
g = f
f = e
e = (d + temp1) & 0xffffffff;
d = c;
c = b;
b = a;
a = (temp1 + temp2) & 0xffffffff;
}
h0 = (h0 + a) & 0xffffffff;
h1 = (h1 + b) & 0xffffffff;
h2 = (h2 + c) & 0xffffffff;
h3 = (h3 + d) & 0xffffffff;
h4 = (h4 + e) & 0xffffffff;
h5 = (h5 + f) & 0xffffffff;
h6 = (h6 + g) & 0xffffffff;
h7 = (h7 + h) & 0xffffffff;
}
var hash = new Uint8Array(32);
for (i = 0; i < 4; i++) {
hash[i] = (h0 >>> (8 * (3 - i))) & 0xff;
hash[i + 4] = (h1 >>> (8 * (3 - i))) & 0xff;
hash[i + 8] = (h2 >>> (8 * (3 - i))) & 0xff;
hash[i + 12] = (h3 >>> (8 * (3 - i))) & 0xff;
hash[i + 16] = (h4 >>> (8 * (3 - i))) & 0xff;
hash[i + 20] = (h5 >>> (8 * (3 - i))) & 0xff;
hash[i + 24] = (h6 >>> (8 * (3 - i))) & 0xff;
hash[i + 28] = (h7 >>> (8 * (3 - i))) & 0xff;
}
return hash;
}
// The hash function returns the hash value as a hex string.
// message: the string or byte array to hash
SHA256.hash = function(message) {
var digest = SHA256.digest(message);
var hex = '';
for (i = 0; i < digest.length; i++) {
var s = '0' + digest[i].toString(16);
hex += s.length > 2 ? s.substring(1) : s;
}
return hex;
}
function XHR(options) {
var xhr = new XMLHttpRequest();
if ("form" in options) {
options.data = new FormData(options.form);
if ( !("url" in options) )
options.url = options.form.action;
if ( !("method" in options) && ("method" in options.form) )
options.method = options.form.method;
}
if ("json" in options) {
options.data = JSON.stringify(options.json);
options.method = "POST";
options.responseType = "json";
}
if ( !("method" in options) )
options.method = "GET";
if ("responseType" in options)
try {
xhr.responseType = options.responseType;
} catch(e) {
console.log("XMLHttpRequest doesn't support responseType of '" + options.responseType + "'");
xhr.bodgeJSON = true;
}
if ("onload" in options) {
if (options.responseType == "json" && xhr.bodgeJSON)
xhr.addEventListener("load", function(e) { var e = { target: { response: JSON.parse(e.target.response) } }; options.onload(e) }, false);
else
xhr.addEventListener("load", options.onload, false);
}
xhr.open(options.method, options.url);
if ("json" in options)
xhr.setRequestHeader( "Content-Type", "application/json" );
if ("contentType" in options)
xhr.setRequestHeader( "Content-Type", options.contentType );
xhr.send(options.data);
return xhr;
}
// RIPEMD160
var RIPEMD160 = (function () {
function RIPEMD160() {
this.MDbuf = [];
this.MDbuf[0] = 1732584193;
this.MDbuf[1] = -271733879;
this.MDbuf[2] = -1732584194;
this.MDbuf[3] = 271733878;
this.MDbuf[4] = -1009589776;
this.working = new Int32Array(16);
this.working_ptr = 0;
this.msglen = 0;
}
RIPEMD160.prototype.reset = function () {
this.MDbuf = [];
this.MDbuf[0] = 1732584193;
this.MDbuf[1] = -271733879;
this.MDbuf[2] = -1732584194;
this.MDbuf[3] = 271733878;
this.MDbuf[4] = -1009589776;
this.working = new Int32Array(16);
this.working_ptr = 0;
this.msglen = 0;
};
RIPEMD160.prototype.compress = function (X) {
var index = 0;
var a;
var b;
var c;
var d;
var e;
var A;
var B;
var C;
var D;
var E;
var temp;
var s;
A = a = this.MDbuf[0];
B = b = this.MDbuf[1];
C = c = this.MDbuf[2];
D = d = this.MDbuf[3];
E = e = this.MDbuf[4];
for (; index < 16; index++) {
temp = a + (b ^ c ^ d) + X[RIPEMD160.IndexArray[0][index]];
a = e;
e = d;
d = (c << 10) | (c >>> 22);
c = b;
s = RIPEMD160.ArgArray[0][index];
b = ((temp << s) | (temp >>> (32 - s))) + a;
temp = A + (B ^ (C | ~D)) + X[RIPEMD160.IndexArray[1][index]] + 1352829926;
A = E;
E = D;
D = (C << 10) | (C >>> 22);
C = B;
s = RIPEMD160.ArgArray[1][index];
B = ((temp << s) | (temp >>> (32 - s))) + A;
}
for (; index < 32; index++) {
temp = a + ((b & c) | (~b & d)) + X[RIPEMD160.IndexArray[0][index]] + 1518500249;
a = e;
e = d;
d = (c << 10) | (c >>> 22);
c = b;
s = RIPEMD160.ArgArray[0][index];
b = ((temp << s) | (temp >>> (32 - s))) + a;
temp = A + ((B & D) | (C & ~D)) + X[RIPEMD160.IndexArray[1][index]] + 1548603684;
A = E;
E = D;
D = (C << 10) | (C >>> 22);
C = B;
s = RIPEMD160.ArgArray[1][index];
B = ((temp << s) | (temp >>> (32 - s))) + A;
}
for (; index < 48; index++) {
temp = a + ((b | ~c) ^ d) + X[RIPEMD160.IndexArray[0][index]] + 1859775393;
a = e;
e = d;
d = (c << 10) | (c >>> 22);
c = b;
s = RIPEMD160.ArgArray[0][index];
b = ((temp << s) | (temp >>> (32 - s))) + a;
temp = A + ((B | ~C) ^ D) + X[RIPEMD160.IndexArray[1][index]] + 1836072691;
A = E;
E = D;
D = (C << 10) | (C >>> 22);
C = B;
s = RIPEMD160.ArgArray[1][index];
B = ((temp << s) | (temp >>> (32 - s))) + A;
}
for (; index < 64; index++) {
temp = a + ((b & d) | (c & ~d)) + X[RIPEMD160.IndexArray[0][index]] + -1894007588;
a = e;
e = d;
d = (c << 10) | (c >>> 22);
c = b;
s = RIPEMD160.ArgArray[0][index];
b = ((temp << s) | (temp >>> (32 - s))) + a;
temp = A + ((B & C) | (~B & D)) + X[RIPEMD160.IndexArray[1][index]] + 2053994217;
A = E;
E = D;
D = (C << 10) | (C >>> 22);
C = B;
s = RIPEMD160.ArgArray[1][index];
B = ((temp << s) | (temp >>> (32 - s))) + A;
}
for (; index < 80; index++) {
temp = a + (b ^ (c | ~d)) + X[RIPEMD160.IndexArray[0][index]] + -1454113458;
a = e;
e = d;
d = (c << 10) | (c >>> 22);
c = b;
s = RIPEMD160.ArgArray[0][index];
b = ((temp << s) | (temp >>> (32 - s))) + a;
temp = A + (B ^ C ^ D) + X[RIPEMD160.IndexArray[1][index]];
A = E;
E = D;
D = (C << 10) | (C >>> 22);
C = B;
s = RIPEMD160.ArgArray[1][index];
B = ((temp << s) | (temp >>> (32 - s))) + A;
}
D += c + this.MDbuf[1];
this.MDbuf[1] = this.MDbuf[2] + d + E;
this.MDbuf[2] = this.MDbuf[3] + e + A;
this.MDbuf[3] = this.MDbuf[4] + a + B;
this.MDbuf[4] = this.MDbuf[0] + b + C;
this.MDbuf[0] = D;
};
RIPEMD160.prototype.MDfinish = function (array, lswlen, mswlen) {
var X = array;
X[(lswlen >> 2) & 15] ^= 1 << (((lswlen & 3) << 3) + 7);
if (((lswlen & 63) > 55)) {
this.compress(X);
for (var i = 0; i < 14; i++) {
X[i] = 0;
}
}
X[14] = lswlen << 3;
X[15] = (lswlen >> 29) | (mswlen << 3);
this.compress(X);
};
RIPEMD160.prototype.update = function (input) {
for (var i = 0; i < input.length; i++) {
this.working[this.working_ptr >> 2] ^= input[i] << ((this.working_ptr & 3) << 3);
this.working_ptr++;
if ((this.working_ptr == 64)) {
this.compress(this.working);
for (var j = 0; j < 16; j++) {
this.working[j] = 0;
}
this.working_ptr = 0;
}
}
this.msglen += input.length;
};
RIPEMD160.prototype.digestBin = function () {
this.MDfinish(this.working, this.msglen, 0);
//var res = new Int8Array();
var res = [];
for (var i = 0; i < 20; i++) {
res[i] = ((this.MDbuf[i >> 2] >>> ((i & 3) << 3)) & 255);
}
return new Uint8Array(res);
};
RIPEMD160.prototype.digest = function (input) {
this.update(new Int8Array(input));
return this.digestBin();
};
RIPEMD160.ArgArray = [[11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6], [8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11]];
RIPEMD160.IndexArray = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13], [5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]];
return RIPEMD160;
})();
</script>
</head>
<body>
Making initial call to API...
<p>
If nothing happens then check API is running!
</body>
</html>

View File

@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<localization>
<context locale="de">
<context path="Api">
<context path="BlocksResource">
<!--<context path="GET signature">
<translation key="operation:description" template="returns the block that matches the given signature" />
<translation key="success_response:description" template="the block" />
</context>
<context path="GET first">
<translation key="operation:description" template="returns the genesis block" />
<translation key="success_response:description" template="the block" />
</context>
<context path="GET last">
<translation key="operation:description" template="returns the last valid block" />
<translation key="success_response:description" template="the block" />
</context>
<context path="GET child:signature">
<translation key="operation:description" template="returns the child block of the block that matches the given signature" />
<translation key="success_response:description" template="the block" />
</context>
<context path="GET generatingbalance">
<translation key="operation:description" template="calculates the generating balance of the block that will follow the last block" />
<translation key="success_response:description" template="the generating balance" />
</context>
<context path="GET generatingbalance:signature">
<translation key="operation:description" template="calculates the generating balance of the block that will follow the block that matches the signature" />
<translation key="success_response:description" template="the block" />
</context>
<context path="GET time">
<translation key="operation:description" template="calculates the time it should take for the network to generate the next block" />
<translation key="success_response:description" template="the time" />
</context>
<context path="GET time:generatingbalance">
<translation key="operation:description" template="calculates the time it should take for the network to generate blocks when the current generating balance in the network is the specified generating balance" />
<translation key="success_response:description" template="the time" />
</context>
<context path="GET height">
<translation key="operation:description" template="returns the block height of the last block." />
<translation key="success_response:description" template="the height" />
</context>
<context path="GET height:signature">
<translation key="operation:description" template="returns the block height of the block that matches the given signature" />
<translation key="success_response:description" template="the height" />
</context>
<context path="GET byheight:height">
<translation key="operation:description" template="returns the block whith given height" />
<translation key="success_response:description" template="the block" />
</context>-->
</context>
</context>
</context>
</localization>

View File

@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<localization>
<context locale="en">
<context path="Api">
<context path="BlocksResource">
<context path="GET signature">
<translation key="operation:description" template="returns the block that matches the given signature" />
<translation key="success_response:description" template="the block" />
</context>
<context path="GET first">
<translation key="operation:description" template="returns the genesis block" />
<translation key="success_response:description" template="the block" />
</context>
<context path="GET last">
<translation key="operation:description" template="returns the last valid block" />
<translation key="success_response:description" template="the block" />
</context>
<context path="GET child:signature">
<translation key="operation:description" template="returns the child block of the block that matches the given signature" />
<translation key="success_response:description" template="the block" />
</context>
<context path="GET generatingbalance">
<translation key="operation:description" template="calculates the generating balance of the block that will follow the last block" />
<translation key="success_response:description" template="the generating balance" />
</context>
<context path="GET generatingbalance:signature">
<translation key="operation:description" template="calculates the generating balance of the block that will follow the block that matches the signature" />
<translation key="success_response:description" template="the block" />
</context>
<context path="GET time">
<translation key="operation:description" template="calculates the time it should take for the network to generate the next block" />
<translation key="success_response:description" template="the time" />
</context>
<context path="GET time:generatingbalance">
<translation key="operation:description" template="calculates the time it should take for the network to generate blocks when the current generating balance in the network is the specified generating balance" />
<translation key="success_response:description" template="the time" />
</context>
<context path="GET height">
<translation key="operation:description" template="returns the block height of the last block." />
<translation key="success_response:description" template="the height" />
</context>
<context path="GET height:signature">
<translation key="operation:description" template="returns the block height of the block that matches the given signature" />
<translation key="success_response:description" template="the height" />
</context>
<context path="GET byheight:height">
<translation key="operation:description" template="returns the block whith given height" />
<translation key="success_response:description" template="the block" />
</context>
</context>
</context>
</context>
</localization>

View File

@@ -0,0 +1,72 @@
UNKNOWN=Unbekannter Fehler
JSON=JSON Nachricht konnte nicht geparsed werden
NO_BALANCE=Guthaben ungenügend
NOT_YET_RELEASED=Feature wurde noch nicht veröffentlicht
INVALID_SIGNATURE=Ungültige Signatur
INVALID_ADDRESS=Ungültige Adresse
INVALID_SEED=Ungültiger Seed
INVALID_AMOUNT=Ungültiger Betrag
INVALID_FEE=Ungültige Gebühr
INVALID_SENDER=Ungültiger Sender
INVALID_RECIPIENT=Ungültiger Empfänger
INVALID_NAME_LENGTH=Ungültige Namenslänge
INVALID_VALUE_LENGTH=Ungültige Wertlänge
INVALID_NAME_OWNER=Ungültiger Namensbesitzer
INVALID_BUYER=Ungültiger Käufer
INVALID_PUBLIC_KEY=Ungültiger Public Key
INVALID_OPTIONS_LENGTH=Ungültige Optionen-Länge
INVALID_OPTION_LENGTH=Ungültige Optionslänge
INVALID_DATA=Ungültige Daten
INVALID_DATA_LENGTH=Ungültige Datenlänge
INVALID_UPDATE_VALUE=Ungültiger Update-Wert
KEY_ALREADY_EXISTS=Der Schlüssel existiert bereits, Editieren ist deaktiviert
KEY_NOT_EXISTS=Der Schlüssel existiert nicht
LAST_KEY_IS_DEFAULT_KEY_ERROR=Du kannst den Schlüssel '${key}' nicht löschen, wenn er der einzige ist
FEE_LESS_REQUIRED=fee less required
WALLET_NOT_IN_SYNC=Das Wallet muss synchronisiert werden
INVALID_NETWORK_ADDRESS=Ungültige Netzwerkadresse
WALLET_NO_EXISTS=Das Wallet existiert nicht
WALLET_ADDRESS_NO_EXISTS=Die Adresse existiert nicht im Wallet
WALLET_LOCKED=Das Wallet ist abgeschlossen
WALLET_ALREADY_EXISTS=Das Wallet existiert bereits
WALLET_API_CALL_FORBIDDEN_BY_USER=Der Benutzer hat den API-Aufruf abgelehnt
BLOCK_NO_EXISTS=Der Block existiert nicht
TRANSACTION_NO_EXISTS=Die Transaktion existiert nicht
PUBLIC_KEY_NOT_FOUND=Public Key wurde nicht gefunden
NAME_NO_EXISTS=Der Name existiert nicht
NAME_ALREADY_EXISTS=Der Name existiert bereits
NAME_ALREADY_FOR_SALE=Der Name steht bereits zum Verkauf
NAME_NOT_LOWER_CASE=Der Name muss aus Kleinbuchstaben bestehen
NAME_SALE_NO_EXISTS=Namensverkauf existiert nicht
BUYER_ALREADY_OWNER=Der Käufer ist bereits Besitzer
POLL_NO_EXISTS=Die Abstimmung existiert nicht
POLL_ALREADY_EXISTS=Die Abstimmung existiert bereits
DUPLICATE_OPTION=Nicht alle Optionen sind eindeutig
POLL_OPTION_NO_EXISTS=Die option existiert nicht
ALREADY_VOTED_FOR_THAT_OPTION=Bereits für diese Option abgestimmt
INVALID_ASSET_ID=Ungültige Asset ID
NAME_NOT_REGISTERED=?NAME_NOT_REGISTERED?
NAME_FOR_SALE=?NAME_FOR_SALE?
NAME_WITH_SPACE=?NAME_WITH_SPACE?
INVALID_DESC_LENGTH=Ungültige Beschreibungslänge. Max. Länge ${MAX_LENGTH}
EMPTY_CODE=Der Code ist leer
DATA_SIZE=Ungültige Datenlänge
NULL_PAGES=Ungültige Seiten
INVALID_TYPE_LENGTH=Ungültige Typlänge
INVALID_TAGS_LENGTH=Ungültige Tag-Länge
INVALID_CREATION_BYTES=Fehler in Creation Bytes
BODY_EMPTY=invalid body it must not be empty
BLOG_DISABLED=Dieser Blog ist deaktiviert
NAME_NOT_OWNER=the creator address does not own the author name
TX_AMOUNT=the data size is too large - currently only ${BATCH_TX_AMOUNT} arbitrary transactions are allowed at once!
BLOG_ENTRY_NO_EXISTS=transaction with this signature contains no entries!
BLOG_EMPTY=this blog is empty
POSTID_EMPTY=the attribute postid is empty! this is the signature of the post you want to comment
POST_NOT_EXISTING=for the given postid no blogpost to comment was found
COMMENTING_DISABLED=commenting is for this blog disabled
COMMENT_NOT_EXISTING=for the given signature no comment was found
INVALID_COMMENT_OWNER=invalid comment owner
MESSAGE_FORMAT_NOT_HEX=the Message format is not hex - correct the text or use isTextMessage = true
MESSAGE_BLANK=The message attribute is missing or content is blank
NO_PUBLIC_KEY=The recipient has not yet performed any action in the blockchain.\nYou can't send an encrypted message to him.
MESSAGESIZE_EXCEEDED=Message size exceeded!

View File

@@ -0,0 +1,95 @@
# Keys are from api.ApiError enum
# Common
UNKNOWN=unknown error
JSON=failed to parse json message
NO_BALANCE=not enough balance
NOT_YET_RELEASED=that feature is not yet released
UNAUTHORIZED=api call unauthorized
REPOSITORY_ISSUE=repository error
# Validation
INVALID_SIGNATURE=invalid signature
INVALID_ADDRESS=invalid address
INVALID_SEED=invalid seed
INVALID_AMOUNT=invalid amount
INVALID_FEE=invalid fee
INVALID_SENDER=invalid sender
INVALID_RECIPIENT=invalid recipient
INVALID_NAME_LENGTH=invalid name length
INVALID_VALUE_LENGTH=invalid value length
INVALID_NAME_OWNER=invalid name owner
INVALID_BUYER=invalid buyer
INVALID_PUBLIC_KEY=invalid public key
INVALID_OPTIONS_LENGTH=invalid options length
INVALID_OPTION_LENGTH=invalid option length
INVALID_DATA=invalid data
INVALID_DATA_LENGTH=invalid data length
INVALID_UPDATE_VALUE=invalid update value
KEY_ALREADY_EXISTS=key already exists, edit is false
KEY_NOT_EXISTS=the key does not exist
FEE_LESS_REQUIRED=fee less required
WALLET_NOT_IN_SYNC=wallet needs to be synchronized
INVALID_NETWORK_ADDRESS=invalid network address
ADDRESS_NO_EXISTS=account address does not exist
INVALID_CRITERIA=invalid search criteria
# Wallet
WALLET_NO_EXISTS=wallet does not exist
WALLET_ADDRESS_NO_EXISTS=address does not exist in wallet
WALLET_LOCKED=wallet is locked
WALLET_ALREADY_EXISTS=wallet already exists
WALLET_API_CALL_FORBIDDEN_BY_USER=wallet denied api call
# Blocks
BLOCK_NO_EXISTS=block does not exist
# Transactions
TRANSACTION_NO_EXISTS=transaction does not exist
PUBLIC_KEY_NOT_FOUND=public key not found
# Names
NAME_NO_EXISTS=name does not exist
NAME_ALREADY_EXISTS=name already exists
NAME_ALREADY_FOR_SALE=name already for sale
NAME_NOT_LOWER_CASE=name must be lower case
NAME_SALE_NO_EXISTS=namesale does not exist
BUYER_ALREADY_OWNER=buyer is already owner
# Voting
POLL_NO_EXISTS=poll does not exist
POLL_ALREADY_EXISTS=poll already exists
DUPLICATE_OPTION=not all options are unique
POLL_OPTION_NO_EXISTS=option does not exist
ALREADY_VOTED_FOR_THAT_OPTION=already voted for that option
# Assets
INVALID_ASSET_ID=invalid asset id
INVALID_ORDER_ID=invalid asset order id
ORDER_NO_EXISTS=unknown asset order id
# ATs
EMPTY_CODE=code is empty
DATA_SIZE=invalid data length
NULL_PAGES=invalid pages
INVALID_TYPE_LENGTH=invalid type length
INVALID_TAGS_LENGTH=invalid tags length
INVALID_CREATION_BYTES=error in creation bytes
# Blogs/Name-storage
BODY_EMPTY=invalid body it must not be empty
BLOG_DISABLED=this blog is disabled
NAME_NOT_OWNER=the creator address does not own the author name
BLOG_ENTRY_NO_EXISTS=transaction with this signature contains no entries!
BLOG_EMPTY=this blog is empty
POSTID_EMPTY=the attribute postid is empty! this is the signature of the post you want to comment
POST_NOT_EXISTING=for the given postid no blogpost to comment was found
COMMENTING_DISABLED=commenting is for this blog disabled
COMMENT_NOT_EXISTING=for the given signature no comment was found
INVALID_COMMENT_OWNER=invalid comment owner
# Messages
MESSAGE_FORMAT_NOT_HEX=the Message format is not hex - correct the text or use isTextMessage = true
MESSAGE_BLANK=The message attribute is missing or content is blank
NO_PUBLIC_KEY=The recipient has not yet performed any action in the blockchain.\nYou can't send an encrypted message to them.
MESSAGESIZE_EXCEEDED=Message size exceeded!

View File

@@ -0,0 +1,42 @@
OK=OK
INVALID_ADDRESS=INVALID_ADDRESS
NEGATIVE_AMOUNT=NEGATIVE_AMOUNT
NEGATIVE_FEE=NEGATIVE_FEE
NO_BALANCE=NO_BALANCE
INVALID_REFERENCE=INVALID_REFERENCE
INVALID_NAME_LENGTH=INVALID_NAME_LENGTH
INVALID_VALUE_LENGTH=INVALID_VALUE_LENGTH
NAME_ALREADY_REGISTERED=NAME_ALREADY_REGISTERED
NAME_DOES_NOT_EXIST=NAME_DOES_NOT_EXIST
INVALID_NAME_OWNER=INVALID_NAME_OWNER
NAME_ALREADY_FOR_SALE=NAME_ALREADY_FOR_SALE
NAME_NOT_FOR_SALE=NAME_NOT_FOR_SALE
BUYER_ALREADY_OWNER=BUYER_ALREADY_OWNER
INVALID_AMOUNT=INVALID_AMOUNT
INVALID_SELLER=INVALID_SELLER
NAME_NOT_LOWER_CASE=NAME_NOT_LOWER_CASE
INVALID_DESCRIPTION_LENGTH=INVALID_DESCRIPTION_LENGTH
INVALID_OPTIONS_COUNT=INVALID_OPTIONS_COUNT
INVALID_OPTION_LENGTH=INVALID_OPTION_LENGTH
DUPLICATE_OPTION=DUPLICATE_OPTION
POLL_ALREADY_EXISTS=POLL_ALREADY_EXISTS
POLL_DOES_NOT_EXIST=POLL_DOES_NOT_EXIST
POLL_OPTION_DOES_NOT_EXIST=POLL_OPTION_DOES_NOT_EXIST
ALREADY_VOTED_FOR_THAT_OPTION=ALREADY_VOTED_FOR_THAT_OPTION
INVALID_DATA_LENGTH=INVALID_DATA_LENGTH
INVALID_QUANTITY=INVALID_QUANTITY
ASSET_DOES_NOT_EXIST=ASSET_DOES_NOT_EXIST
INVALID_RETURN=INVALID_RETURN
HAVE_EQUALS_WANT=HAVE_EQUALS_WANT
ORDER_DOES_NOT_EXIST=ORDER_DOES_NOT_EXIST
INVALID_ORDER_CREATOR=INVALID_ORDER_CREATOR
INVALID_PAYMENTS_COUNT=INVALID_PAYMENTS_COUNT
NEGATIVE_PRICE=NEGATIVE_PRICE
INVALID_CREATION_BYTES=INVALID_CREATION_BYTES
INVALID_TAGS_LENGTH=INVALID_TAGS_LENGTH
INVALID_AT_TYPE_LENGTH=INVALID_AT_TYPE_LENGTH
INVALID_AT_TRANSACTION=INVALID_AT_TRANSACTION
AT_IS_FINISHED=AT_IS_FINISHED
ASSET_DOES_NOT_MATCH_AT=ASSET_DOES_NOT_MATCH_AT
ASSET_ALREADY_EXISTS=ASSET_ALREADY_EXISTS
NOT_YET_RELEASED=NOT_YET_RELEASED