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
42 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 ...
4
votes
1answer
36 views

Is the bit encoding format for the graphic in BIP 68 implicitly little-endian?

CLTV (OP_CHECKLOCKTIMEVERIFY - absolute locktime) and CSV (OP_CHECKSEQUENCEVERIFY - relative locktime) utilize BIP 68. Is the locktime for those two operations implicitly encoded in little-endian ...
1
vote
1answer
30 views

Maximum standard input script size

What is the maximum size for an input script so to be considered standard ? Looking at the Bitcoin Core source code it appears to be 10'000 byte, however reading here and there, it appears to be 1650 ...
2
votes
2answers
218 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 ...
9
votes
1answer
3k 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; ...
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
votes
0answers
28 views

BitcoinJ manually sign P2SH output

I'm trying to create, with BitcoinJ, something similar as the one stated in BIP16: scriptSig: [signature] {[pubkey] OP_CHECKSIG} scriptPubKey: OP_HASH160 [20-byte-hash of {[pubkey] OP_CHECKSIG} ] ...
1
vote
2answers
80 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 ...
1
vote
1answer
34 views

What is the meaning of in-script and out-script in standard bitcoin transaction?

I am new to bitcoin world and I am reading this paper: Secure multiparty computations on Bitcoin https://eprint.iacr.org/2013/784.pdf The author said on page 7 that the standard bitcoin transaction ...
1
vote
2answers
31 views

Valid public key check in transaction output

Let's say I build a P2MS output script using uncompressed public keys, and let's say too that these public keys are not valid, i.e. they do not represent a valid EC Point and they don't start with ...
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
1answer
84 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 ...
2
votes
1answer
204 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
42 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. ...
0
votes
1answer
56 views

Create simple and secure transaction without checksig?

According to my previously asked question (P2SH secure spending. How?) creating transactions without signature checking is probably not secure. Anyway, I see many transactions (for ex.:...
0
votes
1answer
47 views

Diferent redeemscript for the same scriptpubkey?

Most transactions to p2sh address has the follwing scriptpubkey HASH160 f45d94733d430261962932e0c847075195916a04 OP_EQUAL As I understood, this transaction do not need to be signed. Is it true? ...
0
votes
1answer
474 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?
0
votes
2answers
34 views

In theory could a pubkeyhash script be solved without the public key in the scriptSig?

When signing a pubkeyhash UTXO, it is required to provide both a signature and a public key. The public key is duplicated and one copy is provided to op_checksigverify to ensure the signature is valid,...
2
votes
1answer
54 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
1answer
25 views

Script - Is it possible to build an addresss that allows retrieve a certain amount per address?

Is it possible to define a multi signature address that allows spending only certain percentage to each signature? For example, three different people with different public-private keys build an pay ...
1
vote
2answers
88 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 <...
1
vote
1answer
61 views

Why this transaction is invalid?

I issued this transaction on testnet (for a homework later solved with another script). python-bitcoinlib validates the transaction but when i submit it to blockcypher it gets rejected with error: {"...
1
vote
1answer
68 views

MULTISIG Verified transaction don't get mined on testnet

I'm trying to check the following simple MULTISIG P2SH script on bitcoin testnet (using python-bitcoinlib): Redeem = CScript([2, J1_public_key, J2_public_key, J3_public_key, 3, OP_CHECKMULTISIG]) ...
0
votes
2answers
51 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 ...
8
votes
2answers
2k 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 ...
2
votes
1answer
64 views

Why is 20 the maximum public keys in a multisig transaction?

In script.h the following limit is set: MAX_PUBKEYS_PER_MULTISIG = 20 I'm wondering: Why is the limit set to 20? How would one would construct a script that allows n more than the current OP_16? E....
0
votes
1answer
54 views

nSequence win OP_CSV in child tx must be equal to nSeq parent tx?

When I create OP_CSV transaction I need to set nSequence to the same number (in blocks) e.g. 3 OP_CHECKSEQUENCEVERIFY nSequence = 3 But when I trying to spend this tx (after 3 blocks confirmation)...
1
vote
1answer
168 views

Script evaluated without error but finished with a false/empty top stack element

I'm trying to spend coins from this tx https://tchain.btc.com/ad7a1ed858eecdd146d9c932779aecae4b33f068d29cf794fad6de20f5a5d449 The scriptpubkey is simple: 1 OP_CHECKSEQUENCEVERIFY OP_DROP ...
2
votes
1answer
54 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 ...
8
votes
1answer
5k 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? ...
3
votes
1answer
44 views

OP_CHECKLOCKTIMEVERIFY . Include / reject or will not included in block?

What happened if I translate to network transaction with the folowing redeem script: [now + 3 months] CHECKLOCKTIMEVERIFY DROP DUP HASH160 [Bob's Public Key Hash] EQUALVERIFY CHECKSIG This tx will ...
39
votes
2answers
20k views
1
vote
1answer
47 views

Is it safe to store bitcoins on p2sh (no multisig)?

I've just generated p2sh btc address and look in the output script: HASH160 PUSHDATA(20)[e5c32bdc7f7fb1e6ae7aa1baf42a429803054d2c] EQUALVERIFY while normal (legacy btc address) transaction has ...
0
votes
1answer
41 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
2answers
82 views

How are blocks verified?

I see in the bitcoin wiki there is something called "script" which compiles down to some bytecode to be run by a very very basic virtual machine. Does this mean that each block is actually just a ...
2
votes
1answer
68 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 ...
1
vote
1answer
37 views

Is it posible to create a transaction output that can either be reddemed by privK of Addr A or by privK of Addr B AFTER certain blockheight?

I am thinking about how to secure your Bitcoin savings. One idea I had was to create sort of a "backup" address B for an address A which stores the bitcoins. So what I want to achieve is that you ...
0
votes
1answer
40 views

Is it possible to write a script, which can allow spend only own inputs except all of them?

Let's imagine: We have just one BTC address. Users send some coins to this shared address. And can spend only own inputs. P.S. If someone can provide some example script for this I'll be very ...
4
votes
3answers
630 views

Is there any way to make an UTXO that cannot be spent until a certain block #?

In bitcoin, each transaction has an nLockTime integer to specify the earliest allowed block number/time that the transaction can be added to the blockchain. In addition, each transaction input has an ...
3
votes
4answers
2k views

How to decode very huge (!) raw transactions?

I'm parsing the blockchain to extract certain information I need for a script. One thing I do is parsing transactions. What I do is: getrawtransaction <tx> decoderawtransaction <rawtx> ...
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 ...
1
vote
1answer
19 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 ? ...
5
votes
2answers
124 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 ...
10
votes
2answers
2k 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 ...
1
vote
0answers
116 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&...
12
votes
5answers
4k 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?
4
votes
1answer
107 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 ...
0
votes
1answer
15 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".
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: &...
1
vote
2answers
110 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)[...