probe-tx-sign

1.0.3 • Public • Published

SYNOPSIS

NPM Package Actions Status Coverage Status Gitter or #ethereumjs on freenode

INSTALL

npm install probe-tx-sign

USAGE

import ProbeTransaction from 'probe-tx-sign'
import Common from 'ethereumjs-common'

const privateKey = Buffer.from('c0eb27071e3dd18ce215564e7d486b346ef847ed2d1efe8ed33100420d9e9c67', 'hex')

const txParams = {
  nonce: '0x218',
  gasPrice: '0x09184e72a0',
  gasLimit: '0x271000',
  to: '0x1100000000000000000000000000000000000000',
  value: '0xff',
  data: '0x'
}

const common = Common.default.forCustomChain(
  'mainnet',
  {
    name: 'my-network',
    networkId: 1337,
    chainId: 1337,
  },
  'petersburg',
)

const tx = new ProbeTransaction(txParams, { common })
tx.sign(privateKey)
const serializedTx = "0x" + tx.serialize().toString('hex');
console.log(serializedTx)

Chain and Hardfork Support

The Transaction and FakeTransaction constructors receives a second parameter that lets you specify the chain and hardfork to be used. By default, mainnet and petersburg will be used.

There are two ways of customizing these. The first one, as shown in the previous section, is by using an object with chain and hardfork names. You can see en example of this in ./examples/ropsten-tx.ts.

The second option is by passing the option common set to an instance of ethereumjs-common' Common. This is specially useful for custom networks or chains/hardforks not yet supported by ethereumjs-common. You can see en example of this in ./examples/custom-chain-tx.ts.

MuirGlacier Support

The MuirGlacier hardfork is supported by the library since the v2.1.2 release.

Istanbul Support

Support for reduced non-zero call data gas prices from the Istanbul hardfork (EIP-2028) has been added to the library along with the v2.1.1 release.

EIP-155 support

EIP-155 replay protection is activated since the spuriousDragon hardfork. To disable it, set the hardfork in the Transaction's constructor.

API

./docs/

EthereumJS

See our organizational documentation for an introduction to EthereumJS as well as information on current standards and best practices.

If you want to join for work or do improvements on the libraries have a look at our contribution guidelines.

LICENSE

MPL-2.0

Readme

Keywords

none

Package Sidebar

Install

npm i probe-tx-sign

Weekly Downloads

0

Version

1.0.3

License

ISC

Unpacked Size

81.8 kB

Total Files

21

Last publish

Collaborators

  • probechain