diff --git a/src/index.ts b/src/index.ts
index 2f55f86..f625bb2 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -27,3 +27,16 @@ export { MerklePath } from './merklePath'
export { Shift10 } from './shift10'
export { ArrayUtils } from './arrayUtils'
export { Schnorr } from './schnorr'
+export {
+ TxParser,
+ Output,
+ Input,
+ MAX_TX_INPUT_COUNT,
+ MAX_TX_OUTPUT_COUNT,
+} from './txParser'
+export {
+ TxParserBTC,
+ MAX_BTC_TX_INPUT_COUNT,
+ MAX_BTC_TX_OUTPUT_COUNT,
+ MAX_WITNESS_ITEM_COUNT,
+} from './txParserBTC'
diff --git a/src/txParser.ts b/src/txParser.ts
new file mode 100644
index 0000000..4847d73
--- /dev/null
+++ b/src/txParser.ts
@@ -0,0 +1,187 @@
+import {
+ prop,
+ method,
+ SmartContractLib,
+ FixedArray,
+ assert,
+ ByteString,
+ toByteString,
+ slice,
+ fill,
+ Utils,
+} from 'scrypt-ts'
+
+export interface Output {
+ satoshis: bigint
+ script: ByteString
+}
+
+export interface Input {
+ txId: ByteString
+ vout: bigint
+ scriptSig: ByteString
+ nSequence: bigint
+}
+
+export const MAX_TX_INPUT_COUNT = 5
+
+export const MAX_TX_OUTPUT_COUNT = 5
+
+export class TxParser extends SmartContractLib {
+ @prop()
+ buf: ByteString
+
+ @prop()
+ pos: bigint
+
+ @prop()
+ inputs: FixedArray
+
+ @prop()
+ outputs: FixedArray