Questions tagged [script]

This tag should be used for questions regarding Bitcoin transaction scripts or scripting languages used in transactions of altcoins such as Solidity. Scripts are a set of instructions on how to complete a transaction.

Filter by
Sorted by
Tagged with
3
votes
2answers
88 views

Is it possible to make an output only spendable to a specific address?

Basically, the entire question fits into the title. Does the Bitcoin scripting language allow for a transaction output to only be spendable to a specific address? Is it possible to forbid all other ...
0
votes
0answers
443 views

Error: mandatory-script-verify-flag-failed

I have created a raw transaction from myElectrum wallet, but when I try to broadcast it I get this error: mandatory-script-verify-flag-failed Why is this happening? The transaction is below: ...
1
vote
1answer
418 views
17
votes
3answers
2k views

Will general non-standard transactions ever be allowed?

To the best of my knowledge, currently "Satoshi" client relays and most pools accept only standard (transfer or generation) transactions. Besides, community is working on M-of-N transaction type. ...
0
votes
2answers
377 views

Creating an OP_CSV transaction with bitcoinjs

I'm working on a tool for timelocked contract generation. My redeem script looks like so: OP_HASH160 <revocationHash> OP_EQUAL OP_IF <bobPubKey> OP_ELSE <timeDelay> ...
0
votes
1answer
324 views

How secure is bitcoin private key generated by this script? [closed]

I found this python script on github. It generates a pair of bitcoin private key and address. I know the private key may be vulnerable if it is created insecurely. I don't have much knowledge ...
6
votes
2answers
571 views

Which bitcoin script forms should be detected when tracking wallet balance?

I am implementing a library for tracking wallet balance of given bitcoin addresses. How should the transaction output script be parsed to find if the output belongs to the given address? Is it dirty ...
14
votes
3answers
4k views

The Bitcoin scripting system is purposefully not Turing-complete - why?

Can somebody explain to me why the Bitcoin scripting system is purposefully not Turing-complete? To make malicious programs difficult to develop (I guess)? Or because it was difficult to make it ...
1
vote
1answer
130 views

Why does this script return an error ?

I'm trying to understand how Script validates transactions. I have taken this transaction as an example 55e5bbdba33050bbe6584e896b4a20575cf3fe3f29114467f17f67f6b172eb73 When showing the scripts, we ...
2
votes
2answers
170 views

Mastering Bitcoin: Advanced Scripting Question

At the end of Mastering Bitcoin Chapter 7. https://github.com/bitcoinbook/bitcoinbook/blob/second_edition/ch07.asciidoc#complex-script-example They ask this question in regards to the script: How do ...
15
votes
2answers
3k views

How to create a transaction with a custom script?

Is there a step-by-step tutorial or any documentation covering how to create a transaction that is not a standard OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG? It seems very odd ...
1
vote
1answer
119 views

Where to find the sighash type?

Where can I find the sighash type specified in a script? Is it included in the scriptsig?
1
vote
1answer
573 views

How do I print unspent transaction outputs of an address using pybitcointools

I am a beginner looking to write a simple program that takes an input (address) and prints the unspent amount in it. I copied some code from chapter 4 of Mastering Bitcoin to generate a random ...
2
votes
1answer
622 views

Multiple input/output transactions using golang btcd

I am using golang's btcd as a basis for creating some server-side tools for handling transactions. I found a good example for creating a basic one-input-one-output transaction to get me started on the ...
0
votes
1answer
2k views

Signature verification in python

When trying to implement OP_CHECKSIG, I am unable to figure out how to do the actual signature verification in python (python3) I obtained the signature, public key, and hashed message digest of a ...
8
votes
2answers
2k views

Different error messages under “Mandatory script verify flag failed.”

I've been playing with raw transactions and signed transaction and I've noticed that the error "Mandatory script verify flag failed" comes in two variations. script failed on OP_EQUALVERIFY OP Script ...
0
votes
3answers
2k views

What is wrong with my ScriptSig? I get 64: scriptsig-not-pushonly

I currently try to create and sign transaction from scratch. I made it to construct and sign a transaction. If I verify it manually it looks good but using a "proper" wallet my transaction is refused: ...
1
vote
1answer
617 views

How to restore redeem script from a spent transaction?

What is the procedure to restore redeem script of P2SH address from a transaction sent from that address? The script is stored on the blockchain in the tx data, the question is how to extract it?
2
votes
2answers
230 views

Why are there so many opcodes in Bitcoin Script, but they are not usable

In my understanding, miners wont accept non standard scripts. Then why are there several opcodes which cannot be used in custom scripts because they are nonstandard?
1
vote
1answer
205 views

OP_ADD operation in bitcoin script for integers greater than 128 in java

I want to execute a simple series of instructions to implement a bitcoin script in java using bitcoinj API. All I am looking for is performing arithmetic operations for negative integers or integers ...
1
vote
2answers
922 views

Convert plaintext script into hex-encoded script in python

I'm creating a program (for an altcoin I'm developing) that should make it easy to create OP_RETURN transactions. Currently I'm having some trouble with actually creating the script pythonically (I ...
1
vote
1answer
482 views

Bitcoin core multisig signing order

I have a technical question regarding the signrawtransaction function in Bitcoin core when signing a partially-signed transaction. I have tested different scenarios and signrawtransaction will always ...
2
votes
1answer
126 views

How can blockchain.info show the output address of a transaction when the output address has never been used in any other transaction?

I've stumbled across a transition on blockchain.info where the output address was displayed even though the output address had never been used in any other transaction. How can blockchain.info know ...
0
votes
1answer
70 views

Why there are no OP_CODEs for querying the blockchain and retrieving data to the stack?

Blockchain data is immutable, so once valid a transaction will always be valid and full nodes can verify it.
5
votes
1answer
215 views

ScriptSig content during signature (quadratic hashing)

As far as I know, the quadratic hashing problem came from the fact that every time a transaction is verified (or signed), the "unsigned transaction" that is hashed and verified changes depending on ...
9
votes
1answer
1k views

How is a “standard” Bitcoin transaction defined?

This is useful in Andreas Antonopoulos' book, Mastering Bitcoin: https://github.com/bitcoinbook/bitcoinbook/blob/7c552ea5cfbc19448635b36407761b377ff5cbe9/ch05.asciidoc#standard-transactions "In the ...
1
vote
1answer
983 views

Spending transaction with custom output

I've recently entered the bitcoin arena, and bitcoinj was my tool choice. Experimenting on regression test mode, I was able to create the following custom transaction. It has a modified locking script ...
0
votes
1answer
356 views

Why is using a simple SHA1 in a scriptPubKey to emulate a “password” a security problem?

I'm independently working my way through an excellent online course on bitcoin, made available from Stanford. (https://crypto.stanford.edu/cs251). One of the problems in the homework challenges the ...
3
votes
1answer
942 views

Missing public key in transaction input

I'm in the process of understanding scriptSigs of transaction inputs and encountered some transactions with inputs that seem to be missing a public key. This is what I expect to see as a scriptSig. A ...
9
votes
2answers
2k views

What is OP_CODESEPARATOR used for?

Looking at the bitcoin source (https://github.com/bitcoin/bitcoin/blob/v0.9.3/src/script.cpp#L843-L847, specifically), I ran into the the use of the OP_CODESEPARATOR. Am I right in interpreting this ...
2
votes
1answer
600 views

How to tell which part of the previous tx I need to make the hash to sign for an old given tx?

I have recently been taught (here) how to create the hash to sign for a given "input script" for an existing transaction. I then sought to test my abilities and sought out a difficult transaction to ...
2
votes
3answers
3k views

What are the parts of a Bitcoin Transaction “Input” script?

All the terminologies I find seem rather confusing about what explains what and they usually miss a few steps. Example: Transaction 82d62d5f4e69ae8338c39b7ae2e1d33db59bdf62c869ded7344adc936bab8653 ...
1
vote
1answer
840 views

Why are Virtual Machines used in Ethereum?

I'm wondering why the Ethereum Virtual Machine (EVM) is used? What if they didn't use it? Why don't we have them in Bitcoin?
1
vote
3answers
526 views

OP_HASH160 and number of bytes of public key

When creating a raw transaction, why after the OP_HASH160 the number of bytes of the hashed public key should be included if it's always 20 bytes (that's what RIPEMD160 throws)? Does this happen with ...
1
vote
1answer
119 views

Create an arbitrary script with two locktimes and p2sh

Alice, Bob and Carol create a p2sh address that initially requires 3/3 signatures. After some time (lock1 using OP_CHECKLOCKTIMEVERIFY) only Alice and Carol can spend and Bob is permanently forgot. ...
0
votes
1answer
129 views

How many IF/ELSE/ENDIF can be used in a script?

Besides the 520 bytes consensus rule limit, is there a limit on how many of each OP_IF, OP_ELSE and OP_ENDIF can be used in a single script? For example, a company that has 3 people in its purchase ...
0
votes
1answer
48 views

Is there a limit in bits for the data hashed in hash-locked script?

What is the limit in bits for the plain-text data of a secret (the data that it is actually hashed and used in a script) in a hash locked contract?
1
vote
4answers
2k views

Generate and push raw Bitcoin transaction

When I try to push a raw Bitcoin transaction via the blockchain.info API I get the following error message: Script resulted in a non-true stack: [] Transaction should send 0.001 Bitcoins with a 0....
0
votes
2answers
684 views

SegWit witness commitment merkle root location

BIP 141 defines the commitment structure here What i am unsure about is the location of this data. I know it will be in scriptPubKey. Does this mean Coinbase tx will have more than one output? Also is ...
0
votes
1answer
844 views

Unspendable outputs vs Black Hole address

On the Script page of the Bitcoin Wiki, in the "Provably Unspendable/Prunable Outputs" section, it gives an example of a script which would make that output of the transaction unspendable. In the ...
1
vote
1answer
147 views

SIGHASH_SINGLE vbuterin/pybitcointools

Checking the implementation of Buterin's bitcoin tools I've noticed something strange. According to the Bitcoin developers guide, sighash_single signs only the outputs that match the input where the ...
0
votes
3answers
161 views

Multisig address for website?

I am trying to sort out the use case of a published funding address on a web page, to which everyone can spend. Internally in our company, I want to avoid, that a single person can spend these funds. ...
1
vote
1answer
345 views

Hex to ASCII conversion of output scripts generates unexpected characters

Embedded in this transaction, there is a blockchain file upload tool written in Python. I'm trying to convert the hex of the output scripts to ASCII, so I can assemble it all into an actual runnable ...
1
vote
1answer
452 views

ScriptSig field during P2PKH transaction signature

In P2PKH transactions, the content after signing the transaction contains: <signature(with hash_flag)><public_key>. However, since the signature can't sign itself, during the signature ...
0
votes
1answer
132 views

Untypical input script

There are many untypical Input script data in blockchain. What does it mean? For example, transaction: 4A253F17E5F4B24B41F72A6AE46DD1BCB25F7F33769C2AA5D50C6A6A7CF9F76E (link) has it's input script: ...
2
votes
1answer
113 views

CHECKMULTISIGVERIFY with public key hashes?

Is it possible to create a script that implements m of n pay to public key hash neatly? One way to do it would be to make use of OP_IF. But, that's not neat. CHECKMULTISIGVERIFY can implement m of n, ...
4
votes
1answer
5k views

How to get address from scriptSig?

I'm looking for a way to get address from scriptSig. I want to know input address. Can you share how to do it? I prefer PHP library but any ways would be appreciated. e.g. I use bitwasp, a PHP ...
3
votes
2answers
128 views

What are concrete uses of Bitcoin script?

I am looking at solutions to simplify the architecture of Bitcoin from a more theoretical perspective. I am thinking about removing Bitcoin script, however I am not sure what restrictions this ...
4
votes
1answer
288 views

state of 'atomic cross-chain trading' in 2016

Much of the information I've come across is a bit dated, 2 years or so. For instance, this other question, this thread on the forum. It seems like Interledger is trying to implement, more or less, ...
1
vote
1answer
174 views

Do HTLC transactions work today or do they need a new soft-fork?

I thought that HTLCs was just a kind of a script construct that would allow to unlock funds for a period of time, which can be unlocked to anyone that provides the original string that matches the ...