Pages:
Author

Topic: [WTB]Tutorial on how to make non-standard outputs - page 2. (Read 4661 times)

legendary
Activity: 1386
Merit: 1053
Please do not PM me loan requests!
Customs scripts are non-standard and won't be relayed by most of the network.  This can be bypassed by replacing the "output script" with a P2SH script including the HASH160 of your redemption script.
Wouldn't that be standard then?
And would this then work?
OP_DUP OP_HASH160 7db9fbceb81b5dc4cbcc84ab6b0cd9e57d1e3925 OP_EQUALVERIFY OP_CHECKSIG OP_SHA256 9c0f28fc262f58e9ad1f021ab707662cad96c754ecf3ad43be5c26e49c081233 OP_EQUALVERIFY
hero member
Activity: 935
Merit: 1002
WARNING:  Before you go any further you should understand that a script locked by a hash of a "secret" is insecure and trivially easy to steal.  When this owner tries to redeem this output the secret will be in plain text in the input.  Any miner could simply change the output to their output and include it in the next block.
Yep read that in the wiki page long time ago.
You seem to be confusing to separate aspects.
No I might write like I would confuse them but no I don't think so.(I guess)
High priority txns do not need to pay a fee in order to be relayed
If you meant "doesn't need to pay a fee to get mined" than yes but low priority tx's will still be relayed. Look at http://mempool.info/ scroll down a bit and you see lots of transactions like this https://blockchain.info/tx/25692930af2f39c0fb0725b19241ab53a4807772261e542aa5ed955ae4398a6e
So if your txn is low priority you will need to pay the min fee of 1000 sat per KB or the txn won't be relayed (by 99%+ of the network).
Wrong even my 0.8.6 relays them.When I push it to let's say blockchain.info/pushtx it appears on all blockchain explorers and also on my client.
There is no point in paying a fee >0 and less than the min fee as it won't be relayed regardless.
I must agree that there is no point of doing that in most cases but in mine there is.
Also understand the fee rules apply regardless of if the txn is standard or not.
I fault that non-standard transactions need to pay double the fee.
If your txn is low priority and you don't want to pay the fee your only option is to bypass the network and find some one to get the txn directly to a miner.  
What do you call a low priority transaction? For me its low priority=output less than 0.01,it has not passed enough time to qualify for free tx(and still be high priority),it does not pay any fee and it is above 1000bytes
As a heads up There no longer is a >=0.01 BTC output rule to avoid txn fees.  It was removed way back in v0.8.6 but you may still see old docs refer to that.
In 0.8.6 or after 0.8.6? I still use 0.8.6 and now downgraded to 0.8.5(Luke's Jr version of qt)
Customs scripts are non-standard and won't be relayed by most of the network.  This can be bypassed by replacing the "output script" with a P2SH script including the HASH160 of your redemption script.
Wouldn't that be standard then?
donator
Activity: 1218
Merit: 1079
Gerald Davis
WARNING:  Before you go any further you should understand that a script locked by a hash of a "secret" is insecure and trivially easy to steal.  When this owner tries to redeem this output the secret will be in plain text in the input.  Any miner could simply change the output to their output and include it in the next block.   

Quote
Well then it's very strange. Because when I relay same transactions(but they are standard it's just that it pays 0 fee for 3000+bytes below 0.01BTC tx) they hold it(Eligius doesn't) how's that not a spam? What criteria should I meet to relay it to them does paying 100sat fee and/or sending above 0.01 help?

You seem to be confusing to separate aspects.   "Standard transactions" and priority/fee.  Most nodes follow the lead of the reference client when it comes to relaying txns so your best bet is to simply comply but it can be done indirectly w/ P2SH and redemption will get easier once v0.10 is widely deployed (see release notes for v0.10).

Priority/fee
High priority txns do not need to pay a fee in order to be relayed so that might be what you are observing. The coin age of the inputs must be at least "one bitcoin day" or more (i.e. spending a 1 BTC output you received 144 blocks ago).   There actually is an exact formula but the wiki seems to be down right now.   So if your txn is low priority you will need to pay the min fee of 1000 sat per KB or the txn won't be relayed (by 99%+ of the network).  There is no point in paying a fee >0 and less than the min fee as it won't be relayed regardless.   Also understand the fee rules apply regardless of if the txn is standard or not.   If your txn is low priority and you don't want to pay the fee your only option is to bypass the network and find some one to get the txn directly to a miner.   This would be the only reason to pay a fee greater than zero but less than the min (1,000).  As a heads up There no longer is a >=0.01 BTC output rule to avoid txn fees.  It was removed way back in v0.8.6 but you may still see old docs refer to that.

Standard Transaction
Customs scripts are non-standard and won't be relayed by most of the network.  This can be bypassed by replacing the "output script" with a P2SH script including the HASH160 of your redemption script.

Quote
Pubkey script: OP_HASH160 OP_EQUAL
Signature script: [sig] [sig...]

So using the example txn linked above instead of having an output of:
Quote
OP_HASH256 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000 OP_EQUAL

That becomes the redeem script and the HASH160 of it goes in an output like this:
Quote
OP_HASH160 OP_EQUAL

To redeem that output, the signature script (in input of the txn spending this output) would be the redemption script you hashed plus whatever satisfies the conditions (in this case the secret that was hashed):
Quote
OP_HASH256 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000 OP_EQUAL

Also you need to make sure the min output is above the dust threshold to avoid it being considered spam (which is always non-standard).
Quote
(nValue*1000)/(3*((int)GetSerializeSize(SER_DISK,0)+148)) < nMinRelayTxFee

hero member
Activity: 935
Merit: 1002
Quote
Unfortunately f2pool relayed the double-spending tx again 901dd16927eac839cdbb44fb3762792c95db07871b42c254eb55ff850ecd6b06
Your non-standard transaction doesn't pay fee.
f2pool ignores it as spam (and it is definetely spam)
Well then it's very strange. Because when I relay same transactions(but they are standard it's just that it pays 0 fee for 3000+bytes below 0.01BTC tx) they hold it(Eligius doesn't) how's that not a spam? What criteria should I meet to relay it to them does paying 100sat fee and/or sending above 0.01 help?
legendary
Activity: 1260
Merit: 1019
Quote
Unfortunately f2pool relayed the double-spending tx again 901dd16927eac839cdbb44fb3762792c95db07871b42c254eb55ff850ecd6b06
Your non-standard transaction doesn't pay fee.
f2pool ignores it as spam (and it is definetely spam)

hero member
Activity: 935
Merit: 1002
detected
Unfortunately f2pool relayed the double-spending tx again 901dd16927eac839cdbb44fb3762792c95db07871b42c254eb55ff850ecd6b06  the owner of f2pool seems to be very inactive I sent many PM's to him but he didn't responded. Any ideas on how else I could make the first tx appear on their memory pool?
sr. member
Activity: 475
Merit: 252
My main goal is not to get the transaction(with non-standard outputs) to confirm. My main goal is to get the transaction that is below 0.01 has non-standard outputs and 0 fee relayed. To be more exact I want f2pool to have that transaction in their memory pool.
Currently you have maybe 99.9% of nodes against you. (as a large majority will not relay your tx)

Look forward to hear if you succeed.
legendary
Activity: 1260
Merit: 1019
detected

Code:
0100000001DF886DE4BCA3E49D75D5562605826887881545A7215BB12AEA7F375C2C0B8E83000000008A473044022032D5B1258CB6EDCD9AB3E381F6872F978E0C8C4890004C490D456DC8FD4AC696022032A08AF17D4F88C0EF7064C23B037017A091CC39E0BBF965878DA06E367155EC014104D79737E9137E54A6ED4D3F6CCABB2A2232BC0020477C911F0D7D74DB62D6F7B2F6FDD88457E6C408033EDC7B12539584D42C8ACAEFFF6347165F24F0ABBCB9C2FFFFFFFF0100350C000000000023A8209C0F28FC262F58E9AD1F021AB707662CAD96C754ECF3AD43BE5C26E49C0812338700000000

{
"txid" : "38a66ab2e5ad44ec287006ea3bcb13f5364112162f001b2f7968bf694c8e052e",
"version" : 1,
"locktime" : 0,
"vin" : [
{
"txid" : "838e0b2c5c377fea2ab15b21a7451588876882052656d5759de4a3bce46d88df",
"vout" : 0,
[...]
"vout" : [
{
"value" : 0.00800000, // WHERE ARE THE FEES ?
"n" : 0,
"scriptPubKey" : {
"asm" : "OP_SHA256 9c0f28fc262f58e9ad1f021ab707662cad96c754ecf3ad43be5c26e49c081233 OP_EQUAL",
"hex" : "a8209c0f28fc262f58e9ad1f021ab707662cad96c754ecf3ad43be5c26e49c08123387",
"type" : "nonstandard"
}
}
]
}
hero member
Activity: 935
Merit: 1002
Eligius accepts non-standard, but you need a certain fee.

I forgot where their non-standard fee list was...

But if you stick a 0.001 BTC fee on it and push to eligius I'm sure they'll mine it.
My main goal is not to get the transaction(with non-standard outputs) to confirm. My main goal is to get the transaction that is below 0.01 has non-standard outputs and 0 fee relayed. To be more exact I want f2pool to have that transaction in their memory pool.
sr. member
Activity: 475
Merit: 252
I don't know what to do I think it's impossible to relay a TX which has non-standard outputs is below 0.01 and has 0 fee.I pushed it on webbtc it relayed(to 0%) then I pushed it to RelayNetwork(not sure if it propagated). Tried to push a double-spend tx(the only way to know if other tx propagated is to push double-spend tx if it relays it, then they didn't got the previous tx if it doesn't relay it woohoo means that they have the other TX in their memory pool) on https://www.f2pool.com/pushtx and unfortunately it relayed. Don't know other ways I tried to push non-standard tx's through my normal bitcoin core connected to Eligius nodes my client doesn't relay them,RelayNetwork doesn't relay it last hope is to broadcast through Luke's version of qt which will take me a whole decade to re-index or hope that they open http://eligius.st/~wizkid057/newstats/pushtxn.php again is there anything else I could use to relay those transactions.

Eligius accepts non-standard, but you need a certain fee.

I forgot where their non-standard fee list was...

But if you stick a 0.001 BTC fee on it and push to eligius I'm sure they'll mine it.
hero member
Activity: 935
Merit: 1002
f457f0191e10281d6537d314e3f920bb187388736896defe3b1044b7281f7e62
Well now it even confirmed the double-spend transaction of f457f0191e10281d6537d314e3f920bb187388736896defe3b1044b7281f7e62 by this one https://blockchain.info/tx/838e0b2c5c377fea2ab15b21a7451588876882052656d5759de4a3bce46d88df Strange.
hero member
Activity: 935
Merit: 1002
non-standard output detected on my radars:

f457f0191e10281d6537d314e3f920bb187388736896defe3b1044b7281f7e62
Well then the strangest thing is how did f2pool relayed the double-spending transaction. Guess your tool actually worked but maybe it didn't relayed through all non-standard accepting nodes one of them was f2pool's. Maybe it would have even reached f2pool after few seconds, but that is just my hypothesis.
legendary
Activity: 1260
Merit: 1019
non-standard output detected on my radars:

f457f0191e10281d6537d314e3f920bb187388736896defe3b1044b7281f7e62

Code:
01000000019F9B54077EBAF05F41C38A22FD2269A481089C922C5CF6B4A241CBF28E29E683000000008A47304402202FA6D22E9051F12A0D98FD6E08104A7206B3C81F8A783E17920E89E4F5814539022034EF868C5CB58D69115745DDD808C549D69728702D9695F30F9E0505B347BA49014104D79737E9137E54A6ED4D3F6CCABB2A2232BC0020477C911F0D7D74DB62D6F7B2F6FDD88457E6C408033EDC7B12539584D42C8ACAEFFF6347165F24F0ABBCB9C2FFFFFFFF0100350C000000000023A8209C0F28FC262F58E9AD1F021AB707662CAD96C754ECF3AD43BE5C26E49C0812338700000000

"vin" : [
{
"txid" : "83e6298ef2cb41a2b4f65c2c929c0881a46922fd228ac3415ff0ba7e07549b9f",
"vout" : 0,
[...]
"vout" : [
{
"value" : 0.00800000,
"n" : 0,
"scriptPubKey" : {
"asm" : "OP_SHA256 9c0f28fc262f58e9ad1f021ab707662cad96c754ecf3ad43be5c26e49c081233 OP_EQUAL",
"hex" : "a8209c0f28fc262f58e9ad1f021ab707662cad96c754ecf3ad43be5c26e49c08123387",
"type" : "nonstandard"
}
}
]

hero member
Activity: 935
Merit: 1002
I don't know what to do I think it's impossible to relay a TX which has non-standard outputs is below 0.01 and has 0 fee.I pushed it on webbtc it relayed(to 0%) then I pushed it to RelayNetwork(not sure if it propagated). Tried to push a double-spend tx(the only way to know if other tx propagated is to push double-spend tx if it relays it, then they didn't got the previous tx if it doesn't relay it woohoo means that they have the other TX in their memory pool) on https://www.f2pool.com/pushtx and unfortunately it relayed. Don't know other ways I tried to push non-standard tx's through my normal bitcoin core connected to Eligius nodes my client doesn't relay them,RelayNetwork doesn't relay it last hope is to broadcast through Luke's version of qt which will take me a whole decade to re-index or hope that they open http://eligius.st/~wizkid057/newstats/pushtxn.php again is there anything else I could use to relay those transactions.
sr. member
Activity: 475
Merit: 252
http://webbtc.com/relay_tx relays all the transactions if they are valid(well sometimes to only 0%) but when I sign transactions through coinb.in no one relays those tx's. Any other way?

Change the "00" placeholder in the input of the unsigned transaction with the following:
"1976a9147db9fbceb81b5dc4cbcc84ab6b0cd9e57d1e392588ac"

THEN sign it with coinb.in...

BUT FIRST

Lower your output to 0.00799 BTC. I noticed it's 0.008. You need at least a 0.00001 BTC fee. (which a fee is just the value of the inputs minus the value of the outputs, which is why sending 0.00799 BTC will leave a fee for the miners.

If you don't leave a fee, good luck getting it mined at all. ESPECIALLY if it's non-standard, miners will ignore your transaction outright.

Some miners will accept non-standard IF there is a large fee. (like 0.0001 or 0.0005)
hero member
Activity: 935
Merit: 1002
Ok so I followed your instructions and created
Code:
01000000019f9b54077ebaf05f41c38a22fd2269a481089c922c5cf6b4a241cbf28e29e6830000000000ffffffff0100350C000000000023a8209c0f28fc262f58e9ad1f021ab707662cad96c754ecf3ad43be5c26e49c0812338700000000
But is there any easy way to sign that transaction(yes I have the private keys) without using bitcoin qt?

https://coinb.in/#sign

1. paste transaction in lower box
2. paste WIF format private key (starts with K, L or 5) in the upper box
3. click "submit"

the signed transaction will be shown in a green box below.

Pushing a non-standard tx to the network is tricky though...


I coded Coinbin's signature algorithm to be RFC6979 compliant.
(tl;dr: the signatures are super safe)

PS. you can download the website on your computer with Ctrl + S and unplug your internet while you sign if you want.
I knew that service I tried it but it's bad.Signed the transaction and it returned to
Code:
01000000019f9b54077ebaf05f41c38a22fd2269a481089c922c5cf6b4a241cbf28e29e683000000008a473044022031b026269e3ab349be70e032348882fe9f4ff9b7752bd5a9c67d95995ba8ca800220412d70a9e336cdc607eae7ac2ca0c1901bf4335a44aac8bcec36c41c36434e7a014104d79737e9137e54a6ed4d3f6ccabb2a2232bc0020477c911f0d7d74db62d6f7b2f6fdd88457e6c408033edc7b12539584d42c8acaefff6347165f24f0abbcb9c2ffffffff0100350c000000000023a8209c0f28fc262f58e9ad1f021ab707662cad96c754ecf3ad43be5c26e49c0812338700000000
http://webbtc.com/relay_tx relays all the transactions if they are valid(well sometimes to only 0%) but when I sign transactions through coinb.in no one relays those tx's. Any other way?
sr. member
Activity: 475
Merit: 252
Ok so I followed your instructions and created
Code:
01000000019f9b54077ebaf05f41c38a22fd2269a481089c922c5cf6b4a241cbf28e29e6830000000000ffffffff0100350C000000000023a8209c0f28fc262f58e9ad1f021ab707662cad96c754ecf3ad43be5c26e49c0812338700000000
But is there any easy way to sign that transaction(yes I have the private keys) without using bitcoin qt?

https://coinb.in/#sign

1. paste transaction in lower box
2. paste WIF format private key (starts with K, L or 5) in the upper box
3. click "submit"

the signed transaction will be shown in a green box below.

Pushing a non-standard tx to the network is tricky though...


I coded Coinbin's signature algorithm to be RFC6979 compliant.
(tl;dr: the signatures are super safe)

PS. you can download the website on your computer with Ctrl + S and unplug your internet while you sign if you want.
hero member
Activity: 935
Merit: 1002
Ok so I followed your instructions and created
Code:
01000000019f9b54077ebaf05f41c38a22fd2269a481089c922c5cf6b4a241cbf28e29e6830000000000ffffffff0100350C000000000023a8209c0f28fc262f58e9ad1f021ab707662cad96c754ecf3ad43be5c26e49c0812338700000000
But is there any easy way to sign that transaction(yes I have the private keys) without using bitcoin qt?
sr. member
Activity: 475
Merit: 252
Code:
18310c0000000000 // This says the output is worth 0.00799 BTC (leaving 0.00001 BTC in fees, because the input is worth 0.008 BTC)
Everything was clear expect this one. When I try to convert from text to hex I get 302e3030373939 how did you got the 18310c0000000000 number?

1. all bitcoin amounts on the blockchain are in satoshis, so convert 0.00799 BTC into satoshis
= 799000 satoshis
2. convert the 799000 decimal number to hexidecimal number (base 16 which counts 0123456789abcdef )
= C3118 satoshis
3. make sure the hex number is a multiple of 2 digits (this one is 5, so we will stick an extra zero on the left hand side.
= 0C3118 satoshis
4. take the hex number and split into groups of two digits.
= 0C  31  18  satoshis
5. reverse the groups of 2's order, but do not flip them individually (so don't turn 31 into 13 or anything)
= 18  31  0C  satoshis
6. join them together
= 18310C satoshis
7. add 0's to the RIGHT SIDE until it comes out to 16 digits long... this is 6 digits now, so add 10 zeroes to the right side.
= 18310C0000000000 satoshis

Congratulations, you know now how to convert a numerical bitcoin amount and convert it into a little endian satoshi value! :-)

Edit:

Here's a decimal to hexidecimal converter to verify:
http://www.binaryhexconverter.com/decimal-to-hex-converter
hero member
Activity: 935
Merit: 1002
Code:
18310c0000000000 // This says the output is worth 0.00799 BTC (leaving 0.00001 BTC in fees, because the input is worth 0.008 BTC)
Everything was clear expect this one. When I try to convert from text to hex I get 302e3030373939 how did you got the 18310c0000000000 number?
Pages:
Jump to: