ethereumjs-tx, ethereum用于创建,操作和签名事务的简单模块

分享于 

2分钟阅读

GitHub

  繁體
A simple module for creating, manipulating and signing ethereum transactions
  • 源代码名称:ethereumjs-tx
  • 源代码网址:http://www.github.com/ethereumjs/ethereumjs-tx
  • ethereumjs-tx源代码文档
  • ethereumjs-tx源代码下载
  • Git URL:
    git://www.github.com/ethereumjs/ethereumjs-tx.git
    Git Clone代码到本地:
    git clone http://www.github.com/ethereumjs/ethereumjs-tx
    Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/ethereumjs/ethereumjs-tx
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
    概要

    安装

    npm install ethereumjs-tx

    用法
    constEthereumTx=require('ethereumjs-tx')constprivateKey=Buffer.from('e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109', 'hex')consttxParams= {
     nonce:'0x00',
     gasPrice:'0x09184e72a000', 
     gasLimit:'0x2710',
     to:'0x0000000000000000000000000000000000000000', 
     value:'0x00', 
     data:'0x7f7465737432000000000000000000000000000000000000000000000000000000600057',
     // EIP 155 chainId - mainnet: 1, ropsten: 3 chainId:3}consttx=newEthereumTx(txParams)tx.sign(privateKey)constserializedTx=tx.serialize()
    浏览器

    有关浏览器生成,请参见https://github.com/ethereumjs/browser-builds

    API

    ./docs/

    许可证

    MPL-2.0