Bitcoin Forum
March 29, 2024, 11:32:15 AM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 3 »  All
  Print  
Author Topic: [WTB]Tutorial on how to make non-standard outputs  (Read 4577 times)
yakuza699 (OP)
Hero Member
*****
Offline Offline

Activity: 935
Merit: 1002


View Profile
January 05, 2015, 08:08:45 PM
 #1

Hi I would like to buy a step by step tutorial on how to make OP_TRUE and OP_EQUAL(tx like this https://blockchain.info/tx/a4bfa8ab6435ae5f25dae9d89e4eb67dfa94283ca751f393c1ddc5a837bbc31b) non-standard outputs on bitcoind or bitcoinqt debug window(raw transaction).An example of how to make OP_RETURN tutorial https://bitcointalk.org/index.php?topic=453086.msg5302717#msg5302717

Will pay a little amount of 0.01BTC for it.

▄▄▄▄▄▄▄▄
▄▄▄▄▄▄
▄▄▄▄
BTC BitDice.me 
.
According to NIST and ECRYPT II, the cryptographic algorithms used in Bitcoin are expected to be strong until at least 2030. (After that, it will not be too difficult to transition to different algorithms.)
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
yakuza699 (OP)
Hero Member
*****
Offline Offline

Activity: 935
Merit: 1002


View Profile
January 06, 2015, 04:00:15 PM
Last edit: January 06, 2015, 04:24:13 PM by yakuza699
 #2

Moved from Services to Development & Technical Discussion.

▄▄▄▄▄▄▄▄
▄▄▄▄▄▄
▄▄▄▄
BTC BitDice.me 
.
dabura667
Sr. Member
****
Offline Offline

Activity: 475
Merit: 252


View Profile
January 06, 2015, 04:30:17 PM
 #3

Step 1: Follow the OP_RETURN tutorial up until you get to the part where you are making the OP_RETURN output. (as everything else is the same)
Step 2: Prepare your hash. (so figure out what you will hash, hash it, and get the hash in hex)
Step 3: Create the output as follows:

Code:
23   // the number 35 in hex... this means "THE OUTPUT SCRIPT IS 35 BYTES TOTAL"

a8   // This is the OP for OP_SHA256.... do not confuse with OP_HASH256 (which is 2 sha256s in a row)
20   // the number 32 in hex... means "PUSH 32 BYTES ONTO STACK"
931d236179670b00348f87bea4199fe18297f0ef26da02c7542bd54d5b7836d8   // My SHA256 hash of the secret I will need to redeem it.
87  // This is OP_EQUAL

Also, one note: The scriptlen is in VarInt format
https://en.bitcoin.it/wiki/Protocol_specification#Variable_length_integer

However, pushdata inside the actual script is in PUSHDATA OP format:
(Up to 75 bytes is just that number in hex, above that you need to add a byte before the length and represent it in a little endian multi-byte integer.)
https://en.bitcoin.it/wiki/Script#Constants


Here's how to redeem:

My secret was gibberish:
Code:
adfladsfhuifo8ry8fh4u4et4e5tsg415et458s43etg41s35e4g3541r35g143sg54s385g41s535e1g435s4g;.:;,[@snrltgnjslenjrgklsnleignilsnklgnslnglk

But I need this in hex format, so I convert each ASCII byte to hex to get:
Code:
6164666c61647366687569666f38727938666834753465743465357473673431356574343538733433657467343173333565346733353431723335673134337367353473333835673431733533356531673433357334673b2e3a3b2c5b40736e726c74676e6a736c656e6a72676b6c736e6c6569676e696c736e6b6c676e736c6e676c6b

That's 132 bytes total.

So my input script that spends the output would be:
Code:
86  // This input script is 134 bytes long... VarInt is one byte up to fc.

4c84  // 4c is "the next byte is a PUSHDATA byte.... 84 is "132" in hex...
6164666c61647366687569666f38727938666834753465743465357473673431356574343538733433657467343173333565346733353431723335673134337367353473333835673431733533356531673433357334673b2e3a3b2c5b40736e726c74676e6a736c656e6a72676b6c736e6c6569676e696c736e6b6c676e736c6e676c6b  // My secret

My Tip Address:
1DXcHTJS2DJ3xDoxw22wCt11FeAsgfzdBU
yakuza699 (OP)
Hero Member
*****
Offline Offline

Activity: 935
Merit: 1002


View Profile
January 07, 2015, 05:12:50 PM
 #4

Didn't really understood. Can you make a formula like for example on OP_RETURN it's
Code:
0100000001AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABB00000000ffffffff0100000000000000004e6a4cCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC00000000
and how do I do it on https://blockchain.info/address/1CTnGM9uapUSg8wvdXkpJPG2nbfGcxytPF

▄▄▄▄▄▄▄▄
▄▄▄▄▄▄
▄▄▄▄
BTC BitDice.me 
.
dabura667
Sr. Member
****
Offline Offline

Activity: 475
Merit: 252


View Profile
January 07, 2015, 06:02:05 PM
 #5

Code:
01000000 // version
01 // number of inputs
9f9b54077ebaf05f41c38a22fd2269a481089c922c5cf6b4a241cbf28e29e683 // hash of the tx you gave me, reversed
00000000 // your input was first, so index is 0
00 // this is just here for when you sign. placeholder.
ffffffff // this is sequence for nLockTime
01 // this is output count
18310c0000000000 // This says the output is worth 0.00799 BTC (leaving 0.00001 BTC in fees, because the input is worth 0.008 BTC)
23 // The length of the output is 35 bytes
a8 // OP_SHA256
20 // push 32 bytes on the stack
931d236179670b00348f87bea4199fe18297f0ef26da02c7542bd54d5b7836d8 // this is the 32 bytes that are pushed (your hash) REPLACE WITH A HASH OF SOMETHING ONLY YOU KNOW!
87 // OP_EQUAL
00000000 // nLockTime... leave at 0

clumped all together.

Code:
01000000019f9b54077ebaf05f41c38a22fd2269a481089c922c5cf6b4a241cbf28e29e6830000000000ffffffff0118310c000000000023a820931d236179670b00348f87bea4199fe18297f0ef26da02c7542bd54d5b7836d88700000000

This is what you use for signrawtransaction.

I will replace the sha256 hash with XXX so you can see where to put it.

Code:
01000000019f9b54077ebaf05f41c38a22fd2269a481089c922c5cf6b4a241cbf28e29e6830000000000ffffffff0118310c000000000023a820XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX8700000000

My Tip Address:
1DXcHTJS2DJ3xDoxw22wCt11FeAsgfzdBU
yakuza699 (OP)
Hero Member
*****
Offline Offline

Activity: 935
Merit: 1002


View Profile
January 08, 2015, 02:08:57 PM
 #6

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?

▄▄▄▄▄▄▄▄
▄▄▄▄▄▄
▄▄▄▄
BTC BitDice.me 
.
dabura667
Sr. Member
****
Offline Offline

Activity: 475
Merit: 252


View Profile
January 08, 2015, 02:20:06 PM
 #7

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

My Tip Address:
1DXcHTJS2DJ3xDoxw22wCt11FeAsgfzdBU
yakuza699 (OP)
Hero Member
*****
Offline Offline

Activity: 935
Merit: 1002


View Profile
January 08, 2015, 04:24:03 PM
 #8

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?

▄▄▄▄▄▄▄▄
▄▄▄▄▄▄
▄▄▄▄
BTC BitDice.me 
.
dabura667
Sr. Member
****
Offline Offline

Activity: 475
Merit: 252


View Profile
January 08, 2015, 04:34:50 PM
 #9

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.

My Tip Address:
1DXcHTJS2DJ3xDoxw22wCt11FeAsgfzdBU
yakuza699 (OP)
Hero Member
*****
Offline Offline

Activity: 935
Merit: 1002


View Profile
January 08, 2015, 04:42:14 PM
 #10

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?

▄▄▄▄▄▄▄▄
▄▄▄▄▄▄
▄▄▄▄
BTC BitDice.me 
.
dabura667
Sr. Member
****
Offline Offline

Activity: 475
Merit: 252


View Profile
January 08, 2015, 06:45:46 PM
 #11

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)

My Tip Address:
1DXcHTJS2DJ3xDoxw22wCt11FeAsgfzdBU
yakuza699 (OP)
Hero Member
*****
Offline Offline

Activity: 935
Merit: 1002


View Profile
January 08, 2015, 07:02:37 PM
 #12

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.

▄▄▄▄▄▄▄▄
▄▄▄▄▄▄
▄▄▄▄
BTC BitDice.me 
.
amaclin
Legendary
*
Offline Offline

Activity: 1260
Merit: 1019


View Profile
January 08, 2015, 07:09:51 PM
 #13

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"
}
}
]

yakuza699 (OP)
Hero Member
*****
Offline Offline

Activity: 935
Merit: 1002


View Profile
January 08, 2015, 07:24:16 PM
 #14

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.

▄▄▄▄▄▄▄▄
▄▄▄▄▄▄
▄▄▄▄
BTC BitDice.me 
.
yakuza699 (OP)
Hero Member
*****
Offline Offline

Activity: 935
Merit: 1002


View Profile
January 08, 2015, 07:34:25 PM
 #15

f457f0191e10281d6537d314e3f920bb187388736896defe3b1044b7281f7e62
Well now it even confirmed the double-spend transaction of f457f0191e10281d6537d314e3f920bb187388736896defe3b1044b7281f7e62 by this one https://blockchain.info/tx/838e0b2c5c377fea2ab15b21a7451588876882052656d5759de4a3bce46d88df Strange.

▄▄▄▄▄▄▄▄
▄▄▄▄▄▄
▄▄▄▄
BTC BitDice.me 
.
dabura667
Sr. Member
****
Offline Offline

Activity: 475
Merit: 252


View Profile
January 09, 2015, 04:15:01 AM
 #16

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.

My Tip Address:
1DXcHTJS2DJ3xDoxw22wCt11FeAsgfzdBU
yakuza699 (OP)
Hero Member
*****
Offline Offline

Activity: 935
Merit: 1002


View Profile
January 09, 2015, 01:15:29 PM
 #17

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.

▄▄▄▄▄▄▄▄
▄▄▄▄▄▄
▄▄▄▄
BTC BitDice.me 
.
amaclin
Legendary
*
Offline Offline

Activity: 1260
Merit: 1019


View Profile
January 09, 2015, 02:23:55 PM
 #18

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"
}
}
]
}
dabura667
Sr. Member
****
Offline Offline

Activity: 475
Merit: 252


View Profile
January 09, 2015, 02:33:52 PM
 #19

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.

My Tip Address:
1DXcHTJS2DJ3xDoxw22wCt11FeAsgfzdBU
yakuza699 (OP)
Hero Member
*****
Offline Offline

Activity: 935
Merit: 1002


View Profile
January 09, 2015, 04:27:56 PM
 #20

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?

▄▄▄▄▄▄▄▄
▄▄▄▄▄▄
▄▄▄▄
BTC BitDice.me 
.
Pages: [1] 2 3 »  All
  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!