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

btc_b58check fails on DE0 Nano NIOS II #151

Open
jmaldon1 opened this issue Feb 19, 2019 · 0 comments
Open

btc_b58check fails on DE0 Nano NIOS II #151

jmaldon1 opened this issue Feb 19, 2019 · 0 comments

Comments

@jmaldon1
Copy link

I am trying to run libbtc on a DE0-Nano running NIOS II, I have been successful so far in implementing it but when I try to derive a child key the code below fails:

int btc_b58check(const void* bin, size_t binsz, const char* base58str)
{
    uint256 buf;

    const uint8_t* binc = bin;

    unsigned i;

    if (binsz < 4) {
        return -4;
    }
    sha256_Raw(bin, binsz - 4, buf);
    sha256_Raw(buf, sizeof(buf), buf);

    if (memcmp(&binc[binsz - 4], buf, 4)) {
        return -1;
    }
    ...
}

the if (memcmp(&binc[binsz - 4], buf, 4)) conditional fails. Would anyone be able to tell me why this happens?
I have tried commenting out this conditional and libbtc is able to produce results but the p2pkh address is not a valid testnet bitcoin address.

@xloem xloem mentioned this issue Apr 3, 2021
1 task
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

1 participant