Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

block header #11

Open
xwen01 opened this issue Jul 20, 2018 · 2 comments
Open

block header #11

xwen01 opened this issue Jul 20, 2018 · 2 comments

Comments

@xwen01
Copy link

xwen01 commented Jul 20, 2018

Hi, I'm trying to setup znomp for Fabcoin. I noticed the block header used in znomp follows Zcash protocol, which has 140 bytes block header. The Fabcoin Developer Reference indicates 80-bytes header with 4 bytes nonce. Should I just follow the Fabcoin Developer Reference and change the header and nonce settings in znomp?

Thanks a lot for your help!

@blockchaingate
Copy link
Collaborator

Fabcoin is using 140 bytes header which is same as Zcash.

@poroburu
Copy link

poroburu commented Aug 27, 2018

The Fabcoin header appears to be the same as Zcash except that there is a 4 byte nHeight, and the nReserved is reduced from 32 to 28 bytes.

Although I'm having trouble setting up z-nomp for myself. This is what I am targeting in BlockTemplate.js.

`this.serializeHeader = function(nTime, nonce){
var header = new Buffer(140);
var position = 0;

    console.log('nonce:' + nonce);
    console.log('this.rpcData.bits: ' + this.rpcData.bits);
    console.log('nTime: ' + nTime);
	console.log('this.rpcData.height:', this.rpcData.height.toString(16));
    console.log('this.merkleRootReversed: ' + this.merkleRootReversed);
    console.log('this.prevHashReversed: ' + this.prevHashReversed);
    console.log('this.rpcData.version: ' + this.rpcData.version.toString(16));

    header.writeInt32LE(this.rpcData.version, position += 0, 4, 'hex');
    header.write(this.prevHashReversed, position += 4, 32, 'hex');
    header.write(this.merkleRootReversed, position += 32, 32, 'hex');
	header.writeUInt32LE(this.rpcData.height, position += 32, 4, 'hex');
    header.write('00000000000000000000000000000000000000000000000000000000', position += 4, 28, 'hex'); //hashReserved
    header.write(nTime, position += 28, 4, 'hex');
    header.write(util.reverseBuffer(new Buffer(rpcData.bits, 'hex')).toString('hex'), position += 4, 4, 'hex');
    header.write(nonce, position += 4, 32, 'hex');
    console.log(header.toString('hex'));
	
	
    return header;
};`

But I am getting

1|npm | 2018-08-27 06:57:00 [Pool] [fab coin testnet] (Thread 1) Share rejected: {"job":"cccd","ip":"::ffff:162.219.178.146","worker":"n3nJB5BFk3eEVPocP93yAxQR4KSByxhYKZ.noname","difficulty":0.05,"error":"invalid solution"} 1|npm | nonce:40000000abd4960d042a2e8a2bf344d23627007f000000000000000000000000 1|npm | this.rpcData.bits: 1f0ee3f3 1|npm | nTime: aea0835b 1|npm | this.rpcData.height: 2d10e 1|npm | this.merkleRootReversed: 522d6f7bf7df8122fd80f6793abe244864fbff39aee5b993a0dd88e31c6a63eb 1|npm | this.prevHashReversed: 4301789f491f937c92935a99973c4575482b9c32019c632f466068c4a7e80400 1|npm | this.rpcData.version: 20000000 1|npm | 000000204301789f491f937c92935a99973c4575482b9c32019c632f466068c4a7e80400522d6f7bf7df8122fd80f6793abe244864fbff39aee5b993a0dd88e31c6a63eb0ed1020000000000000000000000000000000000000000000000000000000000aea0835bf3e30e1f0000000000000000000000007f002736d244f32b8a2e2a040d96d4ab00000040 1|npm | Invalid solution: invalid collision length between StepRows 1|npm | X[i] = 05fb6b0a5c270d558701a7920221670f0b510be8c30faaf004fcd20af6a8 1|npm | X[i+1] = 01563707472b058dfd0e0d2c01b7d60d468c072c3e02755c09a7200e9fd3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants