ethers.js:sign(签名)

Signers
在ethers中Signer是以太坊账户的抽象,可以用来签名消息和交易,如将签名的交易发送到以太坊网络以执行状态更改的操作。

npm install ethers@5.4.0
// 引入
import { ethers } from 'ethers'

签名

this.provider = new ethers.providers.Web3Provider(window.ethereum);
this.signer = this.provider.getSigner()
sign(){
	this.signer.signMessage("Hello World").then(res=>{
		console.log('签名_res',res);
	}).catch(err=>{
		console.log('签名_err',err);
	})
},

在这里插入图片描述
在这里插入图片描述

相关推荐

  1. APK<span style='color:red;'>签名</span>

    APK签名

    2024-03-30 00:54:02      43 阅读
  2. 密码学 | 数字签名方法:Schnorr 签名

    2024-03-30 00:54:02       35 阅读
  3. 【微信】签名生成-用户态签名

    2024-03-30 00:54:02       28 阅读
  4. go-zero接口签名

    2024-03-30 00:54:02       64 阅读
  5. 数字签名介绍

    2024-03-30 00:54:02       58 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-30 00:54:02       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-30 00:54:02       106 阅读
  3. 在Django里面运行非项目文件

    2024-03-30 00:54:02       87 阅读
  4. Python语言-面向对象

    2024-03-30 00:54:02       96 阅读

热门阅读

  1. uniapp踩坑细节

    2024-03-30 00:54:02       46 阅读
  2. Element-UI中el-time-picker时间选择器无法选择

    2024-03-30 00:54:02       38 阅读
  3. js移除子元素

    2024-03-30 00:54:02       38 阅读
  4. 应用Druid解析SQL获取查询表字段、参数信息

    2024-03-30 00:54:02       37 阅读
  5. 5.89 BCC工具之tcptop.py解读

    2024-03-30 00:54:02       34 阅读
  6. PTA 道路管制

    2024-03-30 00:54:02       40 阅读
  7. VUE3从i18n国际化组件动态获取字符串

    2024-03-30 00:54:02       39 阅读
  8. 星图金融价值跃迁:打造“一体两翼”正向循环

    2024-03-30 00:54:02       44 阅读
  9. 5、Cocos Creator 动作系统

    2024-03-30 00:54:02       40 阅读