智能合约 签名ecdsa 测试

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值