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
0
votes
1answer
65 views

How to split the funds and send X% to fee wallet and the remaining funds to another wallet?

Anybody have any idea about how to do it? User send the bitcoins X% goes to fee wallet remaining funds goes to service wallet I'm trying to use the "sendfrom" but it's not working because he only ...
2
votes
2answers
97 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
41 views

Can someone explain how an HTLC is redeemed?

I'm looking at Bolt 3 in the Lightning rfc. My question is about how a HTLC is redeemed. Example HTLC script for reference: # To remote node with revocation key OP_DUP OP_HASH160 <RIPEMD160(SHA256(...
0
votes
1answer
19 views

How to verify locking and unlocking scripts?

I've selected an arbitrary transaction id and retrieved its associated transaction details using the blockcypher explorer as follows: from blockcypher import get_transaction_details ...
0
votes
1answer
16 views

How does a constant opcode become negative in Script

I am doing some tutorial and in this chapter we are suppose to reproduce the Script scripting language I am struggling to understand one of the exercises, here it is: Create a ScriptSig that can ...
1
vote
1answer
22 views

Is a script spendable if multiple items are left on the stack?

Is a script spendable if the top item left on the stack evaluates to "TRUE", and that is the only item left in the stack? In other words, is it okay for multiple items to be left on the stack? For ...
1
vote
3answers
359 views

Instant confirmations with pre-published, locked, transactions

(Clarification: This is not an attempt to solve the problem of a vendor taking the money and running without handing over the merchandise. Problems like that can't be solved without some third party. ...
1
vote
2answers
68 views

Non SegWit P2SH bytes structure

I'm working on a bitcoin block explorer in golang, in which I'd like to gather as much informations as possible about transactions. I am able to extract addresses from every type of output, and mostly ...
9
votes
1answer
128 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 ...
0
votes
1answer
24 views

What is the scriptCode in a P2WSH transaction?

Let's say I am spending from a 2-of-2 multisig with this script: ...
1
vote
1answer
44 views

Why is there no decentralized Bitcoin trading API?

Since nobody has answered me the last 30 times when I asked for decentralized Bitcoin trading APIs, I can pretty safely conclude that it just doesn't exist. So that's why I now ask why this is. Don't ...
1
vote
1answer
34 views

Decoding hex scriptsig in Python

Running decodescript on d1a076722d11ddfd0fadb96d6d960b8b2ad6c6369570cd00df70a801a6be9e44 is returning: { "asm": "0 ...
0
votes
1answer
27 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
78 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> <...
9
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 ...
1
vote
1answer
582 views

Bitcoin - Is the <pubKeyHash> in scriptPubKey already hashed?

In Bitcoin protocol, to set the output of a transaction you need a scriptPubKey which is in the following format. scriptPubKey = OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG Is &...
0
votes
1answer
18 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 ...
4
votes
1answer
399 views

What is 'ScriptCode'?

I don't understand what the 'ScriptCode' thing is. Is it a part of transaction format? The wiki https://en.bitcoin.it/wiki/Transaction describes scriptPubKey and scriptSig, mentioning nothing about '...
1
vote
0answers
26 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
34 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 ...
2
votes
1answer
377 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 ...
2
votes
2answers
174 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
27 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
1answer
123 views

Different redeemScript for the same scriptPubKey?

Most transaction outputs to P2SH addresses have the following scriptPubKey: HASH160 f45d94733d430261962932e0c847075195916a04 OP_EQUAL As I understand it, this transaction do not need to be signed. ...
3
votes
1answer
60 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 <...
4
votes
2answers
166 views

What is the point of including the scriptCode of the input in the transaction digest of segwit?

BIP143 specifies "a new transaction digest algorithm". scriptCode of the input (serialized as scripts inside CTxOuts) What problems could arise if the scriptCode of the input were not ...
1
vote
1answer
40 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) { ...
0
votes
0answers
74 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 ...
3
votes
1answer
89 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 ...
1
vote
2answers
137 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
29 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
58 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
44 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 ...
1
vote
1answer
70 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 ...
0
votes
1answer
106 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 ...
0
votes
2answers
804 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
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
16 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('...
2
votes
1answer
87 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 ...
0
votes
0answers
45 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: ...
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 ...
3
votes
1answer
251 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, ...
3
votes
1answer
123 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
1answer
107 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
36 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
61 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 ...
3
votes
2answers
615 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 ...
0
votes
0answers
53 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
44 views

Original bitcoin core has one script.cpp.where is interepreter for it?I want to write hello world compiler to understand this.?

How to understand script.cpp and its interpreter.I understand register and postfix operation. I want to understand how script is parsed into machine code.Can i write hello world such as only pushing ...
0
votes
1answer
111 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 ...