Skip to content

SHA256 from staking-pool does not match the ones from on-chain #238

Description

@emi-tangany

Hello Near Team,

I have checked the majority of staking-pool smart contracts deployed on chain, seems like 16 of them have the following hash AjD4YJaXgpiRdiArqnzyDi7Bkr1gJms9Z2w7Ev5esTKB and 502 of them have this other hash J1arLz48fgXcGyCPVckFwLnewNH6j1uw79thsvwqGYTY.

When I compute the hash for the Staking Pool (using the script from down below) seems like the output of the hash is totally different from the previous two:

Image

Besides that, it seems like when I built the binary by executing the build.sh script (from the staking-pool folder), I also get a different wasm file compared to the one from your GitHub (checksum below).

Image

Script
import * as fs from 'fs';
import * as crypto from 'crypto';
import bs58 from 'bs58';

function sha256Base58(filePath: string): string {
const fileBuffer = fs.readFileSync(filePath);

const hashBuffer = crypto
.createHash('sha256')
.update(fileBuffer)
.digest();

const base58Hash = bs58.encode(hashBuffer);

return base58Hash;
}

// Example usage:
const filePath = './staking_pool.wasm';
const base58Result = sha256Base58(filePath);

console.log(Base58-encoded SHA256 of ${filePath}:);
console.log(base58Result);

Could you please help me determine if I may be doing something wrong when generating the hash of the smart contract?

If the hash is being generated correctly, could you please share with me the source code of the deployed smart contracts on chain?

Thank, very much appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions