# transaction-hex-decoder

> transaction-hex-decoder - Decode Transactions given their HEX

Latest version **1.0.2** (published 2018-04-27) · ISC license · 0 weekly downloads

## Install

```sh
npm install transaction-hex-decoder
pnpm add transaction-hex-decoder
yarn add transaction-hex-decoder
bun add transaction-hex-decoder
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-04-27 |
| First published | 2018-04-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 8.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 5 |
| Author | marcogbarcellos |
| Maintainers | marcogbarcellos |
| Keywords | btc, eth, transactions, tx, rawtx, blockchain, doge, dash, zcash |

## Links

- npm: https://www.npmjs.com/package/transaction-hex-decoder
- Repository: https://github.com/marcogbarcellos/transaction-hex-decoder
- Homepage: https://github.com/marcogbarcellos/transaction-hex-decoder#readme
- Issues: https://github.com/marcogbarcellos/transaction-hex-decoder/issues
- npm.io page: https://npm.io/package/transaction-hex-decoder

## Dependencies (2)

- [rlp](https://npm.io/package/rlp.md) ^2.0.0
- [bitcoinjs-lib](https://npm.io/package/bitcoinjs-lib.md) ^3.3.2

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2018-04-27
- 1.0.1 — 2018-04-27
- 1.0.0 — 2018-04-27

## README

# Raw Transaction Decoder

This library's methods return information of a transaction, given this transaction `HEX` as input.

## Supported coins

- Ethereum
- Bitcoin

## Usage

- `npm install transaction-hex-decoder`


### Ethereum Raw Tx

```javascript
const txHexDecoder = require("transaction-hex-decoder");

// Transaction https://etherscan.io/tx/0x09b092b86ffc8f425b405d3ac0ef1ec51269fa024e64b4b5778961a4d588c982 -> Tool/utilities to check rawTx
const ethEncodedRawTx = "0xf86e82cd70850bdfd63e00827918943c601b93eaad76d2f66f71a0b8c22dbbf2e71db688287bb23d4c9350008025a09f3842a8fd9d6228d4ee226524e249c81eba22c53a87855f2244b2064c8036d6a073c767ae047bce30dee587e5233649acbae36b10d97b39d11fb9b2ccabf9b925";
const ethDecodedRawTx = txHexDecoder.decodeEthRawTx(ethEncodedRawTx);
console.log("Decoded Transaction : "+JSON.stringify(ethDecodedRawTx));
/* OUTPUT Example:
{
   "nonce":52592,
   "gasPrice":51000000000,
   "startGas":31000,
   "to":"0x3c601b93eaad76d2f66f71a0b8c22dbbf2e71db6",
   "valueInWei":2917121160000000000,
   "valueInEther":2.91712116,
   "inputData":"0x",
   "v":"0x25",
   "r":"0x9f3842a8fd9d6228d4ee226524e249c81eba22c53a87855f2244b2064c8036d6",
   "s":"0x73c767ae047bce30dee587e5233649acbae36b10d97b39d11fb9b2ccabf9b925"
}*/
```

### Bitcoin Raw Tx

```javascript
const txHexDecoder = require("transaction-hex-decoder");

const btcEncodedRawTx = "0100000001d144583347ebdb81263ea30c731fa44725f23692918c0bc495df53b26ec3d7920000000000ffffffff01983a0000000000001976a914406f4066bb99985efe9d36b0ac7c4c96c799104888ac00000000";
const btcDecodedRawTx = txHexDecoder.decodeBtcRawTx(btcEncodedRawTx);
console.log("Decoded transaction : "+JSON.stringify(btcDecodedRawTx));
/* OUTPUT Example:
{
   "version":1,
   "locktime":0,
   "ins":[
      {
         "hash":{
            "type":"Buffer",
            "data":[]
         },
         "index":0,
         "script":{
            "type":"Buffer",
            "data":[

            ]
         },
         "sequence":4294967295,
         "witness":[

         ]
      }
   ],
   "outs":[
      {
         "value":15000,
         "script":{
            "type":"Buffer",
            "data":[]
         }
      }
   ],
   "totalValue":15000
}
*/

```

---
_Source: https://npm.io/package/transaction-hex-decoder · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
