Bitcoin Forum
April 16, 2024, 09:55:31 PM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 [3] 4 »  All
  Print  
Author Topic: Is this BIP65 sample script standard?  (Read 4686 times)
sonicskye
Jr. Member
*
Offline Offline

Activity: 41
Merit: 2


View Profile WWW
December 31, 2015, 12:08:37 PM
Merited by Husna QA (1)
 #41

I was trying to add another branch of OP_ELSE to mimic Gmaxwell's CoinSwap but I don't really know how to skip the previous OP_ELSE and run the next OP_ELSE. Do you know how to do it?

I think I remember reading that you can nest the OP_IFs - in which case you would do something like this:

<cond1>
OP_IF
<cond2>
OP_IF
...
OP_ELSE
...
OP_ENDIF
OP_ELSE
...
OP_ENDIF


Hi, many thanks for the clue. I managed to construct the following structure

Quote
OP_IF
OP_IF
OP_DUP OP_SHA256 <HASH> OP_EQUAL
OP_DROP
OP_DUP OP_HASH160 <pubkeyhash2> OP_EQUALVERIFY OP_CHECKSIG
OP_ELSE
<cltv> OP_NOP2 OP_DROP
OP_DUP OP_HASH160 <pubkeyhash1> OP_EQUALVERIFY OP_CHECKSIG
OP_ENDIF
OP_ELSE
2 <pubkey 1> <pubkey 2> 2 OP_CHECKMULTISIG
OP_ENDIF
The structure probably is the first few steps of Gmaxwell's Coinswap. I am not sure whether this can be called as atomic. Basically the tx can be redemed by 3 different ways:
- secret value + sig2
- sig1 + pubkey1 after certain CLTV
- sig1 + sig2 (in 2-of-2 multisig)
1713304531
Hero Member
*
Offline Offline

Posts: 1713304531

View Profile Personal Message (Offline)

Ignore
1713304531
Reply with quote  #2

1713304531
Report to moderator
1713304531
Hero Member
*
Offline Offline

Posts: 1713304531

View Profile Personal Message (Offline)

Ignore
1713304531
Reply with quote  #2

1713304531
Report to moderator
1713304531
Hero Member
*
Offline Offline

Posts: 1713304531

View Profile Personal Message (Offline)

Ignore
1713304531
Reply with quote  #2

1713304531
Report to moderator
You can see the statistics of your reports to moderators on the "Report to moderator" pages.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
sonicskye
Jr. Member
*
Offline Offline

Activity: 41
Merit: 2


View Profile WWW
December 31, 2015, 12:11:27 PM
 #42

This Bitcoin Script IDE might be useful, but there might be a bug in it.

http://www.cs.princeton.edu/~tongbinw/bitcoinIDE/build/editor.html

The following thread discusses signing transactions on the testnet, and using the IDE to track down problems, but one of the final comments says it was giving inconsistent results with known good values. However, the IDE might have been updated since then.


Last time I checked, it is still buggy. This one https://webbtc.com/script is one of the best so far, despite it does not work lately.
sonicskye
Jr. Member
*
Offline Offline

Activity: 41
Merit: 2


View Profile WWW
December 31, 2015, 12:17:33 PM
 #43

Hmm... I have nearly got there (perhaps):

Code:
0100000001bbc6c76fd91bee5badfb0746204adba70efceb04f21a270de566827dbc34e8410000000085002103d30f361b0d5dacba61a56db0903fe32244b5616f950cac1081694e81148dd7594c6076a820c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243a3a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8c88d0b7a4043a6645983a479588ac68000000000140420f00000000001976a9148a7dd4d0e29f50f989dd2b97d463d706a7ef0c7b88ac00000000

When I decode this I am seeing the following (which I think looks fine):
Code:
{
    "txid" : "b6ae7d90587b27adef7c36571cc1fdf4fbe04c77d2a3113a2239188285f581cf",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
        {
            "txid" : "41e834bc7d8266e50d271af204ebfc0ea7db4a204607fbad5bee1bd96fc7c6bb",
            "vout" : 0,
            "scriptSig" : {
                "asm" : "0 03d30f361b0d5dacba61a56db0903fe32244b5616f950cac1081694e81148dd759 76a820c775e7b757ede630cd0aa1113bd10266
1ab38829ca52a6422ab782862f26864687637576a91401d7295f243a3a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8c88d0b7a4
043a6645983a479588ac68",
                "hex" : "002103d30f361b0d5dacba61a56db0903fe32244b5616f950cac1081694e81148dd7594c6076a820c775e7b757ede630cd0aa1113bd
102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243a3a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8c88d
0b7a4043a6645983a479588ac68"
            },
            "sequence" : 0
        }
    ],
    "vout" : [
        {
            "value" : 0.01000000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 8a7dd4d0e29f50f989dd2b97d463d706a7ef0c7b OP_EQUALVERIFY OP_CHECKSIG",
                "hex" : "76a9148a7dd4d0e29f50f989dd2b97d463d706a7ef0c7b88ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "mt9EHSSeERgWKNqYfdmkpa4Mjb4EXr4QY2"
                ]
            }
        }
    ]
}

But unfortunately if I try and sign it I get this output:

Code:
{
    "hex" : "0100000001bbc6c76fd91bee5badfb0746204adba70efceb04f21a270de566827dbc34e8410000000085002103d30f361b0d5dacba61a56db0903fe
32244b5616f950cac1081694e81148dd7594c6076a820c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243
a3a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8c88d0b7a4043a6645983a479588ac68000000000140420f00000000001976a91
48a7dd4d0e29f50f989dd2b97d463d706a7ef0c7b88ac00000000",
    "complete" : false,
    "errors" : [
        {
            "txid" : "41e834bc7d8266e50d271af204ebfc0ea7db4a204607fbad5bee1bd96fc7c6bb",
            "vout" : 0,
            "scriptSig" : "002103d30f361b0d5dacba61a56db0903fe32244b5616f950cac1081694e81148dd7594c6076a820c775e7b757ede630cd0aa1113
bd102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243a3a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8c8
8d0b7a4043a6645983a479588ac68",
            "sequence" : 0,
            "error" : "NOPx reserved for soft-fork upgrades"
        }
    ]
}


Are you trying to redeem the CLTV block? BX decodes the tx as follows.

Quote
transaction
{
    hash b6ae7d90587b27adef7c36571cc1fdf4fbe04c77d2a3113a2239188285f581cf
    inputs
    {
        input
        {
            previous_output
            {
                hash 41e834bc7d8266e50d271af204ebfc0ea7db4a204607fbad5bee1bd96fc7c6bb
                index 0
            }
            script "zero [ 03d30f361b0d5dacba61a56db0903fe32244b5616f950cac1081694e81148dd759 ] [ 76a820c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f26864687637576a 91401d7295f243a3a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774 de8c88d0b7a4043a6645983a479588ac68 ]"
            sequence 0
        }
    }
    lock_time 0
    outputs
    {
        output
        {
            address mt9EHSSeERgWKNqYfdmkpa4Mjb4EXr4QY2
            script "dup hash160 [ 8a7dd4d0e29f50f989dd2b97d463d706a7ef0c7b ] equalverify checksig"
            value 1000000
        }
    }
    version 1
}

I wonder why there is a zero there.
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
December 31, 2015, 12:36:23 PM
 #44

Yes - I am trying to do the CLTV redeem (but without a sig it will never work of course).

I wonder why there is a zero there.

That is where the sig should end up (except that it won't sign the tx for me). My understanding is that you can leave a zero as a place-marker in the raw tx to later replace with the signature (assuming it would agree to sign the tx for me which it won't).

You can omit the zero with this version:

Code:
0100000001bbc6c76fd91bee5badfb0746204adba70efceb04f21a270de566827dbc34e84100000000842102d1570ab314b7b32ffe76f31232805a727d05119958d14b0b8aff9df5709676884c6076a820c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243a3a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8c88d0b7a4043a6645983a479588ac68000000000140420f00000000001976a9145817f2d63208327c21da272a3bb037c3d9ec026988ac00000000

But without being able to sign the tx it doesn't really help me.

So using that version if I try signrawtransaction I get the following output:
Code:
{
    "hex" : "0100000001bbc6c76fd91bee5badfb0746204adba70efceb04f21a270de566827dbc34e84100000000842102d1570ab314b7b32ffe76f31232805a7
27d05119958d14b0b8aff9df5709676884c6076a820c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243a3
a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8c88d0b7a4043a6645983a479588ac68000000000140420f00000000001976a9145
817f2d63208327c21da272a3bb037c3d9ec026988ac00000000",
    "complete" : false,
    "errors" : [
        {
            "txid" : "41e834bc7d8266e50d271af204ebfc0ea7db4a204607fbad5bee1bd96fc7c6bb",
            "vout" : 0,
            "scriptSig" : "2102d1570ab314b7b32ffe76f31232805a727d05119958d14b0b8aff9df5709676884c6076a820c775e7b757ede630cd0aa1113bd
102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243a3a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8c88d
0b7a4043a6645983a479588ac68",
            "sequence" : 0,
            "error" : "NOPx reserved for soft-fork upgrades"
        }
    ]
}

I am going to try this with "-regtest" next (but that might have to wait until tomorrow).

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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
December 31, 2015, 02:45:04 PM
 #45

Shit - just realised I was running 0.11.1 not 0.11.2.

After downloading and re-running I now get this:

Code:
{
    "hex" : "0100000001bbc6c76fd91bee5badfb0746204adba70efceb04f21a270de566827dbc34e84100000000842102d1570ab314b7b32ffe76f31232805a7
27d05119958d14b0b8aff9df5709676884c6076a820c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243a3
a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8c88d0b7a4043a6645983a479588ac68000000000140420f00000000001976a9145
817f2d63208327c21da272a3bb037c3d9ec026988ac00000000",
    "complete" : false,
    "errors" : [
        {
            "txid" : "41e834bc7d8266e50d271af204ebfc0ea7db4a204607fbad5bee1bd96fc7c6bb",
            "vout" : 0,
            "scriptSig" : "2102d1570ab314b7b32ffe76f31232805a727d05119958d14b0b8aff9df5709676884c6076a820c775e7b757ede630cd0aa1113bd
102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243a3a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8c88d
0b7a4043a6645983a479588ac68",
            "sequence" : 0,
            "error" : "Locktime requirement not satisfied"
        }
    ]
}

I think if I fix up my nLockTime now then we might have a winner.

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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
December 31, 2015, 02:57:58 PM
 #46

Unfortunately no such luck:

Code:
{
    "hex" : "0100000001bbc6c76fd91bee5badfb0746204adba70efceb04f21a270de566827dbc34e84100000000842102d1570ab314b7b32ffe76f31232805a7
27d05119958d14b0b8aff9df5709676884c6076a820c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243a3
a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8c88d0b7a4043a6645983a479588ac68000000000140420f00000000001976a9145
817f2d63208327c21da272a3bb037c3d9ec026988acac9a0900",
    "complete" : false,
    "errors" : [
        {
            "txid" : "41e834bc7d8266e50d271af204ebfc0ea7db4a204607fbad5bee1bd96fc7c6bb",
            "vout" : 0,
            "scriptSig" : "2102d1570ab314b7b32ffe76f31232805a727d05119958d14b0b8aff9df5709676884c6076a820c775e7b757ede630cd0aa1113bd
102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243a3a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8c88d
0b7a4043a6645983a479588ac68",
            "sequence" : 0,
            "error" : "Operation not valid with the current stack size"
        }
    ]
}

using the version with the extra 00 at the start of the inputs produces this:
Code:
{
    "hex" : "0100000001bbc6c76fd91bee5badfb0746204adba70efceb04f21a270de566827dbc34e8410000000085002102d1570ab314b7b32ffe76f31232805
a727d05119958d14b0b8aff9df5709676884c6076a820c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243
a3a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8c88d0b7a4043a6645983a479588ac68000000000140420f00000000001976a91
45817f2d63208327c21da272a3bb037c3d9ec026988acac9a0900",
    "complete" : false,
    "errors" : [
        {
            "txid" : "41e834bc7d8266e50d271af204ebfc0ea7db4a204607fbad5bee1bd96fc7c6bb",
            "vout" : 0,
            "scriptSig" : "002102d1570ab314b7b32ffe76f31232805a727d05119958d14b0b8aff9df5709676884c6076a820c775e7b757ede630cd0aa1113
bd102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243a3a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8c8
8d0b7a4043a6645983a479588ac68",
            "sequence" : 0,
            "error" : "Script evaluated without error but finished with a false/empty top stack element"
        }
    ]
}

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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
December 31, 2015, 03:02:50 PM
 #47

I am guessing if I can work out the format that is suitable for signing (which will have that 00 and I think requires another 01000000 to be added at the end of the inputs from memory) then I can manually sign it and then try and send the tx.

Anyone can for sure tell me the hex input for signing?

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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
sonicskye
Jr. Member
*
Offline Offline

Activity: 41
Merit: 2


View Profile WWW
December 31, 2015, 09:23:54 PM
 #48

I am guessing if I can work out the format that is suitable for signing (which will have that 00 and I think requires another 01000000 to be added at the end of the inputs from memory) then I can manually sign it and then try and send the tx.

Anyone can for sure tell me the hex input for signing?


I don't really understand the question. Do you mean you cannot produce a valid signature by using your tool? I checked the rawtx you created and indeed the problem is within the signature. webbtc verifies this as well.
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
January 01, 2016, 03:43:46 AM
Last edit: January 01, 2016, 04:45:18 AM by CIYAM
 #49

I don't really understand the question. Do you mean you cannot produce a valid signature by using your tool? I checked the rawtx you created and indeed the problem is within the signature. webbtc verifies this as well.

I have written code that signs "standard P2PKH" transactions here: https://github.com/ciyam/ciyam/blob/master/src/crypto_keys.cpp#L805 and if you look closely you'll see c_empty_sig_script (which is "00") being placed where the sig later goes (why I was mucking around with the extra 00 above) and also this:

Code:
signing_info_suffix += c_hash_code_type_all;

which appends "01000000" (only to what is signed rather than what is actually the raw tx).

Basically to manually do a sig I'll need to apply the same approach to non-standard txs (nothing too hard - just some modifications really).

I was actually hoping to just use bitcoin-cli rather than to have to write code though but it's beginning to look like signrawtransaction is not able to do what I am wanting it to.

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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
January 01, 2016, 02:21:18 PM
 #50

I think I basically have the correct raw tx but still Bitcoin won't allow me to send it.

Code:
0100000001bbc6c76fd91bee5badfb0746204adba70efceb04f21a270de566827dbc34e84100000000cc47304402204d5c2b9a9a5a9e467a77d87c0de310c1fa1be7
7f9ff36f640c730a04597046d702207d9388d3d5edb4249215d69e01cc112ab4d1a6dc8c720a5fc2bb2e3c71c4ba87012102d1570ab314b7b32ffe76f31232805a72
7d05119958d14b0b8aff9df5709676884c6076a820c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243a3a
6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8c88d0b7a4043a6645983a479588ac68000000000120a10700000000001976a9148a
7dd4d0e29f50f989dd2b97d463d706a7ef0c7b88ac809c0900

the decoded version of this:
Code:
{
    "txid" : "ed4861442c7f3fd1c066ce93e335349914750f2c6cdf8778f7a71cec7422aebe",
    "version" : 1,
    "locktime" : 629888,
    "vin" : [
        {
            "txid" : "41e834bc7d8266e50d271af204ebfc0ea7db4a204607fbad5bee1bd96fc7c6bb",
            "vout" : 0,
            "scriptSig" : {
                "asm" : "304402204d5c2b9a9a5a9e467a77d87c0de310c1fa1be77f9ff36f640c730a04597046d702207d9388d3d5edb4249215d69e01cc112
ab4d1a6dc8c720a5fc2bb2e3c71c4ba8701 02d1570ab314b7b32ffe76f31232805a727d05119958d14b0b8aff9df570967688 76a820c775e7b757ede630cd0aa11
13bd102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243a3a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8
c88d0b7a4043a6645983a479588ac68",
                "hex" : "47304402204d5c2b9a9a5a9e467a77d87c0de310c1fa1be77f9ff36f640c730a04597046d702207d9388d3d5edb4249215d69e01cc1
12ab4d1a6dc8c720a5fc2bb2e3c71c4ba87012102d1570ab314b7b32ffe76f31232805a727d05119958d14b0b8aff9df5709676884c6076a820c775e7b757ede630c
d0aa1113bd102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243a3a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6
774de8c88d0b7a4043a6645983a479588ac68"
            },
            "sequence" : 0
        }
    ],
    "vout" : [
        {
            "value" : 0.00500000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 8a7dd4d0e29f50f989dd2b97d463d706a7ef0c7b OP_EQUALVERIFY OP_CHECKSIG",
                "hex" : "76a9148a7dd4d0e29f50f989dd2b97d463d706a7ef0c7b88ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "mt9EHSSeERgWKNqYfdmkpa4Mjb4EXr4QY2"
                ]
            }
        }
    ]
}

You can also debug it here: https://webbtc.com/script if you copy and paste this into the Input Script:

Code:
3045022100922dd91ae97909ee6cfa19976e3d072d24521e0e3717d6c1634e190d43131922022064b992db3588651c717777d579c74787daf5d24b3b9651ea4cb38544ff50604501
02d1570ab314b7b32ffe76f31232805a727d05119958d14b0b8aff9df570967688
76a820c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243a3a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8c88d0b7a4043a6645983a479588ac68

and the following into the Output Script:
Code:
OP_HASH160 5817f2d63208327c21da272a3bb037c3d9ec0269 OP_EQUAL

The error I'm getting when trying to send this raw transaction is as follows:

Code:
error: {"code":-26,"message":"16: mandatory-script-verify-flag-failed (Script evaluated without error but finished with a false/empty top stack element)"}


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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
January 01, 2016, 02:39:14 PM
Last edit: January 01, 2016, 02:51:27 PM by CIYAM
 #51

Hmm... I wonder if the problem is the CLTV value itself:

Code:
["ac9a09"]

What block number is that (am a bit tired and really starting to hate Satoshi for using little-endian)?

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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3360
Merit: 6505


Just writing some code


View Profile WWW
January 01, 2016, 04:24:27 PM
 #52

Hmm... I wonder if the problem is the CLTV value itself:

Code:
["ac9a09"]

What block number is that (am a bit tired and really starting to hate Satoshi for using little-endian)?

That looks like it is block number 629420.

cr1776
Legendary
*
Offline Offline

Activity: 4004
Merit: 1299


View Profile
January 01, 2016, 04:26:13 PM
 #53

Hmm... I wonder if the problem is the CLTV value itself:

Code:
["ac9a09"]

What block number is that (am a bit tired and really starting to hate Satoshi for using little-endian)?


Looks like 629420 to me too.
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
January 01, 2016, 04:27:13 PM
 #54

Looks like 629420 to me too.

So if the block number isn't the issue then is the sig invalid?

(current testnet3 block is 629899 and that raw tx's nLockTime is 629888)

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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
January 01, 2016, 04:43:15 PM
 #55

If I issue a signrawtransaction with (basically) the same tx I see this:

Code:
{
    "hex" : "0100000001bbc6c76fd91bee5badfb0746204adba70efceb04f21a270de566827dbc34e84100000000cc473044022015c6fca1fb3e8244cfd9a90d1
348d387cb6e8792102be79ecf97cee0246b73b802201162c3acd0a1f915ee46bbf0ec4ee7ab49365c4e48c33502575c2f46298f7249012102d1570ab314b7b32ffe7
6f31232805a727d05119958d14b0b8aff9df5709676884c6076a820c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f26864687637576a9140
1d7295f243a3a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8c88d0b7a4043a6645983a479588ac68000000000120a1070000000
0001976a9148a7dd4d0e29f50f989dd2b97d463d706a7ef0c7b88ac289c0900",
    "complete" : false,
    "errors" : [
        {
            "txid" : "41e834bc7d8266e50d271af204ebfc0ea7db4a204607fbad5bee1bd96fc7c6bb",
            "vout" : 0,
            "scriptSig" : "473044022015c6fca1fb3e8244cfd9a90d1348d387cb6e8792102be79ecf97cee0246b73b802201162c3acd0a1f915ee46bbf0ec4
ee7ab49365c4e48c33502575c2f46298f7249012102d1570ab314b7b32ffe76f31232805a727d05119958d14b0b8aff9df5709676884c6076a820c775e7b757ede63
0cd0aa1113bd102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243a3a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89
a6774de8c88d0b7a4043a6645983a479588ac68",
            "sequence" : 0,
            "error" : "Script evaluated without error but finished with a false/empty top stack element"
        }
    ]
}

The question is whether the complete being false is due to an invalid sig or due to the script eval error.

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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
sonicskye
Jr. Member
*
Offline Offline

Activity: 41
Merit: 2


View Profile WWW
January 02, 2016, 05:47:28 AM
 #56

If I issue a signrawtransaction with (basically) the same tx I see this:

Code:
{
    "hex" : "0100000001bbc6c76fd91bee5badfb0746204adba70efceb04f21a270de566827dbc34e84100000000cc473044022015c6fca1fb3e8244cfd9a90d1
348d387cb6e8792102be79ecf97cee0246b73b802201162c3acd0a1f915ee46bbf0ec4ee7ab49365c4e48c33502575c2f46298f7249012102d1570ab314b7b32ffe7
6f31232805a727d05119958d14b0b8aff9df5709676884c6076a820c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f26864687637576a9140
1d7295f243a3a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8c88d0b7a4043a6645983a479588ac68000000000120a1070000000
0001976a9148a7dd4d0e29f50f989dd2b97d463d706a7ef0c7b88ac289c0900",
    "complete" : false,
    "errors" : [
        {
            "txid" : "41e834bc7d8266e50d271af204ebfc0ea7db4a204607fbad5bee1bd96fc7c6bb",
            "vout" : 0,
            "scriptSig" : "473044022015c6fca1fb3e8244cfd9a90d1348d387cb6e8792102be79ecf97cee0246b73b802201162c3acd0a1f915ee46bbf0ec4
ee7ab49365c4e48c33502575c2f46298f7249012102d1570ab314b7b32ffe76f31232805a727d05119958d14b0b8aff9df5709676884c6076a820c775e7b757ede63
0cd0aa1113bd102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243a3a6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89
a6774de8c88d0b7a4043a6645983a479588ac68",
            "sequence" : 0,
            "error" : "Script evaluated without error but finished with a false/empty top stack element"
        }
    ]
}

The question is whether the complete being false is due to an invalid sig or due to the script eval error.


I crafted a tx pair similar to yours (same cltv block and same locktime) in testnet, I think it is correct but it won't be sent to the network.
This is the rawtx
Code:
0100000001de320e8cc248e7fe8fc7e57ec70b0d1bf3a44122f634bf443a2a8fceb39b63c001000000cc473044022026d86fa3239733e866bc4187e6a13813e7db68cb39aceb3837054f7340a1a62002200f5fd9f7c6a0a9d92b4233faac4bb9642584818da737dd51cae4951e01d7839501210260274c034ffc8dc6a2ceb1ff5f31031c593d7005bd286f03c9cadb1bc662961b4c6076a820c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f26864687637576a9149d8fe65f4bccb39d510c45ae3bcf9cf0a3a22b0e88ac6703ac9a09b17576a9147abb3052f7090c5379d2af382c84eeab0658488188ac68010000000180c3c901000000001976a9147abb3052f7090c5379d2af382c84eeab0658488188ac289c0900

I wonder if the CLTV is not deployed in testnet yet
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
January 02, 2016, 07:13:53 AM
 #57

I wonder if the CLTV is not deployed in testnet yet

It could well be that not enough of the testnet peers have upgraded - I think the next step is to play with -regtest rather than -testnet (so you are mining your own blocks).

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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
sonicskye
Jr. Member
*
Offline Offline

Activity: 41
Merit: 2


View Profile WWW
January 02, 2016, 07:36:24 AM
 #58

I wonder if the CLTV is not deployed in testnet yet

It could well be that not enough of the testnet peers have upgraded - I think the next step is to play with -regtest rather than -testnet (so you are mining your own blocks).


That's why I quitted using testnet (and people do not stop asking me why I do the tests in mainnet).
I emailed Josh Cincinnati from blockcypher.com and he said it would be better to run the test in our own testnet, or we can also use their testnet.

https://medium.com/blockcypher-blog/testnet-is-not-for-testing-5afa78b1394
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
January 02, 2016, 10:12:28 AM
 #59

Well - I've tried doing this with regtest but unfortunately there seems to be a problem.

Raw tx is as follows:
Code:
010000000194fb5e28b96182167b73934863fdc6cc23502f2574fdca8230b187fcc768171400000000cb4830450221008854a06bb9fd2fc81e9fe01666481e0fc297
d790e34ed9e801895c1ec101f67b02203692fc017ee22da4259260a71c87e89d15d6b0450f2b531859fc99c748b1aad6012102681362f33ab4c48884c5f7f5aaf501
1d53f0584cf0b257c6c3aff8b0b08241b34c5e76a820c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f26864687637576a9145e6199a3c0ad
658480247a0f30e314aee23db1eb88ac6701ffb17576a9145e6199a3c0ad658480247a0f30e314aee23db1eb88ac68000000000100f2052a010000001976a9145e61
99a3c0ad658480247a0f30e314aee23db1eb88acff000000

and decoded:
Code:
{
    "txid" : "f6ed82fd7f704bd06c93b9504217ea82209d458595e53f702ad3eb30b528109a",
    "version" : 1,
    "locktime" : 255,
    "vin" : [
        {
            "txid" : "141768c7fc87b13082cafd74252f5023ccc6fd634893737b168261b9285efb94",
            "vout" : 0,
            "scriptSig" : {
                "asm" : "30450221008854a06bb9fd2fc81e9fe01666481e0fc297d790e34ed9e801895c1ec101f67b02203692fc017ee22da4259260a71c87e
89d15d6b0450f2b531859fc99c748b1aad601 02681362f33ab4c48884c5f7f5aaf5011d53f0584cf0b257c6c3aff8b0b08241b3 76a820c775e7b757ede630cd0aa
1113bd102661ab38829ca52a6422ab782862f26864687637576a9145e6199a3c0ad658480247a0f30e314aee23db1eb88ac6701ffb17576a9145e6199a3c0ad65848
0247a0f30e314aee23db1eb88ac68",
                "hex" : "4830450221008854a06bb9fd2fc81e9fe01666481e0fc297d790e34ed9e801895c1ec101f67b02203692fc017ee22da4259260a71c8
7e89d15d6b0450f2b531859fc99c748b1aad6012102681362f33ab4c48884c5f7f5aaf5011d53f0584cf0b257c6c3aff8b0b08241b34c5e76a820c775e7b757ede63
0cd0aa1113bd102661ab38829ca52a6422ab782862f26864687637576a9145e6199a3c0ad658480247a0f30e314aee23db1eb88ac6701ffb17576a9145e6199a3c0a
d658480247a0f30e314aee23db1eb88ac68"
            },
            "sequence" : 0
        }
    ],
    "vout" : [
        {
            "value" : 50.00000000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 5e6199a3c0ad658480247a0f30e314aee23db1eb OP_EQUALVERIFY OP_CHECKSIG",
                "hex" : "76a9145e6199a3c0ad658480247a0f30e314aee23db1eb88ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "mp7zjTrEszZezRBM1cUmTvaK2zf3MuDAHt"
                ]
            }
        }
    ]
}

I can even issue a "signrawtransaction" and I get this:
Code:
{
    "hex" : "010000000194fb5e28b96182167b73934863fdc6cc23502f2574fdca8230b187fcc7681714000000004948304502210089efd7a1beef7bc3eebde1c
874e0f9092419b2e06b6e0643113d82e532b3e22402207f1350abc802da40a274dfb25969819225c9f61ed2852e4106616a6df3dd17fa01000000000100f2052a010
000001976a9145e6199a3c0ad658480247a0f30e314aee23db1eb88acff000000",
    "complete" : true
}

which all looks fine - but when I attempt to send it I get this:
Code:
error: {"code":-26,"message":"16: mandatory-script-verify-flag-failed (Non-canonical DER signature)"}

Sad

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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
sniveling
Sr. Member
****
Offline Offline

Activity: 719
Merit: 250


View Profile
January 03, 2016, 05:02:15 AM
 #60

I cut and pasted your transaction from here into the webbtc page for relaying transactions to testnet3. The page said there was an error because the transaction context was invalid, and rule "prev_out" failed to validate.

I think I basically have the correct raw tx but still Bitcoin won't allow me to send it.

Code:
0100000001bbc6c76fd91bee5badfb0746204adba70efceb04f21a270de566827dbc34e84100000000cc47304402204d5c2b9a9a5a9e467a77d87c0de310c1fa1be7
7f9ff36f640c730a04597046d702207d9388d3d5edb4249215d69e01cc112ab4d1a6dc8c720a5fc2bb2e3c71c4ba87012102d1570ab314b7b32ffe76f31232805a72
7d05119958d14b0b8aff9df5709676884c6076a820c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f26864687637576a91401d7295f243a3a
6d26516b54e4e6f51278d376b588ac6703ac9a09b17576a914b6a7c89a6774de8c88d0b7a4043a6645983a479588ac68000000000120a10700000000001976a9148a
7dd4d0e29f50f989dd2b97d463d706a7ef0c7b88ac809c0900





This is the transaction relaying page link, and the error message.

https://test.webbtc.com/relay_tx

Quote
Error: Transaction context invalid.

Rule "prev_out" failed to validate:
Prev out 41e834bc7d8266e50d271af204ebfc0ea7db4a204607fbad5bee1bd96fc7c6bb:0 not found.

Although I searched webbtc for 41e834bc7d8266e50d271af204ebfc0ea7db4a204607fbad5bee1bd96fc7c6bb it couldn't find it.
Pages: « 1 2 [3] 4 »  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!