Bitcoin Forum
May 02, 2024, 08:49:02 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Nonstandard Transaction in Mainnet and Testnet  (Read 1951 times)
sonicskye (OP)
Jr. Member
*
Offline Offline

Activity: 41
Merit: 2


View Profile WWW
December 18, 2015, 01:54:12 AM
 #1

Hi all,

I am currently studying the nonstandard transaction within Bitcoin network, but I could not make it work in mainnet and testnet. My last attempt on pushing the tx into testnet can be seen in https://live.blockcypher.com/btc-testnet/address/mrhtyZUnwS48diKKezCgTLd3x1hEfkdsso/
It was 6 transactions with 2 unconfirmed but then now it is 5 transactions with 1 unconfirmed. The missing transaction is this https://live.blockcypher.com/btc-testnet/tx/fd97be61b2189f1488b7d928db81d458e951f7bb105b88d40c19d7414cabc319/

The 2 unconfirmed transactions are the ones trying to spend the script of OP_SHA256 [hash of secret] OP_EQUAL and it seems that the network is not relaying my transactions. The 2 unconfirmed transactions can only be seen by using blockcypher.com's testnet viewer.

I would like to know whether we can still use nonstandard transaction in mainnet and testnet; if the answer is yes, then how can I push it to the network.

Thank you in advance.
1714682942
Hero Member
*
Offline Offline

Posts: 1714682942

View Profile Personal Message (Offline)

Ignore
1714682942
Reply with quote  #2

1714682942
Report to moderator
1714682942
Hero Member
*
Offline Offline

Posts: 1714682942

View Profile Personal Message (Offline)

Ignore
1714682942
Reply with quote  #2

1714682942
Report to moderator
1714682942
Hero Member
*
Offline Offline

Posts: 1714682942

View Profile Personal Message (Offline)

Ignore
1714682942
Reply with quote  #2

1714682942
Report to moderator
If you want to be a moderator, report many posts with accuracy. You will be noticed.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714682942
Hero Member
*
Offline Offline

Posts: 1714682942

View Profile Personal Message (Offline)

Ignore
1714682942
Reply with quote  #2

1714682942
Report to moderator
1714682942
Hero Member
*
Offline Offline

Posts: 1714682942

View Profile Personal Message (Offline)

Ignore
1714682942
Reply with quote  #2

1714682942
Report to moderator
1714682942
Hero Member
*
Offline Offline

Posts: 1714682942

View Profile Personal Message (Offline)

Ignore
1714682942
Reply with quote  #2

1714682942
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6577


Just writing some code


View Profile WWW
December 18, 2015, 01:58:51 AM
Merited by Husna QA (1)
 #2

Of course you can use nonstandard transactions. But they are nonstandard, which means that they do not adhere to the standard rules. The vast majority of nodes will reject nonstandard transactions, which is why nonstandard transactions typically do not propagate very well. If you want to push it to the network and get the transaction confirmed, you will need to find a miner that will include nonstandard transactions into their blocks and you push it directly to them or their node.

sonicskye (OP)
Jr. Member
*
Offline Offline

Activity: 41
Merit: 2


View Profile WWW
December 18, 2015, 02:08:50 AM
 #3

Of course you can use nonstandard transactions. But they are nonstandard, which means that they do not adhere to the standard rules. The vast majority of nodes will reject nonstandard transactions, which is why nonstandard transactions typically do not propagate very well. If you want to push it to the network and get the transaction confirmed, you will need to find a miner that will include nonstandard transactions into their blocks and you push it directly to them or their node.

Do you have any suggestion where to push the nonstandard transactions? I already tried eligius (http://eligius.st/~wizkid057/newstats/pushtxn.php) many times but no result.
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6577


Just writing some code


View Profile WWW
December 18, 2015, 02:10:12 AM
 #4

Of course you can use nonstandard transactions. But they are nonstandard, which means that they do not adhere to the standard rules. The vast majority of nodes will reject nonstandard transactions, which is why nonstandard transactions typically do not propagate very well. If you want to push it to the network and get the transaction confirmed, you will need to find a miner that will include nonstandard transactions into their blocks and you push it directly to them or their node.

Do you have any suggestion where to push the nonstandard transactions? I already tried eligius (http://eligius.st/~wizkid057/newstats/pushtxn.php) many times but no result.
No. Just look around at mining pool threads and see if they say anything about supporting nonstandard transactions. You can also PM the pool operators about it.

fbueller
Sr. Member
****
Offline Offline

Activity: 412
Merit: 266


View Profile
December 18, 2015, 03:18:54 AM
 #5

You can use P2SH for this.

Bitwasp Developer.
sonicskye (OP)
Jr. Member
*
Offline Offline

Activity: 41
Merit: 2


View Profile WWW
December 18, 2015, 03:45:30 AM
 #6

You can use P2SH for this.

Hi, I thought P2SH is used for multisig transaction. I couldn't find any example about constructing P2SH without the multisig.
fbueller
Sr. Member
****
Offline Offline

Activity: 412
Merit: 266


View Profile
December 18, 2015, 03:29:21 PM
 #7

('Bare') Multi-signature used to be done through output scripts, but this was changed to P2SH allowing for p2sh addresses to be used. P2SH is used to encapsulate a lot of unusual scripts, so give it a go!

You prepare the output script from a template, after hashing whatever your redeemScript is, and then distribute the address. You'll have to generate the appropriate scriptSig to satisfy your redeemScript. But a good library should make this pretty easy!

Bitwasp Developer.
sonicskye (OP)
Jr. Member
*
Offline Offline

Activity: 41
Merit: 2


View Profile WWW
December 19, 2015, 11:35:06 AM
 #8

('Bare') Multi-signature used to be done through output scripts, but this was changed to P2SH allowing for p2sh addresses to be used. P2SH is used to encapsulate a lot of unusual scripts, so give it a go!

You prepare the output script from a template, after hashing whatever your redeemScript is, and then distribute the address. You'll have to generate the appropriate scriptSig to satisfy your redeemScript. But a good library should make this pretty easy!

Hi,
Thanks for your suggestion. Finally I managed to create simple valid P2SH transactions. Does it mean that we can create any kind of scripts using P2SH?
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6577


Just writing some code


View Profile WWW
December 19, 2015, 02:35:16 PM
 #9

('Bare') Multi-signature used to be done through output scripts, but this was changed to P2SH allowing for p2sh addresses to be used. P2SH is used to encapsulate a lot of unusual scripts, so give it a go!

You prepare the output script from a template, after hashing whatever your redeemScript is, and then distribute the address. You'll have to generate the appropriate scriptSig to satisfy your redeemScript. But a good library should make this pretty easy!

Hi,
Thanks for your suggestion. Finally I managed to create simple valid P2SH transactions. Does it mean that we can create any kind of scripts using P2SH?
Yes. P2sh can be used to create any address using any type of script and it should be considered a standard transaction.

CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
December 19, 2015, 02:39:26 PM
Last edit: December 19, 2015, 03:44:03 PM by CIYAM
 #10

Thanks for your suggestion. Finally I managed to create simple valid P2SH transactions. Does it mean that we can create any kind of scripts using P2SH?

If you don't mind sharing I'd be very interested to see a P2SH template that effectively pays to a "secret" (whose SHA256 hash or double hash has been stored in the script).

Basically such a script that also uses CLTV would make it possible to do ACCTs (atomic cross-chain transfers) directly between AT supporting blockchains (currently Burst and Qora) and Bitcoin (thus direct crypto-to-crypto trading with no website or 3rd party involved).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
amaclin
Legendary
*
Offline Offline

Activity: 1260
Merit: 1019


View Profile
December 19, 2015, 03:34:32 PM
 #11

Hi,
Thanks for your suggestion. Finally I managed to create simple valid P2SH transactions.
is it 3QtUgHkoZugsxd5XvoamEcGcCpvFQ7fuZF ?
Quote
Does it mean that we can create any kind of scripts using P2SH?
Not any of course. We have to obey protocol rules and remember about node policy.
sonicskye (OP)
Jr. Member
*
Offline Offline

Activity: 41
Merit: 2


View Profile WWW
December 20, 2015, 04:05:57 AM
 #12

Hi,
Thanks for your suggestion. Finally I managed to create simple valid P2SH transactions.
is it 3QtUgHkoZugsxd5XvoamEcGcCpvFQ7fuZF ?
Quote
Does it mean that we can create any kind of scripts using P2SH?
Not any of course. We have to obey protocol rules and remember about node policy.

Yes it is 3QtUgHkoZugsxd5XvoamEcGcCpvFQ7fuZF. I played with it and somebody else controlling the address 1aa5cmqmvQq8YQTEqcTmW7dfBNuFwgdCD created the redeem script before I sent mine.
sonicskye (OP)
Jr. Member
*
Offline Offline

Activity: 41
Merit: 2


View Profile WWW
December 20, 2015, 04:19:57 AM
 #13

Thanks for your suggestion. Finally I managed to create simple valid P2SH transactions. Does it mean that we can create any kind of scripts using P2SH?

If you don't mind sharing I'd be very interested to see a P2SH template that effectively pays to a "secret" (whose SHA256 hash or double hash has been stored in the script).

Basically such a script that also uses CLTV would make it possible to do ACCTs (atomic cross-chain transfers) directly between AT supporting blockchains (currently Burst and Qora) and Bitcoin (thus direct crypto-to-crypto trading with no website or 3rd party involved).


Hi,
Windows version of BX (Bitcoin eXplorer) helps me creating those P2SH transactions.

This is the paying script:
010000000110489edf7225e42248668d4a2c2fc5a2cd767e4b76b11e64f28c57a2a50d6e4b01000 0006b483045022100a75bd4fd089f216fb0f83313c80210a64949d972d0e591da9cc63801809bc9 fd02207a0cec66a4068374dc177ace93b1bef9ecd86e2b83e78fcf356ee523ff83323a012103d7c 6052544bc42eb2bc0d27c884016adb933f15576a1a2d21cd4dd0f2de0c37dffffffff0170110100 0000000017a914fe75cd4abf2e4be52494933cd04de82a9d8287118700000000

And this is (supposed to be) the redeem script:
01000000011acb1031902b151d0c6e64e42c1af8780f6f60916e5182027354224bddb2a03f00000 00030000a3132333435363738393023a820c775e7b757ede630cd0aa1113bd102661ab38829ca52 a6422ab782862f26864687ffffffff0160ea0000000000001976a914937fe2ee82229d282edec26 06c70e755875334c088ac00000000

The secret password is 31323334353637383930 which is base-16 of 1234567890
And the secret is hashed using sha256 and the script is OP_SHA256 c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646 OP_EQUAL
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
December 20, 2015, 06:06:17 AM
 #14

Thanks for that - when I get a chance I'll have to find that BX tool and have a play with it.

Also note that if you are interested in developing a basic script template for being able to do ACCTs based upon CLTV and a "secret" for Bitcoin script then a bounty could be made available (feel free to PM me about this).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
amaclin
Legendary
*
Offline Offline

Activity: 1260
Merit: 1019


View Profile
December 20, 2015, 08:22:46 AM
 #15

And this is (supposed to be) the redeem script:
01000000011acb1031902b151d0c6e64e42c1af8780f6f60916e5182027354224bddb2a03f00000 00030000a3132333435363738393023a820c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab 782862f26864687ffffffff0160ea0000000000001976a914937fe2ee82229d282edec2606c70e7 55875334c088ac00000000
there is one useless OF_FALSE in your redeem script.
your redeem script would not pass "cleanstack rule"

Quote
I played with it and somebody else controlling the address 1aa5cmqmvQq8YQTEqcTmW7dfBNuFwgdCD created the redeem script before I sent mine.
It is impossible to guess your "secret password" before you sent your tx Grin
sonicskye (OP)
Jr. Member
*
Offline Offline

Activity: 41
Merit: 2


View Profile WWW
December 20, 2015, 11:23:03 AM
 #16

And this is (supposed to be) the redeem script:
01000000011acb1031902b151d0c6e64e42c1af8780f6f60916e5182027354224bddb2a03f00000 00030000a3132333435363738393023a820c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab 782862f26864687ffffffff0160ea0000000000001976a914937fe2ee82229d282edec2606c70e7 55875334c088ac00000000
there is one useless OF_FALSE in your redeem script.
your redeem script would not pass "cleanstack rule"

Quote
I played with it and somebody else controlling the address 1aa5cmqmvQq8YQTEqcTmW7dfBNuFwgdCD created the redeem script before I sent mine.
It is impossible to guess your "secret password" before you sent your tx Grin
Does it mean that my script is wrong? I thought I have sent a validation query to the network and it said valid input.

Well actually I created 2 sets of tx using the same secret password. Silly, yes, but it's for the sake of easiness  Grin. The first one is considered as dust and it was rejected, but my redeem tx was already sent to the network. That is why I suspected that somebody (or something) has already learned the password.
amaclin
Legendary
*
Offline Offline

Activity: 1260
Merit: 1019


View Profile
December 20, 2015, 12:20:37 PM
 #17

Does it mean that my script is wrong?
Your script is valid. But executing this script leaves one useless parameter in stack.
Some miners (may be even all of them) treat such scripts non-standard and do not confirm such transactions on the mainnet.

Quote
I thought I have sent a validation query to the network and it said valid input.
It is valid.

Quote
Well actually I created 2 sets of tx using the same secret password. Silly, yes, but it's for the sake of easiness  Grin. The first one is considered as dust and it was rejected, but my redeem tx was already sent to the network. That is why I suspected that somebody (or something) has already learned the password.
Guess who?  Grin
sonicskye (OP)
Jr. Member
*
Offline Offline

Activity: 41
Merit: 2


View Profile WWW
December 20, 2015, 10:20:03 PM
 #18

Guess who?  Grin
You?  Cheesy
How do you (or somebody) do that?

Anyway I tried to create P2SH script that looks like this: OP_SHA256 <hash of secret key> EQUAL <public key> CHECKSIGVERIFY
And I tried to redeem it by using <signature> <secret key> <script>
but it failed.
amaclin
Legendary
*
Offline Offline

Activity: 1260
Merit: 1019


View Profile
December 20, 2015, 11:44:01 PM
Merited by Husna QA (1)
 #19

How do you (or somebody) do that?
Wanna know?  Grin

Quote
Anyway I tried to create P2SH script that looks like this: OP_SHA256 <hash of secret key> EQUAL <public key> CHECKSIGVERIFY
And I tried to redeem it by using <signature> <secret key> <script>
but it failed.
This is unspendable output.
You had to encode it as OP_SHA256 <hash of secret key> OP_EQUALVERIFY <public key> OP_CHECKSIGVERIFY
Can you post details?
sonicskye (OP)
Jr. Member
*
Offline Offline

Activity: 41
Merit: 2


View Profile WWW
December 21, 2015, 12:42:46 AM
 #20

Wanna know?  Grin

Yes of course  Grin

Quote
This is unspendable output.
You had to encode it as OP_SHA256 <hash of secret key> OP_EQUALVERIFY <public key> OP_CHECKSIGVERIFY
Can you post details?


I finally realized that after reading the explanation on how the script is validated here https://bitcoin.org/en/developer-guide#p2pkh-script-validation. and as you said, the VERIFY should be in the middle of the script to clear the result of CHECKSIG operation.

I managed to create a pair of P2SH tx. the P2SH address is 3QNa9usE5TixpiDaMEDS1YfXmC3V4XcNGo
as the password is still 1234567890 and no one can steal it this time  Grin
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!