JBaczuk / bitcoin-script-js

Bitcoin script interpreter written in javascript for browsers and node.js
MIT License
1 stars 1 forks source link

[WIP] Add utilities for opcode description and conversion #14

Closed wardlem closed 5 years ago

wardlem commented 5 years ago

Opcode description data can be scraped from the bitcoin.it wiki by running node script/scrape_opcode_info.js.

Needs tests.

JBaczuk commented 5 years ago

Oh interesting. I really like the detail for each opcode. One concern is that wiki can be updated by almost anyone, so tests would be good. Maybe we lock in the first version so we are alerted if anything changes. We could instead add this to the bscript-parser project and manage it as a module to this project. I'm fine either way a long as we lock in the opcode to bytes mapping.

wardlem commented 5 years ago

One concern is that wiki can be updated by almost anyone, so tests would be good.

This is true. This is also why the generated file is committed and only regenerated when we feel it is necessary. If the scraper code breaks we can simply not scrape until we fix it.

We could instead add this to the bscript-parser project and manage it as a module to this project.

I think this does belong as its own module that can be managed independently. Do you think it belongs with bscript-parser or its own, new module (i.e. bscript-opcode-info)?

JBaczuk commented 5 years ago

I think this does belong as its own module that can be managed independently. Do you think it belongs with bscript-parser or its own, new module (i.e. bscript-opcode-info)?

If it will overlap with the bscript-parser, I'd prefer it to be one module. The main point of the bscript-parser (maybe it's not a good name), is to translate between assembly and byte code. Maybe we should call it a bitcoin-script-assembler. Or create a new one. I don't know if the bscript-opcode-info would overlap here.

wardlem commented 5 years ago

If it will overlap with the bscript-parser, I'd prefer it to be one module.

It will partially overlap. I will close this PR and open one on bscript-parser