Compare commits

..

3 Commits

Author SHA1 Message Date
MoneroOcean 9021066354 Eth support 2021-01-22 05:55:16 +00:00
MoneroOcean 7c139874ce Removed extra debug output 2020-12-27 07:37:50 +00:00
MoneroOcean 58f8aeb67b Removed extra debug output 2020-12-11 16:16:22 +00:00
2 changed files with 20 additions and 4 deletions
+19 -3
View File
@@ -49,13 +49,19 @@ function getMerkleRoot(transactions) {
const forWitness = txesHaveWitnessCommit(transactions);
const hashes = transactions.map(transaction => transaction.getHash(forWitness));
const rootHash = fastMerkleRoot(hashes, hash256);
console.log(forWitness);
return forWitness ? hash256(Buffer.concat([rootHash, transactions[0].ins[0].witness[0]])) : rootHash;
}
let last_epoch_number;
let last_seed_hash;
const diff1 = 0x00000000ff000000000000000000000000000000000000000000000000000000;
module.exports.baseRavenDiff = function() {
return parseInt('0x00000000ff000000000000000000000000000000000000000000000000000000');
};
module.exports.baseEthDiff = function() {
return parseInt('0x00000000ffff0000000000000000000000000000000000000000000000000000');
};
module.exports.RavenBlockTemplate = function(rpcData, poolAddress) {
const poolAddrHash = bitcoin.address.fromBase58Check(poolAddress).hash;
@@ -129,7 +135,7 @@ module.exports.RavenBlockTemplate = function(rpcData, poolAddress) {
last_epoch_number = epoch_number;
}
const difficulty = parseFloat((diff1 / bignum(rpcData.target, 16).toNumber()).toFixed(9));
const difficulty = parseFloat((module.exports.baseRavenDiff() / bignum(rpcData.target, 16).toNumber()).toFixed(9));
return {
blocktemplate_blob: blob.toString('hex'),
@@ -140,6 +146,7 @@ module.exports.RavenBlockTemplate = function(rpcData, poolAddress) {
difficulty: difficulty,
height: rpcData.height,
bits: rpcData.bits,
prev_hash: rpcData.previousblockhash,
};
};
@@ -172,4 +179,13 @@ module.exports.constructNewRavenBlob = function(blockTemplate, nonceBuff, mixhas
module.exports.constructNewDeroBlob = function(blockTemplate, nonceBuff) {
nonceBuff.copy(blockTemplate, 39, 0, 4);
return blockTemplate;
};
module.exports.EthBlockTemplate = function(rpcData) {
const difficulty = parseFloat((module.exports.baseEth() / bignum(rpcData[2].lstrip("0x"), 16).toNumber()).toFixed(19));
return {
hash: rpcData[0].lstrip("0x"),
seed_hash: rpcData[1].lstrip("0x"),
difficulty: difficulty
};
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cryptoforknote-util",
"version": "9.0.17",
"version": "9.1.0",
"main": "cryptoforknote-util",
"author": {
"name": "LucasJones",