Bitcoin Forum
May 13, 2024, 10:15:41 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Increase script size above 0xFF characters?  (Read 649 times)
Automatic (OP)
Full Member
***
Offline Offline

Activity: 238
Merit: 105


View Profile
February 17, 2014, 05:26:36 AM
 #1

https://en.bitcoin.it/wiki/Protocol_specification#tx

Field size:- 1+

How on earth do I actually mark it as greater than one? I tried just throwing another byte in there, but, that results in errors, I have this commented transaction so far:-
Code:
01000000014665a822ecf6c9741c6646b244e571ba305f18f3665f707ef5aea0f29d78fa99010000000100ffffffff01107a070000000000 //boring transaction stuff
07 //0x07 bytes script
4c //0x4c states "next byte defines how many bytes I should push to the stack"
03 //0x03 bytes
8f7a3c //Those 0x03 bytes, 0x8f, 0x7a, and, 0x3c
76 //OP_DUP
88 //OP_EQUALVERIFY
00000000 //More boring transaction stuff (locktime)

Which, results in:-
Code:
{
    "hash": "5e4a2e55b8c21d491749d1009f568192e211fa931e78af343675fedf2371041d",
    "ver": 1,
    "vin_sz": 1,
    "vout_sz": 1,
    "lock_time": 0,
    "size": 68,
    "in": [
        {
            "prev_out": {
                "hash": "99fa789df2a0aef57e705f66f3185f30ba71e544b246661c74c9f6ec22a86546",
                "n": 1
            },
            "scriptSig": "OP_FALSE",
            "sequence": 4294967295
        }
    ],
    "out": [
        {
            "value": "0.00490000",
            "scriptPubKey": "8f7a3c OP_DUP OP_EQUALVERIFY"
        }
    ]
}

However, like I said, I can't for the life of me work out how to increase the scriptPubKey to > 0xFF, imagine I have this:-
Code:
01000000014665a822ecf6c9741c6646b244e571ba305f18f3665f707ef5aea0f29d78fa99010000000100ffffffff01107a070000000000 //boring transaction stuff
0301 //(0x07 + 0xff - 0x03) bytes script, 0x0103, bytes reversed to 0x0301.
4c //0x4c states "next byte defines how many bytes I should push to the stack"
ff //0xff bytes
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa //Those 0xff bytes, a bunch of 0xAA
76 //OP_DUP
88 //OP_EQUALVERIFY
00000000 //More boring transaction stuff (locktime)

Results in:-
Code:
{
    "hash": "a530ba3415952af7ed24f297fea7570219f401046fb50ac01d4c773bd2101bd0",
    "ver": 1,
    "vin_sz": 1,
    "vout_sz": 1,
    "lock_time": 2863311530,
    "size": 64,
    "in": [
        {
            "prev_out": {
                "hash": "99fa789df2a0aef57e705f66f3185f30ba71e544b246661c74c9f6ec22a86546",
                "n": 1
            },
            "scriptSig": "OP_FALSE",
            "sequence": 4294967295
        }
    ],
    "out": [
        {
            "value": "0.00490000",
            "scriptPubKey": "4c "
        }
    ]
}

If I don't switch the bytes around for byte script length:-
Code:
01000000014665a822ecf6c9741c6646b244e571ba305f18f3665f707ef5aea0f29d78fa99010000000100ffffffff01107a070000000000 //boring transaction stuff
0103 //(0x07 + 0xff - 0x03) bytes script, 0x0103, bytes reversed to 0x0301.
4c //0x4c states "next byte defines how many bytes I should push to the stack"
ff //0xff bytes
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa //Those 0xff bytes, a bunch of 0xAA
76 //OP_DUP
88 //OP_EQUALVERIFY
00000000 //More boring transaction stuff (locktime)

Equals:-
Code:
{
    "hash": "68ceb346c7711a74f31b8a285014ee08a58050480f69c5ee97cc75e803cf1c2e",
    "ver": 1,
    "vin_sz": 1,
    "vout_sz": 1,
    "lock_time": 2863333196,
    "size": 62,
    "in": [
        {
            "prev_out": {
                "hash": "99fa789df2a0aef57e705f66f3185f30ba71e544b246661c74c9f6ec22a86546",
                "n": 1
            },
            "scriptSig": "OP_FALSE",
            "sequence": 4294967295
        }
    ],
    "out": [
        {
            "value": "0.00490000",
            "scriptPubKey": ""
        }
    ]
}

Any help on making scripts > 0xFF? All I'm currently getting is it overflowing into lockTime.

Please ask for a signed message from my on-site Bitcoin address (Check my profile) before doing any offsite trades with me.
"In a nutshell, the network works like a distributed timestamp server, stamping the first transaction to spend a coin. It takes advantage of the nature of information being easy to spread but hard to stifle." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715638541
Hero Member
*
Offline Offline

Posts: 1715638541

View Profile Personal Message (Offline)

Ignore
1715638541
Reply with quote  #2

1715638541
Report to moderator
gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4172
Merit: 8420



View Profile WWW
February 17, 2014, 05:33:37 AM
 #2

... https://en.bitcoin.it/wiki/Protocol_specification#Variable_length_integer
Automatic (OP)
Full Member
***
Offline Offline

Activity: 238
Merit: 105


View Profile
February 17, 2014, 06:06:07 AM
Last edit: February 17, 2014, 06:44:54 AM by Automatic
 #3


God dammit, I probably should read the whole page before giving up  Undecided

Anyway, not had a chance to actually test anything since (Eating something at the moment), but, can I confirm, if I wanted to do '0x0103', I should do 0xfd0301?

EDIT:- Finally finished my TV show and food, I can confirm it was as I thought, thanks!

Code:
01000000014665a822ecf6c9741c6646b244e571ba305f18f3665f707ef5aea0f29d78fa99010000000100ffffffff01107a070000000000 
fd0301
4c
ff
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
76
88
00000000

Please ask for a signed message from my on-site Bitcoin address (Check my profile) before doing any offsite trades with me.
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!