Bitcoin Forum
October 17, 2019, 06:19:22 AM *
News: Latest Bitcoin Core release: 0.18.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: How to assemble this type of pay to pubkey hash transaction ?  (Read 208 times)
ytrezq
Member
**
Offline Offline

Activity: 187
Merit: 11


View Profile
April 06, 2019, 07:49:04 AM
Last edit: April 06, 2019, 11:45:33 AM by ytrezq
 #21

The wallet does it for you. You don't have to worry about assembling a script or anything.

You're just after sending bitcoins right?
Ah. Ok.
I found how this works… This type of transaction can only be pay to script hash where scripting is exected on redeeming.

So how to redeem coins with a wallet ?
1571293162
Hero Member
*
Offline Offline

Posts: 1571293162

View Profile Personal Message (Offline)

Ignore
1571293162
Reply with quote  #2

1571293162
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1571293162
Hero Member
*
Offline Offline

Posts: 1571293162

View Profile Personal Message (Offline)

Ignore
1571293162
Reply with quote  #2

1571293162
Report to moderator
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 1526
Merit: 1320


https://bit.ly/2FR9nyn - free python tutorials


View Profile
April 06, 2019, 09:55:37 AM
 #22

Pay to script is when you're transferring to a multisig afdress%?
p2pkh is where you're paying to a public key hash.

If it's the first one, the redeem script is generated by the client with the multisig address.

Why can't you just use walllet software in a virtual environment and just delete it after?

Edit: if you have bitcoin core then just click on send and send the coins wherever you want. I haven't used core in a while as my Internet is censored though.

ytrezq
Member
**
Offline Offline

Activity: 187
Merit: 11


View Profile
April 06, 2019, 10:17:35 AM
Last edit: April 06, 2019, 11:49:15 AM by ytrezq
 #23

Pay to script is when you're transferring to a multisig afdress%?
p2pkh is where you're paying to a public key hash.

If it's the first one, the redeem script is generated by the client with the multisig address.

Why can't you just use walllet software in a virtual environment and just delete it after?

Edit: if you have bitcoin core then just click on send and send the coins wherever you want. I haven't used core in a while as my Internet is censored though.
No :
From bitcoin core standard.cpp :
Code:
static bool MatchPayToPubkey(const CScript& script, valtype& pubkey)
{
    if (script.size() == CPubKey::PUBLIC_KEY_SIZE + 2 && script[0] == CPubKey::PUBLIC_KEY_SIZE && script.back() == OP_CHECKSIG) {
        pubkey = valtype(script.begin() + 1, script.begin() + CPubKey::PUBLIC_KEY_SIZE + 1);
        return CPubKey::ValidSize(pubkey);
    }
    if (script.size() == CPubKey::COMPRESSED_PUBLIC_KEY_SIZE + 2 && script[0] == CPubKey::COMPRESSED_PUBLIC_KEY_SIZE && script.back() == OP_CHECKSIG) {
        pubkey = valtype(script.begin() + 1, script.begin() + CPubKey::COMPRESSED_PUBLIC_KEY_SIZE + 1);
        return CPubKey::ValidSize(pubkey);
    }
    return false;
}

static bool MatchPayToPubkeyHash(const CScript& script, valtype& pubkeyhash)
{
    if (script.size() == 25 && script[0] == OP_DUP && script[1] == OP_HASH160 && script[2] == 20 && script[23] == OP_EQUALVERIFY && script[24] == OP_CHECKSIG) {
        pubkeyhash = valtype(script.begin () + 3, script.begin() + 23);
        return true;
    }
    return false;
}
Anything else will result in the payment being made to the address generated from the hash of the script instead of the addresses specified as far I understand. With a such strict enforcement, I wonder why Bitcoin ever had to disable opcodes.
Otherwise why using a virtual environment when I installed the wallet directly.

And about your case, what about hidden tor ? (aka tor over ʜᴛᴛᴘꜱ) (Bitcoin core even as an option to use tor)
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 1526
Merit: 1320


https://bit.ly/2FR9nyn - free python tutorials


View Profile
April 06, 2019, 11:01:10 AM
 #24

Yeah I also can't use tor and most vpns though it's only for a few months...

And I'm guessing you're now talking about op_scriptSig. Although you're going to want to look at what the script code actually does as all you have there is something that identifies the key type.

ytrezq
Member
**
Offline Offline

Activity: 187
Merit: 11


View Profile
April 06, 2019, 03:05:56 PM
 #25

Yeah I also can't use tor and most vpns though it's only for a few months...
Is your connection restricted to a whitelist ? Is ʜᴛᴛᴘꜱ blocked (or do you have to install a custom certificate in order to have your connection inspected) ? Is real bandwidth above 160Kb/s ? Otherwise, there’s no reason you shouldn’t be able to not access tor (not directly but over an ʜᴛᴛᴘꜱ relay). I would also add without paying for anything of course.

And I'm guessing you're now talking about op_scriptSig. Although you're going to want to look at what the script code actually does as all you have there is something that identifies the key type.
No, I don’t know if you understand the code above, but if you do you can see that in order to have the payment appear in block explorers to be made to a recipient, there’s no room for adding or exchanging opcodes (transaction size is fixed).

What I wanted to do is to send the payment directly without requiring the recipient to redeem it from the address of script first. So as far I understand, this is not possible. Please correct me if I’m wrong.
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 1526
Merit: 1320


https://bit.ly/2FR9nyn - free python tutorials


View Profile
April 06, 2019, 03:43:25 PM
Merited by ETFbitcoin (1)
 #26

I think it's an issue with how the network runs although it could be the http/https thing as it is a research institution so they'll want to keep connections as secure as possible, you also have to use their dns and no one else's (probably for the logs thing again).

The wifi also requires 801.x aes certificates (from what I can remember when setting it up - it took about a week as I had to go to the labs to download the certificate and then install it on my computer). My connection is about 50Mbps here I think which is slow.

No, I don’t know if you understand the code above, but if you do you can see that in order to have the payment appear in block explorers to be made to a recipient, there’s no room for adding or exchanging opcodes (transaction size is fixed).

What I wanted to do is to send the payment directly without requiring the recipient to redeem it from the address of script first. So as far I understand, this is not possible. Please correct me if I’m wrong.

I can't understand something from 10 lines of code without seeing what the other subroutines do that are called. To be honest, you're better off looking at the bitcoin wiki in order to work out how transactions are actually made and broadcast (it's hard to understand code sources without relevant documents).

Once again I think there's some multisig confusion as a redeem script only occurs with multisig (afaik).
Once you sign a transaction it can then be broadcast so they don't have to add it to their wallet (unless they can't connect to the internet).

Transactions are sort of fixed size (I think there's an extra 20 bytes you can add somewhere which is what miners do when setting the nonce for a block in a coinbase transaction).



Ahhh, this is what you keep referencing: https://en.bitcoin.it/wiki/Transaction#Data

This might be more helpful although I can''t find where OP_DUP is mentioned, https://en.bitcoin.it/wiki/Script#Standard_Transaction_to_Bitcoin_address_.28pay-to-pubkey-hash.29


Back to the original point, can you not use bitcoin core to generate and sign your transaction if you have it downloaded and installed?
If you want to use the command line then the commands are still a lot easier than what you're trying to do here...

ytrezq
Member
**
Offline Offline

Activity: 187
Merit: 11


View Profile
April 06, 2019, 05:41:52 PM
 #27

I think it's an issue with how the network runs although it could be the http/https thing as it is a research institution so they'll want to keep connections as secure as possible, you also have to use their dns and no one else's (probably for the logs thing again).

The wifi also requires 801.x aes certificates (from what I can remember when setting it up - it took about a week as I had to go to the labs to download the certificate and then install it on my computer). My connection is about 50Mbps here I think which is slow.
Ah ! I understand better now… Why Don’t your have a personal connection outside ? Does the certificate you have is just for accessing Wi‑Fi or is it just for being able to decipher arbitrary secure connections ? If you can’t access Wi‑Fi without it, then it’s a client certificate which acts like a personal account with password and has nothing to do with ʜᴛᴛᴘꜱ.

Step aside : my future job is to design such kind of protection in corporate environments in real life (or public hotspot). I can say that most of what you see often boils down to just allow port 80 and 443 and ᴍᴀᴄ addresses. Why never allow custom ᴅɴꜱ servers ? Because how easy it is to send ɪᴘ traffic over a protocol which can use ᴜᴅᴘ.
 Though more expensive filters exist.
I can't understand something from 10 lines of code without seeing what the other subroutines do that are called. To be honest, you're better off looking at the bitcoin wiki in order to work out how transactions are actually made and broadcast (it's hard to understand code sources without relevant documents).

Once again I think there's some multisig confusion as a redeem script only occurs with multisig (afaik).
Once you sign a transaction it can then be broadcast so they don't have to add it to their wallet (unless they can't connect to the internet).

Transactions are sort of fixed size (I think there's an extra 20 bytes you can add somewhere which is what miners do when setting the nonce for a block in a coinbase transaction).



Ahhh, this is what you keep referencing: https://en.bitcoin.it/wiki/Transaction#Data

This might be more helpful although I can''t find where OP_DUP is mentioned, https://en.bitcoin.it/wiki/Script#Standard_Transaction_to_Bitcoin_address_.28pay-to-pubkey-hash.29
The code explains how to check if the transaction is Pay to Pubkey or Pay to Pubkey Hash. The parameters called are from C++ vectors, otherwise the name are very clear without having the underlying definition. If they return false then it means the transaction doesn’t match the underlying type (they also compute the target address of the transaction).

For example, in order to be a pay to Pubkey hash the transaction Script must be in the following conditions :
  • The Script is 25 bytes long.
  • The first byte match the OP_DUP opcode
  • The second byte match the OP_HAS160 opcode
  • The third byte math a 20 bytes pushdata which is the only part of the transaction which can be anything (in practice the address)
  • The 24 byte match the OP_EQUALVERIFY opcode
  • The 25 and last byte match the OP_DUP opcode

Anything else not being SegWit is either a pay to Script Hash or a nonstandard transaction which should be rejected. That is the payment is not done to the address specified but to the address generated from the hash of the Script (MultiSig might need to be merged in Scripting one day).


Back to the original point, can you not use bitcoin core to generate and sign your transaction if you have it downloaded and installed?
If you want to use the command line then the commands are still a lot easier than what you're trying to do here...
Unfortunately, I both need a wallet and manual because I don’t know how to use Bitcoin core for that.
Pages: « 1 [2]  All
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!