Compare commits

...

7 Commits

Author SHA1 Message Date
MoneroOcean 80b9b2be12 Eth draft support 2021-01-22 21:14:28 +00:00
MoneroOcean d405a871a4 Eth draft support 2021-01-22 21:07:24 +00:00
MoneroOcean de78291246 Eth draft support 2021-01-22 08:42:47 +00:00
MoneroOcean 04ba92e6fd Eth draft support 2021-01-22 08:38:27 +00:00
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 21 additions and 4 deletions
+20 -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.baseDiff = function() {
return bignum('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF', 16);
};
module.exports.baseRavenDiff = function() {
return parseInt('0x00000000ff000000000000000000000000000000000000000000000000000000');
};
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,14 @@ 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 = module.exports.baseDiff().div(bignum(rpcData[2].substr(2), 16)).toNumber();
return {
hash: rpcData[0].substr(2),
seed_hash: rpcData[1].substr(2),
difficulty: difficulty,
height: parseInt(rpcData[3])
};
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cryptoforknote-util",
"version": "9.0.17",
"version": "9.1.4",
"main": "cryptoforknote-util",
"author": {
"name": "LucasJones",