const localhost = "http://127.0.0.1:7545";
const {Web3} = require("web3");
const web3 = new Web3(new Web3.providers.HttpProvider(localhost));
web3.eth.getAccounts().then(function (result) {
console.log("账户列表地址:");
console.log(result);
}).catch(function (error) {
console.error(error);
});
web3.eth.getBlockNumber().then(blockNumber => {
console.log('当前区块号:', blockNumber);
});
async function ss(){
const hash="0xc2eae610249f4309ee22bc01a83dbd9a0bada4490fd5be61b12482be0ff2b295"
const accountAddress = '0x0f8Af775fc9831b11063dE7b7dD7604ed7d2D1c3';
const message = 'Some data to sign';
const messageHash = web3.utils.keccak256(message);
const signature = await web3.eth.sign(hash, accountAddress);
console.log(signature);
}
ss();
const getRSVFromSignature = (signature) => {
console.lo
智能合约 签名ecdsa 测试
最新推荐文章于 2025-05-08 21:04:54 发布