We’re rewarding the question askers & reputations are being recalculated! Read more.

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
8
votes
3answers
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 compiles to Bitcoin Script. This is also a great resource on Miniscript: http://bitcoin.sipa.be/miniscript/ But I know very ...
0
votes
1answer
14 views

How Extracting address Bitcoin to script multi signature

I want to extract the correct address from a script multi-signature. I have this real script multi-signature from this ScriptSig (tx index 1), so this is a readme script for this address OP_2 ...
1
vote
0answers
24 views

Is possible extract the original script P2MS from the transaction locked with the P2SH address?

This is a stupid question because if the P2SH contains the hash160 (and the hash160 contains the sha256) of the P2MS doesn't possible return to the original hex P2MS. So, but for verifying the P2SH I ...
1
vote
0answers
32 views

How verify (in C++) input signature?

First small problem: blockchair.com give me only output scripts, not input - is any blockexplorer online with it? I read binary data and this may be hard recreate my sample data and verify. I test BTC ...
9
votes
1answer
111 views

Can we construct a UTXO which is spendable only via proof of work?

Do the current Bitcoin opcodes and transaction size limit allow constructing a UTXO which is only spendable if a specified amount of work has been performed? So the spender, would provide a nonce as ...
1
vote
1answer
39 views

Does Bitcoin script support nested IFs (OP_IF or OP_NOTIF inside one another)?

For example can we convert the following code to a script? if(bool_1) { FOO1(); if(!bool_2) { FOO2(); } else { BAR1(); if(bool_3) { ...
3
votes
1answer
59 views

Clarification on execution of complex script with OP_CHECKLOCKTIMEVERIFY

I'm quoting this example of BIP65 BIP 65 has this bitcoin script code IF <now + 3 months> CHECKLOCKTIMEVERIFY DROP <Lenny's pubkey> CHECKSIGVERIFY 1 ELSE 2 ENDIF <...
0
votes
0answers
68 views

How to use “OP_CHECKSEQUENCEVERIFY” in regtest?

I have created a P2sh includes OP_CHECKSEQUENCEVERIFY and funded the same. I was trying to redeem the coins. But i could not understand the working of OP_CHECKSEQUENCEVERIFY. Below is the example ...
0
votes
1answer
27 views

How to calculate the Public key P2SH from hexadecimal script?

My study on the scripts goes next. I'm creating a ScriptPubKey decompiler, now I have a problem with the P2SH, So how is calculate the key p2sh? I using this code but I not think is correct ...
1
vote
1answer
52 views

Clarification on the script P2SH, how is executed to Bitcoin core?

This question is a continuation of the my post yesterday. Today I have a question on P2SH execution so, an example of the script should be this OP_0 <A Signature> <B Signature> OP_2 <...
0
votes
1answer
36 views

How does this simple script use the OP_CHECKSIG opcode?

I have this Script P2PKH <A Signature> <A Public Key> OP_DUP OP_HASH160 <A Public Key Hash> OP_EQUALVERIFY OP_CHECKSIG The bitcoin.org documentation say this The entire ...
3
votes
1answer
86 views

How does Elements integrate Simplicity?

Greg Maxwell noted that there are two ways to integrate Simplicity into Bitcoin. One is to make only a few select high-level constructs available (like SHA256, CheckSigHashAll), the other is to expose ...
0
votes
1answer
25 views

Is a multi script possible that requires relative time locks relative to each signature?

I've been wondering about cold storage multi sig security. Specifically, I was wondering how secure it is with respect to a kidnapper. If a kidnapper took X hostage, and threatened to kill him, X ...
0
votes
0answers
21 views

Who write Bitcoin scripts [duplicate]

I have just discovered Bitcoin scripts system, then now I am wondering which are the people who write bitcoin scripts ? Mainly developers of wallet software ?
1
vote
0answers
14 views

BIP0034 block height using python-bitcoinlib

I'm doing some experiments for finding coinbase height from freshly mined block which is received from ZMQ. tx_coinbase = CTransaction.deserialize(x('...
0
votes
0answers
42 views

Bitcoin Transaction Generation: Signature Verification Error

I have the following raw transaction (basic P2PKH) which I am trying to send to the Bitcoin Testnet 3: ...
3
votes
1answer
231 views

Is it possible to do a 3-of-5 OR 1 multi-sig for backup purposes?

I'd like to create a multi-sig wallet where I can freely create transactions, but I want to give keys to trusted friends/family + a safety deposit box so that if I hit my head and forget my password, ...
0
votes
1answer
90 views

Bitcoin TX decode failed while sending to a the network(regtest)

I have created a signature manually (referring the signature output formats in bitcoin-cli). But i tried to send the same to the network I am getting error code: -22 error message: TX decode ...
0
votes
1answer
35 views

Bitcoin script (pay-to-pubkey-hash)

Example for 'pay-to-pubkey-hash' is quoted in Wiki bitcoin script. I have a doubt that 14 is for bytes to push. But the data to push is 20 bytes. Please anyone could explain to me? Script: 76 --> ...
0
votes
1answer
53 views

In practice, are redeemScripts commonly reused?

In regards to P2SH-P2WSH transactions, are Txout-script values identical between transactions? Is it reasonable to expect a business or vendor that accepts bitcoin to be using the same redeemScript ...
0
votes
1answer
57 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 ...
0
votes
0answers
52 views

HTLC in blockchain regtest mode by creating transactions manually

I am trying to create a htlc smart contract manually by writing a script and finding the hex using the btcc compiler. Now node A has to create a transaction using that hex and lock money in that p2sh ...
0
votes
1answer
99 views

Bitcoin raw transaction with manually created redeem script

I am running bitcoin in regtest mode with 2 nodes bitcoinNode1 and bitcoinNode2.I have created a redeem script by writing the opcodes and converted into hex form using btcc. HP-ProBook-440-G4:~$ btcc ...
0
votes
1answer
38 views

OP_EQUAL not working properly

I went to https://siminchen.github.io/bitcoinIDE/build/editor.html to try some bitcoin scripting and I wrote this script: <1PUzZ61FSVTn12CafJC85Vy1ts3BoFcXdU> OP_HASH160 <...
0
votes
1answer
26 views

Getting source address of a Tx message from it's signature script

I have a simple bitcoin packet which contains TX message. in a TX message, one of it's Transaction input hex data was like this: ...
0
votes
1answer
74 views

Detect types of ScriptSig and parse each part

As explained in https://en.bitcoin.it/wiki/Script there are many types of scriptPubKey and scriptSig like: <sig> <pubKey> <sig> <pubKey> <pubKey> <sig> <...
1
vote
0answers
43 views

Parse signature and public key from scriptsig in an input transaction of bitcoin protocol [duplicate]

I'm interested in bitcoin protocol and checking validation of a transaction. in a TX message, we can see one or more than one input transaction and every input transaction has a previous transaction ...
0
votes
0answers
29 views

Extract input addresses from a tx message in bitcoin protocol

Recently, I wrote a c++ code to extract some information from some messages in BITCOIN protocol. for example, I extracted bitcoin value and output address corresponded to it from tx messages of this ...
3
votes
1answer
121 views

Bitcoin script execution unsuccessful

I'm working my way through "Mastering Bitcoin". The author made a transaction: 0627052b6f28912f2703066a912ea577f2ce4da4caa5a5fbd8a57286c345c2f2 https://www.blockchain.com/btc/tx/...
0
votes
2answers
26 views

Where are the non-scriptPubKey outputs in the chainstate leveldb?

I read https://bitcoindev.network/understanding-the-data/ and it explain that the leveldb of the chainstate contain transaction with at least one unspent output. And it has "The scriptPubKey and ...
1
vote
1answer
53 views

How to generate an output address from output scrips which start with 0x00?

A few days ago, I got a BITCOIN traffic which contains some tx message. some of tx messages contain witness data. I want to produce all output addresses from transaction output scripts. I extracted ...
1
vote
1answer
42 views

Bitcoin Blocks Date not coherent? [duplicate]

I was taking data from the BTC Blockchain with a custom script. I found something really weird. Block nr. 24668 was created at 2009-10-09 23:02:57 Block nr. 24669 was created at 2009-10-10 00:15:48 ...
2
votes
1answer
128 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 ...
1
vote
2answers
59 views

How to extract raw script from tx messages when the output script starts with 0xA9?

I'm working on extracting output addresses from tx messages in BITCOIN packets. Currently, I extract address from output scripts which starts with 0x76(OP_DUP) like this : 76 a9 14 6d 1d 74 58 95 6e ...
1
vote
1answer
57 views

Multisig without P2WSH in Lightning

The current Lightning implementations use P2WSH script format for multisig in the funding transaction. But it is also possible to use the CHECKMULTISIG opcode "natively", i.e., without P2WSH (see ...
0
votes
1answer
53 views

Are Relay Addresses Possible?

Is it possible to create an address such that different parties can spend certain portions of any output spent to that address? R: 1zaybxcrandrelayexampaddr A: 1xyzabcrandexampladdressa 97% B: ...
2
votes
1answer
85 views

How to make a homomorphic preimage/payment hash with current lightning network / Bitcoin implementations?

If I remember / understand it correctly by using the mechanisms from the scriptless scripts paper we could easily create homomorphic preimages / paymenthashes. I think this would be a very desirable ...
1
vote
1answer
99 views

Besides transaction validation, are there any other uses of the Script language in Bitcoin

Script's stack operations are used to validate signatures and scripts of transaction inputs and outputs. Is Script also used to validate block, network, or any other data? Seem like there are a lot ...
3
votes
1answer
56 views

Differences to CCompactSize and CVarInt

I'm developing a parser bitcoin core and I have a problem whit the type CVarInt, I using the decodifier mode of the CCompact size but at the block 976 I Have a problem whit the type, because the value ...
1
vote
1answer
68 views

Script Null into raw trasaction bitcoin core

I'm developing a parser for bitcoin core and into the alpha test of the parser,I noticed than the script bitcoin core are null and the hash raw transaction exist. An example: for this transaction the ...
0
votes
1answer
96 views

Script to import multiple priv keys in Electrum

DuckDuckGo turns up nothing of interest. How to import multiple priv keys in Electrum from a file using Electrum console or shell script, for all derivable valid BTC addresses? (1,3,bc1) Eventually I ...
1
vote
0answers
51 views

Error mandatory-script-verify-flag-failed (Signature is found in scriptCode)

I found a few questions with the specific error, but couldn't find also the appropriate answer. So, here I am. I am working on regtest in a Python library that create transactions and then use JSON-...
2
votes
2answers
96 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 ...
1
vote
1answer
63 views

How to convert P2PKH to Hash160 (or something else acceptable by Script)?

How to convert a bitcoin address (starts with 1) to the right format acceptable by script (I'm using this Ruby library)? I'm doing this: tx.output do |o| o.value(50000) o.script { |s| s.recipient(...
2
votes
1answer
264 views

Bitcoin scripts that force disclosure of the private key

Context: I am creating an example code that would demonstrate an atomic swap between Elements and Bitcoin, with the aim that the swap transactions cannot be trivially linked, as it would be with ...
2
votes
0answers
22 views

Script and DER in P2PKH

Im trying to figure out the script and DER In P2PKH, the "first part (scriptsig)" push in stack (<sig><pubK>) because is it DER? Instead the "second part (scriptPubKey)" you can map the ...
1
vote
1answer
108 views

Why are only specific transaction types accepted into the mempool?

In the Bitcoin Mainnet, only specific transaction types are accepted: Bitcoin uses a scripting language to specify (and satisfy) the encumbrances, thereby allowing a whole host of transaction types....
0
votes
1answer
27 views

What did Deepbit to make their inputs special on transactions?

It seems Deepbit uses a strange format for it’s transactions on the addresses it owned. For example, in this transaction all inputs but 3 comes from Deepbit. Even Bitcoin core can’t decode addresses ...
1
vote
0answers
180 views

Coinbase “convert” API?

I use the convert functions at coinbase to take advantage of market changes to increase my position amounts. This weekend I am going to write a php script that tracks the available conversion pairs ...
0
votes
1answer
41 views

Which parts of a bitcoin script are embedded in the blockchain?

I assume the scriptPubKey is contained in a UTXO, and therefore embedded in the blockchain. Since, this is the script used to unlock the input. Is a scriptSig also embedded in the blockchain? Or is ...