Title: How to get wallet address from txin script, address of first character is "3"? Post by: yky_sh on October 12, 2016, 08:26:02 PM Now, I analysis the block information, and I don't know how to get the wallet address which first character is “3”. the tx in script is as follow.
Tx In Script: 0x00, 0x47, 0x30,0x44,0x02,0x20, 0x0c,0xf1,0x83,0x78,0x7d,0x2f,0x7e,0xf3,0x87,0xe1,0x40,0x46,0xe7,0xf3,0x8d,0x94,0x42,0xb3,0x16,0xd6,0x90,0xb3,0x11,0x6d,0xa6,0xc6,0x0d,0x4b,0x8d,0x1b,0xb5,0x43, 0x02,0x20,0x30,0x16,0x93,0xba,0x31,0xb5,0xaa,0xd8,0xd7,0x54,0x2a,0x67,0x3e,0x6b,0x96,0xf4,0x83,0x01,0x52,0xec,0x6d,0x26,0xf3,0xa8,0xbf,0x1d,0x37,0x76,0xf3,0x9d,0xe5,0x1d,0x01, 0x48, 0x30,0x45,0x02,0x21, 0x00,0x9c,0xd1,0xc1,0xb3,0xe1,0xec,0x93,0xcd,0x58,0x52,0xb4,0x2f,0xa5,0x6b,0x6a,0xf7,0x06,0xa0,0x9b,0x00,0xe0,0x56,0xd1,0xfd,0x13,0x13,0xfa,0xb4,0x23,0xbb,0x79,0x43, 0x02,0x20,0x13,0x27,0x34,0x7f,0x6c,0x9b,0xc8,0x10,0x6d,0xca,0x4e,0xb8,0x4d,0xe3,0x6b,0xd2,0x42,0xf0,0x97,0x03,0x88,0xab,0x7c,0xd5,0x86,0xe1,0x84,0x3b,0x84,0xb0,0x45,0x20, 0x01, 0x47, 0x52,0x21, 0x02,0x30,0x9d,0x6a,0x9d,0x97,0xa3,0xe8,0x14,0x24,0x7d,0x47,0x1d,0xdc,0x2c,0x47,0x6c,0x04,0x6f,0x9c,0x07,0xd9,0x80,0x79,0xd8,0x61,0xe3,0x44,0x79,0xc1,0x94,0x97,0xea,//public key 1 0x21, 0x03,0xc5,0x11,0xb8,0xfe,0x3a,0x5e,0x60,0xad,0x16,0xbb,0x14,0xb0,0x86,0x5f,0x8a,0x3f,0x19,0x2d,0xdb,0x38,0x6c,0x4f,0x8d,0x23,0xf7,0x2e,0xdd,0x24,0x76,0x4e,0x0e,0x23,//public key 2 0x52, 0xae, I know the P2SH calculation, as follow, 1:Hash1 = sha256(public key); 2:Hash2 = RIPEMD160(Hash1), Then, get first 20 hex; 3:get check code, sha256(sha256(0x05 or 0x00 + first 20 hex)), and get first 4 hex as the check code; 4:put the check code to the end of first 20 hex; 5:address, Encode(0x00 or 0x05 + first 20 hex + 4 hex check code); according the script, there are two public keys in the script, so I don't know which public key to use or these is other calculation . Thank you for your help. Title: Re: How to get wallet address from txin script, address of first character is "3"? Post by: achow101 on October 12, 2016, 08:35:06 PM I know the P2SH calculation, as follow, No, it is the hash of the redeemscript, not any of the public keys. In this case, the redeemscript starts with 0x52 and goes to the end.1:Hash1 = sha256(public key); Title: Re: How to get wallet address from txin script, address of first character is "3"? Post by: yky_sh on October 12, 2016, 08:43:32 PM I know the P2SH calculation, as follow, No, it is the hash of the redeemscript, not any of the public keys. In this case, the redeemscript starts with 0x52 and goes to the end.1:Hash1 = sha256(public key); yeah, you are correct. Thank you very much. Title: Re: How to get wallet address from txin script, address of first character is "3"? Post by: pebwindkraft on October 13, 2016, 06:11:59 AM just to verify, if my script is working correctly: is it " 33f7emzpgYE4JC5Wo4Gk8HZKYRu1Cqcguu" ?
I tried to decode the scriptsig, and get this result: Code: 47: OP_DATA_0x47: push hex 47 (decimal 71) bytes as data |