Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
2answers
131 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 ...
1
vote
1answer
102 views

Where to find the sighash type?

Where can I find the sighash type specified in a script? Is it included in the scriptsig?
2
votes
1answer
455 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
1k 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 ...
0
votes
2answers
270 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> ...
1
vote
1answer
338 views

Why does the Genesis block coinbase input script push bits and the value 0x04 before the famous “Chancellor” message?

According to the Wiki, the input script of the Genesis block consists of these bytes: ...
1
vote
1answer
450 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?
1
vote
1answer
152 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 ...
3
votes
1answer
376 views

Why does pay to pubkey hash contain OP_CHECKSIG at the end instead of beginning?

According to the bitcoin wiki, the most common form of transaction (pay-to-pubkey-hash) looks like this: scriptPubKey: OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG scriptSig: <...
1
vote
2answers
609 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
301 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
119 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 ...
1
vote
2answers
114 views

Bitcoin library vs script to develop application

I'm curious about the development of application of Identity management in Blockchain platform, but I'm a bit confused about the technologies to use. In short words, when is more convenient to ...
0
votes
3answers
1k 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: ...
0
votes
1answer
65 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.
0
votes
2answers
61 views

Upper bound on transaction confirmation time

Today I saw a case where a transaction had a very low fee, so it got stuck in the mempool for days. The original wallet refused to allow a new transaction to be created with the same input, and in a ...
1
vote
2answers
194 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?
0
votes
1answer
174 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
720 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 ...
3
votes
1answer
266 views

What is 'ScriptCode'?

I don't understand what the 'ScriptCode' thing is. Is it a part of transaction format? The wiki https://en.bitcoin.it/wiki/Transaction describes scriptPubKey and scriptSig, mentioning nothing about '...
2
votes
2answers
799 views

How does P2SH unlocking work?

"Mastering Bitcoin" by Antonopoulos in its P2SH section describes how the unlocking and locking scripts are executed and evaluated by nodes. The author gives this as example of an unlocking script: &...
2
votes
1answer
418 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 ...
0
votes
1answer
105 views

How would one go about acquiring the HashofThingtoSign from this old transaction?

How would one go about acquiring the HashofThingToSign that is used in the "Signature Generation" equation for this example transaction such that it could easily also be applied to any other given pre-...
2
votes
3answers
2k 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 ...
3
votes
1answer
514 views

Verifying a P2SH transaction script by hand. How should I concatenate OP CODES in order to hash the script?

I'm reading this: Transaction 40eee3ae1760e3a8532263678cdf64569e6ad06abc133af64f735e52562bccc8 paid to P2SH address 3P14159f73E4gFr7JterCCQh9QjiTjiZrG. You can see the redeem script in ...
1
vote
1answer
627 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
1answer
371 views

what is the difference between OP_CHECKMULTISIG and OP_CHECKMULTISIGVERIFY

I would like to learn the difference, explained as simple as possible, between OP_CHECKMULTISIG / OP_CHECKMULTISIGVERIFY and OP_CHECKSIG / OP_CHECKSIGVERIFY. The only explanation I found is: Same as ...
1
vote
3answers
345 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
94 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
93 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
46 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?
0
votes
0answers
100 views

How to automatically reveal the secret after some tine in a hash locked transaction

In a hash locked transaction like this (Alice generates secret and hashes it): IF 2 <Alice key> <Bob key> 2 CHECKMULTISIGVERIFY ELSE <Bob key> CHECKSIGVERIFY SHA256 <...
0
votes
2answers
579 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
612 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 ...
4
votes
1answer
166 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 ...
2
votes
1answer
107 views

What is the point of including the scriptCode of the input in the transaction digest of segwit?

BIP143 specifies "a new transaction digest algorithm". scriptCode of the input (serialized as scripts inside CTxOuts) What problems could arise if the scriptCode of the input were not ...
0
votes
3answers
137 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
388 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 ...
9
votes
1answer
805 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 ...
0
votes
1answer
127 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: ...
3
votes
1answer
101 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
4k 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 ...
0
votes
0answers
152 views

Non-standard transactions

Can somebody explain me the following question: What is the available scripting language for non-standard transactions in Bitcoin?
3
votes
2answers
112 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 ...
1
vote
1answer
261 views

What informations are contained in a transaction?

According to the informations that i found here: https://en.bitcoin.it/wiki/Transaction a bitcoin transaction contains, FOR EVERY INPUT: The Hash of the incoming transaction ScriptSig FOR EVERY ...
0
votes
1answer
284 views

How to get asm and hex from vout

I've got this weird string for a utx message (not my code) CTransaction(nVersion=1 vin=[CTxIn(prevout=COutPoint(hash=41caa5bf2b814135257b26e44b111f55c067f783e3cdf9bdf914e1ef7e403d05 n=0) scriptSig=...
1
vote
0answers
65 views

get utx scriptPubKey to become an object

I'm using this python script https://github.com/sebicas/bitcoin-sniffer When I see a utx I look at each output and find the scriptPubKey I expected to see something like "scriptPubKey": { "asm": ...
1
vote
1answer
135 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 ...
4
votes
2answers
337 views

Multi-signature public key validation

In a pay 2 script hash transaction, does the redeem script get checked for valid public keys before a transaction can be signed? I have noticed that if I have a redeem script with one invalid pubkey ...
1
vote
1answer
147 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 ...