Giter Site home page Giter Site logo

eth-relay's Introduction

以太坊中继 (ETH-Relay)

书籍《区块链以太坊DApp开发实战》的 Demo 源码。

购买链接: https://item.jd.com/51940056385.html

  • 使用 Go 语言编写
  • Go 版本为: 1.11
  • MySQL 版本为:5.7.19,引擎选择 Innodb
  • 代码开发工具是:Goland

启动

代码主要采用单元测试的方式运行。并没编写 main 函数,读者可以自行拓展。区块扫描部分需要依赖到 MySQL 数据库。

其中 eth-relay/block_scanner_test.goTestBlockScanner_Start 函数是区块遍历入口函数

功能列表

  • 创建以太坊钱包
  • 解锁以太坊钱包,传入钱包地址和对应的 keystore密码
  • 签名交易数据结构体
  • 构建符合“ERC20”标准的“transfer”合约函数的“data”入参
  • 根据交易的 hash 值获取对应交易的信息
  • 根据交易 hash 字符串数组批量获取对应的交易信息
  • 单条查询:根据以太坊地址,查询以太坊 eth 的余额
  • 单条查询:根据以太坊地址,查询以太坊 ERC20 代币的余额
  • 批量查询:根据以太坊地址数组,查询以太坊 eth 的余额
  • 批量查询:根据以太坊地址数组,查询 ERC20 代币的余额
  • 发送交易,根据入参 transaction 的不同变量设置,达到发送不同种类的交易
  • 获取地址的 nonce 值
  • 直接发送 ERC20 代币交易,或称转账 ERC20 代币
  • 获取以太坊最新生成区块的区块号
  • 根据区块号,获取区块信息
  • 根据区块 hash,获取区块信息
  • 自定义扫描以太坊区块

其它

欢迎大家在 issues 中给我提一些有用的建议 或 贡献代码,我们一起维护它。谢谢

eth-relay's People

Contributors

af913337456 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.