首页 > 其他分享 >truffle 和 ganache 打印账号列表和发送eth

truffle 和 ganache 打印账号列表和发送eth

时间:2024-10-02 10:33:16浏览次数:1  
标签:const web3 ganache console Web3 truffle eth

 

打印 ganache环境的账户列表

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);
});

  运行

 

 

 

发送eth

let amountToSend = web3.utils.toWei('1', 'ether');
 
web3.eth.sendTransaction({
  from: '0xA61Cc9999B16a1F58E3ABBEDF3392b67dAd896fd',
  to: '0xFD3a265399C04b06C9FBBbc28634dA0cB6215736', 
  value:amountToSend,
  gas: '1000000',
  gasPrice:1000000000 
}); 

 运行后

 

 

标签:const,web3,ganache,console,Web3,truffle,eth
From: https://www.cnblogs.com/apenote/p/18444482

相关文章

  • delphi 12 利用TNetHTTPClient 解决post https问题注意事项
          在以前的版本中,如果需要向https接口交互数据,需要openssl的支持,特别时openssl版本太多,往往需要调试很长时间, 现在新版的DelphiXE8以上的版本,有了TNetHttpClient,可以简单的是实现和https接口的交互。usesSystem.Net.URLClient,System.Net.HttpClient......
  • Paper Reading: Deep balanced cascade forest: An novel fault diagnosis method for
    目录研究动机文章贡献本文方法混合采样新型平衡森林DBCF整体流程实验结果数据集和实验设置对比故障诊断方法对比基于决策树的方法对比不平衡分类方法模型效率的比较优点和创新点PaperReading是从个人角度进行的一些总结分享,受到个人关注点的侧重和实力所限,可能有理解不到位的......
  • 大规异构集群 混合并行分布式训练系统,解决算力不均衡问题 HETHUB
    视频教程在这:3.2大规模异构集群,混合并行分布式系统,解释算力不均衡问题HETHUB_哔哩哔哩_bilibili一、大规模异构集群出现的原因:同一种GPU数量有限难以构建大规模集群:训练大规模模型依赖于大量的计算资源。例如,训练GPT-4模型(1.8万亿个参数)需要25000个A100GPU。用一种GPU加速......
  • prometheus学习笔记之Grafana 常用操作
    一、Panel设置1.单位设置2.Panel名称修改3.曲线别名修改前修改后 4.曲线排序 5.曲线复制6.曲线静默 7.Panel复制当前dashboard中复制跨dashboard或folder在其他dashboard中操作8.设置告警线设置告警条件其他按提示填写如果触发告警规则则......
  • Github_以太网开源项目verilog-ethernet代码阅读与移植(五)
    实验背景在(四)中介绍了Github开源项目verilog-ethernet的移植思路,以及对MII接口和数据链路层等功能的仿真,下面介绍数据的跨时钟域传输,以太网数据传输过程和网络层数据传输相关的移植。实验内容数据的跨时钟域传输处理,以太网数据传输过程和网络层数据传输模块介绍与仿真。......
  • prometheus学习笔记之alertmanager告警配置
    一、安装alertmanager项目地址:https://github.com/prometheus/alertmanager帮助文档:https://prometheus.io/docs/alerting/latest/alertmanager/配置文档:https://prometheus.io/docs/alerting/latest/configuration/wgethttps://github.com/prometheus/alertmanager/releas......
  • Springboot自定义Prometheus采集指标
    添加依赖<!--增加Prometheus依赖--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency><dependency><groupId>io.micrometer&l......
  • truffle测试步骤流程
    1、安装Ganache安装本地Ganache进入官网:Ganache-TruffleSuiteQuicklyfireupapersonalEthereumblockchainwhichyoucanusetoruntests,executecommands,andinspectstatewhilecontrollinghowthechainoperates.https://trufflesuite.com/ganache/我们......
  • 云原生之运维监控实践-OpenEuler22.03SP3上安装Prometheus与Grafana实现主机状态监测
    背景如果没有监控,那么最好的情况是没有问题发生,最糟糕的情况则是问题发生了但没有被发现。——《Prometheus监控实战》去年写了一篇在Docker环境下部署若依微服务ruoyi-cloud项目的文章,当时使用的是docker-compose在单台机器上部署若依微服务ruoyi-cloud项目;在这个......
  • prometheus学习笔记之node-export
    1.安装node-exportk8s各node节点使⽤⼆进制或者daemonset⽅式安装node_exporter,⽤于收集各k8snode节点宿主机的监控指标数据,默认监听端⼝为9100wgethttps://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gztarxfno......