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
0answers
487 views

How can I store a redeem script in my wallet?

Imagine that I wrote a redeem script. I calculated the related P2SH address, and sent some bitcoins to that address. In order to spend that bitcoins, I need to remember two things: The private keys ...
3
votes
0answers
512 views

Creation of P2SH MultiSig Input Script

In the createP2SHMultiSigInputScript() function of BitcoinJ according to this: public static Script createP2SHMultiSigInputScript(@NullableList signatures,Script multisigProgram) Create a program ...
3
votes
0answers
117 views

Any Innovations in altcoin tech for Bitcoin’s Script language?

Bitcoin’s Script is the forth-like, non-Turing complete language used for transactions. However, in practice, a very limited number of kinds of scripts are allowed, a number of opcodes have been ...
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 ...
2
votes
2answers
491 views

Operation not valid with the current stack size

According to bip65 https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki I can use expressions like IF ... ELSE ... ENDIF Here is example script from this document: IF HASH160 <...
2
votes
1answer
674 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 ...
2
votes
3answers
145 views

Could the standard pay to address script be simpler? e.g. no compare of the HASH160?

What if I had a scriptPubKey of <pubKey>OP_CHECKSIG And an scriptSig of <sig> Question Would that work in the standard client? Why do we need to check the hash? The only possible ...
2
votes
1answer
385 views

How do I fix my check-multisig if-else output script?

I'm trying to create a custom script with if/else and a multisig operation in one branch. Currently, my script looks thus: OP_IF <pub1> OP_CHECKSIG OP_ELSE OP_2 <pub2> ...
2
votes
2answers
368 views

Where is the code making OP_RETURN a standard transaction type?

I am looking through the bitcoin github history. I am trying to find the commit where OP_RETURN became accepted as a standard tx. This was included in the changelog for Bitcoin Core 0.90. Any help ...
2
votes
2answers
830 views

Multiple Addresses in one UTXO

The 'decoderawtransaction' RPC method of the Bitcoin-QT client gives a JSON object with an array of addresses in each UTXO. For example, when I run: decoderawtransaction "...
2
votes
2answers
687 views

Can Bitcoin scripting be used for double spending attacks?

A standard Bitcoin transaction deposits coins into an address and then, using Bitcoin's scripting language, states that whoever wants to spend this output must be in possess of the private key ...
2
votes
1answer
137 views

What happens if a P2SH redeem script is lost?

Assume Bob creates a complicated Bitcoin Script and asks Alice to make a payment to a hash of this script. (Using a P2SH transaction) If Bob loses the script (i.e. the source code of the script), is ...
2
votes
2answers
70 views

Given OP_VER was never used, is disabled and not considered useful can its meaning be stripped and it be made OP_SUCCESS?

Given OP_VER (0x62) was never used onchain, is disabled and is not considered useful can its meaning be stripped and it be made OP_SUCCESS for the purposes of introducing a new different opcode in ...
2
votes
2answers
147 views

Script Bitcoin represent number > 16

I'm studying Script language, but I don't understand How can I rappresent the number > 16, for instance 210 I want to do a simple sum OP_10 210 OP_ADD how I have to represent 210? I'm trying with ...
2
votes
2answers
173 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 ...
2
votes
1answer
862 views

Can a scriptPubKey have multiple addresses?

When working directly with bitcoind, I can getRawTransaction for any transaction in the network. The vout has multiple outgoing addresses usually which contain a scriptPubKey. The scriptPubKey has a ...
2
votes
1answer
184 views

How i can extract all bitcoin output addresses from tx message?

I want to extract output addresses from tx messages in any bitcoin pcap. currently, i extract tx messages which it's output script starts with "0x76" or "0xA9", but i don't know how can i extract the ...
2
votes
1answer
87 views

How to disassemble a bitcoin script?

There are many explorers which allows to dissamble a transaction back into opcodes. But what about scripts which aren’t broadcasted yet like this redeem script :...
2
votes
1answer
336 views

Addresses field in ScriptPubkey

"txid": "055f9c6dc094cf21fa224e1eb4a54ee3cc44ae9daa8aa47f98df5c73c48997f9", "hash": "055f9c6dc094cf21fa224e1eb4a54ee3cc44ae9daa8aa47f98df5c73c48997f9", "version": 1, "size": 433, "vsize": 433, "...
2
votes
1answer
168 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
1answer
68 views

Weird script stack entries at block #227837?

At block 227837 , the coinbase TX e35ca7413b61397a49551fea6ebb540988afcf4a2d0e750773d38eb11b138f40 has the following script: ...
2
votes
1answer
820 views

Constructing, signing, and pushing a Bitcoin transaction by using pybitcointools with Python

I'm utilizing the pybitcointools module in python 3.4 I've went through time and time again in the examples listed on the github page, but it isn't documented very well nor is the code. My situation ...
2
votes
2answers
370 views

Can new OP codes be added with a soft fork?

I understand that P2SH transaction types were added "softly" by repurposing a Tx message that is already valid, so old nodes won't reject them in blocks. Is there a similar method to adding new ...
2
votes
1answer
90 views

What are the requirements for a ScriptPubKey to be valid?

Can they have arbitrary scripts, as long as they are under a certain length?
2
votes
1answer
802 views

An explanation of transaction scripts

https://en.bitcoin.it/wiki/Script I'm trying to wrap my mind around them. Could anyone provide a bit more intuitive understanding?
2
votes
2answers
162 views

What does script operation “OP_IFDUP” do?

According to the wiki page, OP_IFDUP will duplicate the top of the stack "if the input is true or false". It seems to me that everything is true or false when interpreted as a boolean. According to ...
2
votes
1answer
157 views

Will any of the proposed Scripts (OP_XXX) allow subscription/recurring type payments?

Is it possible to implement a subscription/recurring payment type using Bitcoin scripts? For example, you could send a payment for a service where there is a monthly subscription say, and each month ...
2
votes
1answer
227 views

Script - OP_SIZE

Does the OP_SIZE operation in Script push one item onto the stack (length of the string), or two (string and its length)?
2
votes
1answer
124 views

Cant spend input with non-standart redeemscript (OP_CSV)

I'm playing with OP_CHECKSEQUENCEVERIFY. Here is my transaction that I'm trying to spend: https://tchain.btc.com/e79d469698915aa6724288ae3a4141a31706d081f39fb7fd0b956a73a9044b22 which has the ...
2
votes
1answer
202 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:...
2
votes
2answers
216 views

How is subscript computed for OP_CHECKMULTISIG?

I'm trying to learn the Bitcoin protocol by implementing it, and I've got OP_CHECKSIG working (following instructions in https://en.bitcoin.it/wiki/OP_CHECKSIG), but I can't get an transaction input ...
2
votes
2answers
632 views

Lightning close-channel transaction example?

From this article, I can understand that a punishment-based bidirectional payment channel (the type used by Lightning) would contain roughly this bitcoin script as one of the outputs: OP_IF “+7 days” ...
2
votes
2answers
105 views

Why we must reference the entire txid for each output we want to spend?

Suppose I want to spend from 3 unspent outputs. I must reference the txid of these unspent outputs. Suppose they are: eb36eca9a06fbe68278ad3e7d16d10ed02e22ad891ed59ef2b84ed4a49e8a6d2 ...
2
votes
1answer
688 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 ...
2
votes
1answer
535 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 ...
2
votes
1answer
168 views

Question regarding the number of bytes in an OP_RETURN transaction

I was reading this very useful explanation of what an OP_RETURN transaction looks like and got tripped up by part of it. "hex" : "6a13636861726c6579206c6f766573206865696469" This first ...
2
votes
1answer
176 views

Without using something like Bitcoin Script, how NEM verify the transaction?

From NEM's thread in bitcointalk, it mentions: NEM doesn’t use so-called “scripts” aka predicates. I understand how Bitcoin use the script to verify the transaction. May I know where I can read ...
2
votes
1answer
494 views

Why is the scriptPubKey required when using signrawtransaction?

The signrawtransaction rpc method calls for the following use: signrawtransaction "hexstring" ( [{"txid":"id","vout":n,"scriptPubKey":"hex","redeemScript":"hex"},...] ["privatekey1",...] sighashtype )...
2
votes
2answers
2k views

How much binary data (bytes) could I put in a transaction and how?

I know that some people had put text, pdf and images in the blockchain. I wonder which are the limits in order to have a minimum "bytes/btc" value in regarding the blockchain as a permanent database. ...
2
votes
2answers
671 views

Are there examples of scripthash transactions in the blockchain that do not use MultiSig destinations?

BIP 16 uses an example of a one signature required transaction as a scripthash example: scriptSig: [signature] {[pubkey] OP_CHECKSIG} scriptPubKey: OP_HASH160 [20-byte-hash of {[pubkey] OP_CHECKSIG} ]...
2
votes
1answer
163 views

Can the Bitcoin script make a Google search?

This very interesting CCN Money article states a script uses a data input such as a regular Google search to monitor real-world events that would automatically trigger disbursements or other ...
2
votes
3answers
317 views

Custom validation logic for transactions/ custom script extensions

Is it possible to add a hook for custom validation of transactions with a special script "tag" in them? If so, How? In essence, I want to add something similar in functionality to bitcoin script, but ...
2
votes
1answer
112 views

Finding Transactions with seldom used opcodes for testing

I'm trying to implement a script evaluator and would like to get some real testing data from the blockchain (testnet or mainnet). Are there transactions whose input scriptSigs combined with the ...
2
votes
1answer
74 views

How to calculate variable length fields?

Some parts of bitcoin tx Ex: Script are of variable length var_int. Can someone explain how to calculate its value from that var_int table. Ex: In the below tx, the bolded part is script-length. its ...
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 ...
2
votes
2answers
240 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?
2
votes
1answer
116 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, ...
2
votes
2answers
68 views

Save transaction space with economic Scripts

I have some questions regarding the programming of economic Scripts, so Scripts that save some transaction space compared to functionally the same Scripts but with redundancy by e.g. using the same ...
2
votes
1answer
97 views

Is it possible to copy other scriptSig for using in different transaction?

To use a UTXO one must supply correct scriptSig or "unlocking script" to the given scriptPubKey "lock script", I know the scriptSig in PTPKH locking is sig and pubkey. My question is what makes the ...
2
votes
1answer
195 views

Bitcoin payout based on real-life event

Just starting to learn bitcoin scripting. Can someone explain how to pay out based on some real-life event? I currently test from the command line with bitcoind -regtest

1 2 3
4
5
9