Questions tagged [script]
A simple, stack-based, Forth-like programming language using "opcodes" to express spending conditions.
117
questions
64
votes
4
answers
40k
views
Explanation of what an OP_RETURN transaction looks like
How is OP_RETURN used and why was it introduced in the first place?
16
votes
3
answers
1k
views
What does Bitcoin policy language offer the developer that Miniscript doesn't? What is the difference between Bitcoin policy language and Miniscript?
I understand that policy language compiles to Miniscript and Miniscript is encoded (correction) to Bitcoin Script. This is also a great resource on Miniscript: http://bitcoin.sipa.be/miniscript/ But I ...
4
votes
3
answers
1k
views
Why does Bitcoin uses a Script language?
From what I heard is that Bitcoin use Script to verify transactions (I'm probably wrong).
Wouldn't be sufficient just signing the transaction with the private key and append the signature to the ...
16
votes
3
answers
5k
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 ...
9
votes
1
answer
4k
views
Why does the default miner implementation use pay-to-pubkey?
Looking at the v0.9.3 source in miner.cpp:
CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey)
{
CPubKey pubkey;
if (!reservekey.GetReservedKey(pubkey))
return NULL;
...
8
votes
2
answers
853
views
Bitcoin and Smart Contracts
I have recently come across the features of ethereum and the idea of smart contracts.
I like the concept of smart contracts however as a currency, I much prefer the bitcoin to the ether.
Is there ...
61
votes
6
answers
26k
views
What is relation between scriptSig and scriptPubKey?
Scenario: A is sending 1 BTC to B.
scriptSig appears in the Input Script.
scriptSig = <sig> <pubKey>
Here, public key is the Public Key of the sender, A. (this is the public key ...
24
votes
1
answer
4k
views
How do Scripts work?
Bitcoin protocol supports scripts.
How do they work?
How are those implemented?
What are their intended usages?
When are they planned to be used?
10
votes
3
answers
8k
views
parsing bitcoin input and output addresses from scripts
can someone walk me through the process of combining script inputs and outputs to reveal the base58 encoded input and output addresses. take for example, block 728. this has two raw script inputs:
...
25
votes
2
answers
4k
views
Useful alternative Bitcoin transaction scripts
The Bitcoin wiki describes a transaction's script as something that describes "how the next person wanting to spend the Bitcoins being transferred can gain access to them".
The script for "a typical ...
16
votes
2
answers
19k
views
What is "Script Hash" address exactly and how does it work?
I found out this address playing with blockchain
https://blockchain.info/address/3NukJ6fYZJ5Kk8bPjycAnruZkE5Q7UW7i8
I found out it's something called "scripthash". How does it work exactly? How does ...
11
votes
1
answer
2k
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 ...
16
votes
2
answers
1k
views
Transaction with slightly changed script is never relayed
I am playing with bitcoin transaction a bit now.
I have a question. Normally, the output script looks like
OP_DUP OP_HASH160 (hash) OP_EQUALVERIFY OP_CHECKSIG
Now that is understandable. However, ...
12
votes
3
answers
3k
views
Why is OP_CHECKLOCKTIMEVERIFY disabled by maximum sequence number?
In the code for OP_CHECKLOCKTIMEVERIFY i noticed that if the txin sequence number is maxxed out then the script will fail to validate. I'm wondering what the point of this is? Why would anybody ever ...
8
votes
1
answer
6k
views
How is a Transaction ID generated & when does it change? (with a new sequence ID?)
I'm creating a non-mainstream client that processes and validates Bitcoin transactions and need to track transactions in my database.
How is the TxID generated and when does it change?
...
7
votes
3
answers
7k
views
How to know if a transaction is valid?
I understand there are a couple things that need to be checked for a transaction to be valid - the previous transaction had to be correct, no OP can invalidate the transaction, etc, but is there a ...
5
votes
2
answers
1k
views
What does this transaction script mean?
I was looking for scripts on the blockchain to test my program, and I encountered a weird scriptPubKey in this tx that I couldn't understand.
The opcodes are
pk1 = ...
4
votes
3
answers
4k
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
1
answer
390
views
scriptcode, scriptsig, pubkeyscript confusion
I've been banging my head on a desk for a few days trying to understand the segwit protocol properly.
Another roadblock has thrown me off-guard and I am struggling to grasp the concept of "scriptCode:...
3
votes
2
answers
1k
views
Non-standard transaction scripts broadcasting
I'm developing an application on Bitcoin blockchain, and I use output transaction scripts that are not standard according to the classic payment methods.
However, even so, on Tesnet everything works ...
2
votes
1
answer
260
views
Extract lightning network funding transactions with python bitcoin blockchain parser lib
My ultimate goal is to parse funding transactions (as well as channel closes in a later step) from the blockchain. In order to do so I wanted to start with a funding transaction and disect it. ...
2
votes
2
answers
2k
views
How do I extract the address from a scriptPubKey?
I am creating a block parser and just learned about Scripts in Bitcoin yesterday which is kind of confusing so far. I want to extract the addresses involved in each transaction. Right now, I am able ...
23
votes
10
answers
8k
views
Online Bitcoin Script simulator or debugger?
Is there an online simulator that would allow me to step through, debug, or simulate the execution of a Bitcoin script?
19
votes
3
answers
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. ...
17
votes
2
answers
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 ...
12
votes
1
answer
743
views
Why is OP_SUBSTR disabled? (and OP_LEFT, OP_RIGHT)
Why are the substring opcodes disabled?
I understand that OP_CAT is disabled because it can blow up the stack easily (in combination with OP_DUP).
But the substring opcodes reduce the stack size.
...
12
votes
2
answers
4k
views
Is there a maximum size of a scriptSig/scriptPubKey?
Previous research:
Transaction's maximum size
What is the maximum size of a transaction?
The maximum size of a standard transaction is 100k bytes.
Are there any consensus rules that prohibit ...
11
votes
2
answers
3k
views
How to get addresses from scriptPubKey in segwit transactions?
I'm running through raw transaction data, and I'd like to be able to gather addresses (where possible).
So far, I've made this diagram to help me understand when it's possible to figure out addresses ...
10
votes
2
answers
5k
views
CHECKMULTISIG a worked out example
I was wondering if somebody could point me to or give me a worked out example of how OP_CHECKMULTISIG works behind the curtains?
I expect that CHECKMULTISIG will call the CHECKSIG function and ...
9
votes
4
answers
1k
views
Is there a listing of strange or unusual scripts found in transactions?
I'm studying scripts and am looking for strange or unusual scripts that have appeared in any of the *coin networks..(outside the standard ones listed on this page)
Is any one person, or website ...
8
votes
2
answers
3k
views
What is the format of coinbase input scripts?
The input script of the coinbase transaction of block number 1 (right after the genesis block) looks like this: 04ffff001d010b
How do I recognize this as a coinbase transaction?
Do I simply know ...
6
votes
2
answers
906
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 ...
5
votes
1
answer
1k
views
How is the hash that is signed calculated?
I'm a bit confused about the signature contained in the scriptSig of a transaction. My question is: what do we really sign? Is it the hash of the previous transaction?
5
votes
3
answers
561
views
Are loans with enforced repayment possible on the blockchain?
Are loans with interest possible in Bitcoin, such that repayment is enforceably encoded with Bitcoin Script on the blockchain from the establishment of the lending contract?
5
votes
1
answer
349
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 ...
5
votes
3
answers
347
views
Can Scripts be used to implement Chargebacks?
I went ahead and wrote this semi-detailed post about how to implement Chargebacks, when I hit my head and said "Doh, maybe this can just be implemented more cleanly with Scripts".
So ... is there a ...
4
votes
2
answers
372
views
Which scripts are currently considered standard and therefore actually propagated?
All I've learned about script so far is that while theoretically quite versatile (e.g. allowing multisignature transactions) most scripts are simply not propagated by the default client nodes, i.e. ...
3
votes
1
answer
2k
views
Redeem script. script hash, witness script and witness program
I have a little confusion about naming in Bitcoin.
Redeem script is the conditions that will be satisfy.
For example P2PKH inside P2SH
OP_DUP OP_HASH160 <PubKHash> OP_EQUALVERIFY OP_CHECKSIG ...
3
votes
1
answer
273
views
Create Custom script from bitcoind
I'm able to create multisig with bitcoin-cli with addmultisigaddress
bitcoin-cli addmultisigaddress 2 '["'$ADDR_MITT_1'","'$ADDR_MITT_2'","'$ADDR_MITT_3'"]'
But How can I add extra OP like CLTV or ...
3
votes
1
answer
194
views
For a redeem script to satisfy the conditions of a script what must it leave on the stack post execution?
I was watching this Andreas Antonopoulos presentation on Advanced Bitcoin Scripting.
It appears from Andreas' examples that for a redeem script to satisfy the conditions of the script it needs to ...
2
votes
1
answer
805
views
What are the scriptPubKey, scriptSig, redeem script and witness for the various output types?
scriptPubKey, redeem script, witness script, witness program are defined in this StackExchange post.
What are the scriptPubKey, scriptSig, redeem script and witness for the various output types (P2PKH,...
2
votes
1
answer
938
views
How to create a p2sh transaction with a scriptsig of OP_true?
How can I create a p2sh transaction with a scriptsig containing OP_TRUE only, removing the need for a digital signature, which will be broadcasted and mined?
Also could some one provide an example of ...
2
votes
1
answer
96
views
What is the relationship between the Minsc language and Policy language?
Quoting from the Minsc website "Minsc is a high-level scripting language...based on the Miniscript Policy language with additional features and syntactic sugar sprinkled on top including ...
2
votes
2
answers
611
views
What node implementations and mining pools relay and process 'non-standard' scripts?
Which Bitcoin node implementations, if any, currently relay valid transactions that use so-called 'non-standard' scripts? What proportion of the network is made up of these implementations? What ...
2
votes
1
answer
1k
views
what is the use of OP_PUSHBYTES
what is the meaning of this SCRIPTPUBKEY:
OP_DUP OP_HASH160 OP_PUSHBYTES_20 xxxxx....xxxxxxxx OP_EQUALVERIFY OP_CHECKSIG
in particular I searched for some documentation on OP_PUSHBYTES_X which only ...
2
votes
3
answers
3k
views
Will BTC script be Turing complete in future?
I want to know if BTC script will have loops in it in the future?
1
vote
1
answer
2k
views
Walking through a transaction script
As an example, I would like to consider this transaction: https://blockchain.info/tx/6f7cf9580f1c2dfb3c4d5d043cdbb128c640e3f20161245aa7372e9666168516
I have three questions:
1) The first two entries ...
1
vote
1
answer
358
views
Taproot - Eliminating Key Path
I want to struct a transaction output the key-path of which I want to be eliminated, so enforcing only the script path. In order to eliminate key-path, in my opinion, I should set "Internal ...
0
votes
1
answer
280
views
Transaction still unspendable with CLTV
Previously I generated tx with CHECKLOCKTIMEVERIFY
Here is the transaction https://tchain.btc.com/bb1415c166fd9f767c06d34d539f4b110ef4445f74a76c5ffad1ded33032e872
It lock funds before block 1442909.
...
13
votes
0
answers
206
views
What prior work influenced the design of the Bitcoin instruction set?
The "Script" system used by Bitcoin transactions is commonly described as a Forth-like, stack-based language.
What prior work influenced the design and layout of the Script instruction set?
...