Coder Social home page Coder Social logo

btcscript's People

Contributors

0xmichalis avatar dajohi avatar davecgh avatar drahn avatar flammit avatar gsalgado avatar jimmysong avatar jongillham avatar jrick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

btcscript's Issues

Incompatible with App Engine due to go-spew.

btcscript uses go-spew (great name) for a variety of logging purposes.

Unfortunately go-spew uses unsafe which is not allowed by the App Engine runtime. Any idea how we can get around this and make btcscript compatible with App Engine?

Failed to process block 185117 on testnet

11:59:26 2014-02-19 [ERR] BMGR: Failed to process block 000000001881dccfeda317393c261f76d09e399e15e27d280e5368420f442632: validate of input 2 from transaction 7155ef87b3b794f5315770499945ddd535c873b9a2135a0eb1661b8904b66b25 failed: execute fail,
fail on stack (input script bytes 00250021024ab33c3a547a37293eb875b4bbdbd473e9d4bafdf35687e79744dcd70f6e4de251ae, prev output script bytes a9142c6b107fdf106f226f3fa327ba36d6e3cac73df087)

Mistake in isScriptHash?

Unless I am completely missing something, I think I have a problem with isScriptHash's implementation (https://github.com/conformal/btcscript/blob/5beafbd2d8be535c6a8f439b08d1c970da25b7bc/script.go#L247)

It checks if the script has a prefix of OP_HASH160 OP_DATA_20 OP_EQUAL while my understanding of P2SH transaction format is this: OP_HASH160 scriptHash OP_EQUAL. In fact, btcscript itself does this: https://github.com/conformal/btcscript/blob/5beafbd2d8be535c6a8f439b08d1c970da25b7bc/script.go#L1029-L1034

Feature request: Export parseScript and opcode fields

Thank you for creating and maintaining btcscript.
As far as I can see, there is currently no possibility for external packages to parse the bytes from btcwire.MsgTx.TxOut[i].PkScript to an array of opcodes. The function parseScript achieves that, but is not exported.
In order to further process the script it is necessary that the fields of opcode and parsedOpcode are accessible.
Example of what could be possible:

func printScriptPubkey(txOut *btcwire.TxOut) {
    scriptPubkey, _ := btcscript.ParseScript(txOut.PkScript)

    for _, op := range scriptPubkey {
        log.Println(op.Opcode.Name)
    }
}

make opcode internals public

Hey there,

I'd like to construct some custom scripts (functionality it's similar to PayToScriptHashScript(), but the payload is different).
Sadly, opcodemap and unparseScript are private.

Any chance of making those public?

Thanks

Failed to process block 96464 on testnet

[11:21:08 2013-10-07] [WRN] [CHAN] tx 1b8bb29b851c555d1f34ab61df8f910ea0fc60d09f66dd2c9b16464b8ae1c931 failed input 0, err Invalid Opcode
[11:21:08 2013-10-07] [ERR] [BTCD] [BMGR] Failed to process block 000000000017538a71d012de3a73fcc22415b2aabf7329133c0109aa0a75b4b4: Invalid Opcode

This is due to the fact that btcscript errors on scripts with invalid opcodes regardless of them being executed or not while bitcoind has rather "interesting" handling in that it doesn't explode on invalid opcodes unless they are executed. It doesn't seem like a particularly good idea to allow invalid opcodes in a transaction script regardless of them being executed or not, but to be compatible, the same behavior is required.

The relevant code from bitcoind is:

else if (fExec || (OP_IF <= opcode && opcode <= OP_ENDIF))
switch (opcode)
{

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.