ETH入门

作者: Erwin_wind | 来源:发表于2019-11-21 11:13 被阅读0次

文档介绍

本文梳理了eth的常用资料,基础操作,基础数据结构,方便初学者快速学习和了解eth

1. 相关资料链接:

  1. github项目地址:https://github.com/ethereum/go-ethereum
  2. 以太坊rpc接口文档: http://cw.hubwiz.com/card/c/ethereum-json-rpc-api/1/3/17/
  3. geth客户端rpc接口文档:http://cw.hubwiz.com/card/c/geth-rpc-api/1/4/5/
  4. web3j中文文档:http://blog.hubwiz.com/2018/07/10/web3j-index/
  5. web3j官方文档:https://docs.web3j.io/
  6. metaMask 插件:https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn
  7. remix 代码编辑器:https://remix.ethereum.org/#optimize=false&evmVersion=null&version=soljson-v0.5.11+commit.c082d0b4.js

2. 账户创建

  1. 使用metaMask创建账户
  2. 使用geth客户端创建新账户:http://cw.hubwiz.com/card/c/geth-rpc-api/1/4/4/

3. 区块信息

  1. https://ropsten.etherscan.io/block/6292931

  2. image.png
    1. 区块编号
    2. eth交易笔数,合约交易笔数
    3. 区块hash
    4. 生成的pow哈希
    5. 详情见:http://cw.hubwiz.com/card/c/ethereum-json-rpc-api/1/3/21/

4. 交易信息

  1. eth交易

    1. https://ropsten.etherscan.io/tx/0xcc1061fdc0049890c3ed3151ab8eeb63e5faff867d5d042bbf797403d4d0a517

    2. http://cw.hubwiz.com/card/c/ethereum-json-rpc-api/1/3/23/

    3. image.png
      1. 交易hash
      2. 所在区块编号
      3. 转出地址
      4. 转入地址
      5. 交易数量
  2. erc20合约交易

    1. https://ropsten.etherscan.io/tx/0x607d136e5f106dc0237414807f15c090ec1abb4e1a4af5a9042d52af13e9a6c6
    2. http://cw.hubwiz.com/card/c/ethereum-json-rpc-api/1/3/23/
    3. image.png
      1. 交易hash
      2. 所在区块编号
      3. 转出地址
      4. 转入地址(erc20交易对应的为合约地址)
      5. image.png
      6. input data中对应真实转入的eth 转入地址和转入数量
    4. image.png
      1. 智能合约方法
      2. 交易数量

5. 合约信息

  1. https://ropsten.etherscan.io/address/0xE2c9eA5987AC7cAf8785e99A02EeCC44bb19163c#code
  2. TODO

6. 发起交易

  1. 解锁账户:http://cw.hubwiz.com/card/c/geth-rpc-api/1/4/5/

    1. 注:eth账户默认为锁定状态,须解锁之后才能进行交易
  2. eth交易

    1. http://cw.hubwiz.com/card/c/ethereum-json-rpc-api/1/3/17/
    2. image.png
      1. nonce 交易加速功能实现核心,eth中nonce 相当于交易的唯一id,可以通过指定nonce来覆盖 pending列表中nonce相同的交易,实现交易加速
  3. erc20智能合约交易

    1. image.png
      1. from:转出地址
      2. to:合约地址
      3. data:0xa9059cbb(方法id,transfer(address,uint256) )
      4. data:000000000000000000000000b1900959b3229912566db4f81a92e5666eef8131(参数信息,0xb1900959b3229912566db4f81a92e5666eef8131)
      5. data:000000000000000000000000000000000000000000000000000000000000000a(参数信息, image.png

6. 余额查询

  1. eth余额查询:http://cw.hubwiz.com/card/c/ethereum-json-rpc-api/1/3/8/
  2. erc20智能合约余额查询
    1. http://cw.hubwiz.com/card/c/ethereum-json-rpc-api/1/3/19/

    2. image.png
      1. from:合约所有者地址
      2. to:erc20合约地址
      3. data:0x70a08231(方法id,balanceOf(address))
      4. data:00000000000000000000000023a713f44bfa36449b8f5ee9d212f056906ea855(余额查询的地址,0x23A713F44bFA36449b8F5EE9D212F056906ea855)
    3. image.png
      1. 合约余额查询方法
      2. 查询余额地址
      3. erc20合约地址

7.区块扫描

  1. eth_getBlockByHash:返回具有指定哈希的块。http://cw.hubwiz.com/card/c/ethereum-json-rpc-api/1/3/21/

  2. eth_getBlockByNumber:返回指定编号的块。http://cw.hubwiz.com/card/c/ethereum-json-rpc-api/1/3/22/

  3. 区块扫描实现流程:

    1. TODO

相关文章

网友评论

      本文标题:ETH入门

      本文链接:https://www.haomeiwen.com/subject/heizictx.html