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
1answer
18 views

One more question about scripting

Is it possible to write a script that would allow withdrawal of money only to a specific address? Is it possible to write a script that would allow withdrawal only specific amount? Any examples ? ...
1
vote
1answer
24 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 ...
0
votes
1answer
10 views

When do scripts executed?

Can anyone explain when does a script executed exactly? There are several information about "how scripts are executed" but no information about "when".
1
vote
2answers
72 views

What is the purpose of the script like RETURN PUSHDATA(36)(…)

The example is in here: https://www.blockchain.com/btc/tx/63910fdfa84db96bd1f28fead4c32f97388d5368c10059d035aac3c5f72fcdc0 Actually, there are two outputs DUP HASH160 PUSHDATA(20)[...
1
vote
1answer
70 views

Differentiating Output Script (scriptPubKey) Types

I am working on a little script to breakdown the data inside coinbase transactions. This is largely to improve my understanding of legacy and SegWit transactions (Given coinbase transactions have less ...
2
votes
1answer
43 views

How to let surplus go to fundraiser in ANYONECANPAY crowdfunding script?

ANYONECANPAY can be used for crowdfunding, where pledged donations cannot be spent unless funding goal/soft cap is reached. But since output is committed, when soft cap is exceed, all the surplus will ...
1
vote
2answers
101 views

Same seed from Electrum but generate different Bitcoin addresses

I am using Electrum 3.2.2, I have the wallet file generated from Electrum and a password to decrypt the file. There is an error whenever I am trying to send Bitcoin out of that wallet, so I decide to ...
1
vote
1answer
35 views

How OP_CHECKSIG knows the source of sig in pay to pubkey hash transaction

https://en.bitcoin.it/wiki/Script#Standard_Transaction_to_Bitcoin_address_.28pay-to-pubkey-hash.29 The last step of pay to pubkey hash transaction is to check the signature of the previous ...
0
votes
1answer
40 views

Differences/similarities of “Bitcoin script” and “Ethereum smart contract”?

Can we compare Bitcoin script and Ethereum smart contract ? And if yes, What are differences/similarities of Bitcoin script and Ethereum smart contract in sense of functionality, architecture and ...
0
votes
0answers
15 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
22 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
108 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
62 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
72 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
35 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
95 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
29 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
20 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
142 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: ...
6
votes
1answer
363 views

Bitcoin Script tutorial

Are there any tutorials with examples on Bitcoin Script: from basics to complex scripts?
10
votes
2answers
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
75 views

Addresses field in ScriptPubkey

"txid": "055f9c6dc094cf21fa224e1eb4a54ee3cc44ae9daa8aa47f98df5c73c48997f9", "hash": "055f9c6dc094cf21fa224e1eb4a54ee3cc44ae9daa8aa47f98df5c73c48997f9", "version": 1, "size": 433, "vsize": 433, "...
0
votes
1answer
26 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
29 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
83 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
86 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
51 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
67 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
52 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
50 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
19 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
79 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
112 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
79 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
120 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
354 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
55 views

Weird script stack entries at block #227837?

At block 227837 , the coinbase TX e35ca7413b61397a49551fea6ebb540988afcf4a2d0e750773d38eb11b138f40 has the following script: ...
2
votes
1answer
187 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
45 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
32 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
25 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
81 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
40 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
36 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
152 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
23 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
162 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
43 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
309 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?