pchainjs-tx
Version:
An simple module for creating, manipulating and signing pchain transactions
40 lines (27 loc) • 1.05 kB
Markdown
const PchainTx = require('pchainjs-tx')
const privateKey = Buffer.from('e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109', 'hex')
const txParams = {
nonce: '0x00',
gasPrice: '0x09184e72a000',
gasLimit: '0x2710',
to: '0x0000000000000000000000000000000000000000',
value: '0x00',
data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057',
// mainChain :"pchain",childChain 1 :"child_0"
chainId: "pchain"
}
const tx = new PchainTx(txParams)
tx.sign(privateKey)
const serializedTx = tx.serialize()
```
**Note:** this package expects ECMAScript 6 (ES6) as a minimum environment. From browsers lacking ES6 support, please use a shim (like [es6-shim](https://github.com/paulmillr/es6-shim)) before including any of the builds from this repo.
# BROWSER
You can use the javascript file in the dist folder
# API
[./docs/](./docs/index.md)
# LICENSE
[MPL-2.0](https://tldrlegal.com/license/mozilla-public-license-2.0-(mpl-2))
`npm install pchainjs-tx`
```javascript