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
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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.

0
votes
0answers
9 views

Why does the Lightning RFC require that HTLC ouputs go through succes and timeout transactions?

BOLT 3 describes HTLC output scripts: (https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md#offered-htlc-outputs) The payment going to the owner of each commitment ...
1
vote
0answers
21 views

Segwit versioning limitations

Currently my understanding is that if new version of Segwit script is introduced, you are free to create whatever crazy rules you want there as long as they do not go against any valid consensus rules....
1
vote
1answer
96 views

what if a coin is spendable by multiple keys?

it seems like the scripting language could allow multiple private keys to spend a coin? what if i send a coin to someone, but also allow it to be spendable by me. would their wallet still show they ...
0
votes
1answer
41 views

Bitcoin's script expressivity

I'm conscious that Bitcoin's script is not turing complete, as multiple answers point out (e.g., this answer and this one). But I'm wondering if script can express the language of a PDA or ...
4
votes
1answer
56 views

Trying to get a deeper understanding of atomic swaps

I'm an IT-student and writing a thesis about atomic swaps on BTC and BTC-like blockchains. For the thesis I decided to use BTC, LTC, BCH and DCR. These chains have a somehow similar codebase and the ...
1
vote
1answer
30 views

Why is the output address a list in RPC/console?

Vout contains a list of addresses, which I noticed to be always with size = 1, if it exists. The following is an example from Bitcoin Testnet: { "value": 0.91840581, "n": 2, "...
7
votes
1answer
82 views

What's the use of not relaying non-standard transactions if anyone can still use them using P2SH?

It seems that non-standard transactions are not normally relayed because there is a concern this might break the network or it might make future upgrades harder. But anyone can use these non-standard ...
0
votes
0answers
24 views

Bitcoin transaction scripts : does ScriptSig or ScriptPubkey run first? [duplicate]

I'm confused as to the order regarding which script is run. For examples sake: say I want to spend 1 Bitcoin which was given to me by Alice in a single transaction of value 1 Bitcoin. I understand ...
0
votes
0answers
18 views

How can users verify bitcoin escrows, or any bitcoin smart contract?

Coming from an ethereum background, one can view a contract that you send ether to before you send it and verify that the logic works as advertised. How can bitcoin users do the same? Or am I ...
0
votes
2answers
125 views

P2SH signature verification in python

I am trying to understand and verify P2SH script by writing a python code to parse real transaction in blockchain. I have chosen below Transaction randomly. TxID: ...
5
votes
1answer
145 views

Bitcoin Script tutorial

Are there any tutorials with examples on Bitcoin Script: from basics to complex scripts?
9
votes
1answer
1k views

Is sha-1 used in Bitcoin?

The Bitcoin scripting language has OP_SHA1 as one of its opcodes. However, I'm not able to find any usage of this opcode (it is not used in any standard scripts nor in any other procedures such as ...
2
votes
1answer
51 views

Addresses field in ScriptPubkey

"txid": "055f9c6dc094cf21fa224e1eb4a54ee3cc44ae9daa8aa47f98df5c73c48997f9", "hash": "055f9c6dc094cf21fa224e1eb4a54ee3cc44ae9daa8aa47f98df5c73c48997f9", "version": 1, "size": 433, "vsize": 433, "...
0
votes
1answer
25 views

Why do I get 5 bytes worth of 0x00 hex values in both outputs?

From the hex generated by the createrawtransaction command, I understand that the following is the output value: ...
0
votes
2answers
27 views

Breaking down the hex value for output 1

Within the hex generated by createrawtransaction, I am trying to understand the output 1 hex. The output 1 hex I have is: 76a914ab68025513c3dbd2f7b92a94e0581f5d50f654e788ac Spacing out the ...
1
vote
0answers
56 views

Locktime requirement not satisfied when locktime set to 1 in p2sh

I've created the following script on testnet: OP_IF 2 <pubkey1> <pubkey2> <pubkey3> 3 OP_CHECKMULTISIG OP_ELSE 1 OP_CHECKSEQUENCEVERIFY OP_DROP <pubkey1&...
2
votes
1answer
55 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” ...
0
votes
1answer
33 views

Possible to check who signed the transaction in a multi-sig transaction case?

Say you have a multi-sig tx that originated from a 2-of-3 P2SH address. Is it possible to say who signed the transaction? i.e. you can get access to the redeem script once the tx is broadcasted, and ...
0
votes
1answer
55 views

Parse scripts to extract address [duplicate]

I want to parse a script with c++ to gain an output address from it. can anybody introduce a suitable library or a sample code which extract addresses from scripts ?
0
votes
1answer
40 views

Extract output address from raw script in bitcoin protocol

I'm working on bitcoin protocol and exactly i want to extract raw script from output script to gain address from tx messages. for common scripts, like scripts start with 0x76(means OP_DUP), we can ...
1
vote
1answer
41 views

unknown output script in a sample bitcoin pcap file

I start working on bitcoin protocol to extract output addresses from scripts in tx structures. Now in can produce some valid bitcoin address but some scripts are not familiar in op_code lists ...
0
votes
0answers
18 views

Script Mistake in Asymmetric Revocable Commitments [duplicate]

Disclaimer Please note that this is not a question on lightning network or on hash time lock contracts since those subjects come later in the book, so answers that relate to those subjects are not ...
1
vote
1answer
65 views

Bitcoin RIPEMD160 purpose

Bitcoin uses RIPEMD160 on top of SHA256. Is its sole purpose to make public key address shorter or does it strengthen security in any way?
5
votes
2answers
93 views

Getting Started With Script

I would like to manually write a few locking and unlocking scripts to get a deeper feel for that part of the network. What is the simplest step-by-step set of instructions to set up everything needed ...
2
votes
1answer
62 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. ...
0
votes
1answer
86 views

Electrum Gap Limit from CLI

Is there any way to change wallet gap limit in Electrum from command line? If yes, how? If not, could it be bypassed using some kind of external script? I really need to avoid GUI. Thank you in ...
1
vote
2answers
212 views

What redeem script is used in bitcoin core wallet when generate the address?

I'm trying to generate the address 38DGj87axzmQiZeAd1w1y5FEmuu5a7pfBa in my bitcoin core wallet with code. First, I dump the private key from the address, then I calculate the address from the ...
3
votes
1answer
52 views

Weird script stack entries at block #227837?

At block 227837 , the coinbase TX e35ca7413b61397a49551fea6ebb540988afcf4a2d0e750773d38eb11b138f40 has the following script: ...
1
vote
1answer
106 views

How does a P2SH script get executed?

I'm trying to visualize how a typical P2SH script gets executed, as I realize that it's a special form of script that gets executed slightly differently to a standard script. Before P2SH: Before ...
0
votes
1answer
39 views

Does bitcoin still concatenate the locking and unlocking script and execute?

Does bitcoin still concatenate the locking and unlocking scripts and execute in order to validate transaction or is validation done another way?
0
votes
1answer
26 views

How can OP_CHECKLOCKTIMEVERIFY be used to create outputs provably spendable by anyone?

While reading BIP 65 it says that op_checklocktimeverify can be used to create provably spendable outputs by anyone. How is this possible?
0
votes
0answers
24 views

How to create contracts using bitcoin?

Is there a way to create contracts with bitcoin such as allowing a transaction being funded by segwit outputs to be broadcasted only if the receiver signs it or only if the scriptsig contains a ...
0
votes
1answer
71 views

What does a coinbase output script look like?

What does a coinbase output script look like and how would it be used to fund a transaction?
1
vote
2answers
35 views

how to use multiple time specific address in input scripts with difference balances?

look at to the following transaction (withdraw transaction from binance) https://blockchain.info/tx/404fd22d3d88d129975d03fe2993f0126db8f066b3d8126d6cca676747439515?show_adv=true How in input scripts ...
1
vote
1answer
27 views

Bitcoin multisig contract - to Lock coins with nTimeLock (BIP65)

I really need help. I am currently Developing a Bitcoin wallet and want to build in a SMS Based send function where the sender does not need to know the receiver publicKey. After the contract get ...
2
votes
1answer
112 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> ...
0
votes
0answers
20 views

Valid p2sh transaction using only the redeem script

Is it possible to create a valid p2sh transaction using only the redeem script in the scriptsig and no signature?
1
vote
1answer
137 views

How to find out the requirements for spending an output script?

How do you find out the requirements to spend an output script? Do you decode the hash?
0
votes
0answers
27 views

How to create output scripts? [duplicate]

How are output scripts created and how can you create your own scripts or is this only possible through creating a transaction?
0
votes
0answers
34 views

P2sh transaction with non standard script

How can you relay a p2sh transaction with a non standard script, such as a scriptsig that only contains OP_True and get it mined? Example: https://blockchain.info/tx/...
0
votes
1answer
174 views

P2sh redeem script hash

What are the contents of a redeem script hash in a p2sh transaction? From what i read it's similar to the pubkey script but does it only contain the receiver's address?
1
vote
0answers
85 views

Is it possible to create a Dapp on top of Bitcoin?

Is it possible to create a dapp on top of bitcoin similar to how it can be done with ethereum? Can it be just as capable as ethereum?
1
vote
1answer
59 views

Ho to identify a multisig transaction?

79fbae117dc38effafb33304af83ce4894589747aee1ef992f63280567f52f5ba870678b4ab4ff6c8ea600bd217870a8b4f1f09f3a8e8353aeffffffff0130d90000000000001976a914569076ba39fc4ff6a2291d9ea9196d8c08f9c7ab88ac00000000 ...
1
vote
1answer
88 views

Why don't P2PK scripts have their own address?

If I understand addresses correctly, different types of addresses are used to map to a particular locking script (scriptPubKey). So based on the leading character of an address, a wallet will decode ...
1
vote
1answer
37 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
2answers
130 views

Does the alternative stack make Script Turing complete?

The wiki documents the presence of an "alt stack" in Script: OP_TOALTSTACK Puts the input onto the top of the alt stack. Removes it from the main stack. OP_FROMALTSTACK Puts the input onto the top of ...
0
votes
2answers
72 views

How is a transaction formated/signed?

Every transaction takes unspent outputs as inputs and creates new outputs. The creator of the transaction uses his private key to sign the transaction and nodes validate that transaction by using the ...
0
votes
2answers
54 views

Why is this script invalid, and how can I generate valid public key/digital signature pairs?

Why does the default P2PKH transaction at http://bitcoin-script-debugger.visvirial.com/ return NULL rather than true? I haven't tried to swallow the gory details of OP_CHECKSIG yet, but everything ...
0
votes
0answers
42 views

What does this elaborate output script mean? [duplicate]

Bitcoin transaction a214a2daf91691afdd491fd00d894eb3301e35bc18b5554b14e12843037e954c has an interesting output script: PUSHDATA(33)[...
1
vote
1answer
35 views

Can I use opcodes traditionally used for verifying keys to verify payment sizes?

Can I use binary opcodes usually used for verifying keys to verify payment sizes? It looks like these opcodes like OP_EQUALVERIFY and OP_NUMEQUALVERIFY are used for checking signatures or keys, ...