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

Undefined reference to NeoScrypt when using -DASM #7

Open
globaltoken opened this issue Apr 28, 2018 · 14 comments
Open

Undefined reference to NeoScrypt when using -DASM #7

globaltoken opened this issue Apr 28, 2018 · 14 comments

Comments

@globaltoken
Copy link

Hello @ghostlander,

While compiling I receive an error: "unresolved refference to neoscrypt", which is just caused when using neoscrypt with -DSHA256 -DOPT -DASM -DMINER_4WAY.
If I delete -DASM -DMINER_4WAY, it works.

Why is neoscrypt not defined for -DASM -DMINER_4WAY?
And what to use at neoscrypt_4way *scratchpad arg?
What is scratchpad? any doc available?

Regards,
Pawel

@ghostlander
Copy link
Owner

If you define -DASM, you have to assemble neoscrypt_asm.S and link towards neoscrypt_asm.o

Scratchpad is a fixed size buffer in memory. Caller allocates and manages it. neoscrypt_4way() doesn't do memory allocation on its own unlike neoscrypt()

@ghostlander ghostlander changed the title Undefined reference to neoscrpyt when using -DASM Undefined reference to NeoScrypt when using -DASM May 4, 2018
@globaltoken
Copy link
Author

@ghostlander Thanks for answering.
I linked the asm code, and it did not worked.

Another strange thing: For hashing blocks with nVersion it is not working. Neither scrypt or yescrypt.
While mining blocks with neoscrypt it goes through the whole loop and after 0xffff loop tries it repeats everything with nonce 0. So you have 65536 times the same hash, and after reset you have another different hash. I dont know what I missed here. It just finds block with nonce 0.

@ghostlander
Copy link
Owner

Well, at least the PXC, ORB and HAL wallets use -DASM, so it's working.

It's up to a miner or daemon to assemble properly a 80-byte block header hashed by NeoScrypt. Nonce can be any between 0 and 0xFFFFFFFF. There is also extra nonce in coin base.

@globaltoken
Copy link
Author

@ghostlander Is just 80 byte possible? My blocks require min 81 byte or more because of Auxpow and nAlgo

@ghostlander
Copy link
Owner

AuxPoW is for merged mining. The hashing is done on the parent chain. Aux chains verify PoW by reconstructing the block header as it could appear on the parent chain.

@globaltoken
Copy link
Author

Thank you.
I checked PXC and I saw that you Reverse the Bytes?
Is this necessary for neoscrypt blocks?
Because it seems that just neoscrypt blocks dont use any nonce while daemon generates blocks, and regtest takes very long to generate one block, other algos works fine (excluding yescrypt or scrypt).

Sometimes I tried to generate Blocks in Regtest and it tooked about 30 minutes until I generated a yescrypt, scrypt or neoscrypt block.
This just happens on daemon side mining as it seems.
Any idea?

Regards,
Pawel

@ghostlander
Copy link
Owner

Byte order of NeoScrypt is different to Scrypt or SHA-256. It's native little endian. It takes a while to generate a valid hash on CPU even at the lowest difficulty such as 1 / 2^12.

@globaltoken
Copy link
Author

@ghostlander Thanks for your reply.
If I just use the basic header, it works, with 80 bytes size.
But if I use nAlgo with 81 bytes size it did not hash, every hash is the same.
Do you know where to change this in the Blockchain?

Thanks for your help.

  • Pawel

@ghostlander
Copy link
Owner

It has to be 80 bytes exactly or padded up to. Mix nAlgo into an existing field such as nVersion.

@globaltoken
Copy link
Author

globaltoken commented May 7, 2018

Thanks @ghostlander for your help.
I extracted the Basic 80 byte Header in a new Class for POW Validation and it worked, nAlgo and other things are in CBlock now, and GetPoWHash is in another class with just 80 bytes.

Again thanks for your help.
The other point: -DASM still not work, the neoscrypt_asm.o is compiled and linked.
I use the newest neoscrypt Code that you have in this repo.
I checked other neoscrypt Blockchains, they use another neoscrypt version where -DASM is not needed.

Any suggestions here?

Regards,
Pawel

@ghostlander
Copy link
Owner

That's an older version.

@globaltoken
Copy link
Author

@ghostlander Okay where can I find newest Version?

@ghostlander
Copy link
Owner

The newest is on GitHub as usual.

@globaltoken
Copy link
Author

@ghostlander Oh I used Latest commit 9a52159 on 14 Mar 2016

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