0

I have a private key and trying to create P2SH address on testnet like my node created but they're not same. Please help me a bit, thanks so much.
PrivateKey: c5964e19634e473e9c8fed3b149c4d44b6d62d62724035aad3eb911a1495ae27
P2SH address from 1 threshold and 1 pubkey: 2N4GriyLchUgwwCBonzYHgsCHNhYRHW45w7
P2WPKH address: 2NGA8uGdnaQ21phNpVyV5uye5cbUtudxBWh || tb1qld2fzw9gj30wxjamsz73fug62das7cyq0em4mn
Address from node: 2N8qKVKuR3QAy2cA5fF2QbuCpBGfGCmbUHx
Here is more detail from getaddressinfo:

{
    "result": {
        "address": "2N8qKVKuR3QAy2cA5fF2QbuCpBGfGCmbUHx",
        "scriptPubKey": "a914aafc9f09b99cbb1ba46001ec4868ba4fb32543ca87",
        "ismine": true,
        "solvable": true,
        "desc": "sh(wpkh([a1696bdc/0'/0'/375509']02a7065a210c28d27a591e55ac6be092111349fc4b23927bb4d13c46a683bcfff7))#hrgzj3gs",
        "iswatchonly": false,
        "isscript": true,
        "iswitness": false,
        "script": "witness_v0_keyhash",
        "hex": "00146da71bc5de0c0b59bbf73520df7e7d4048d02594",
        "pubkey": "02a7065a210c28d27a591e55ac6be092111349fc4b23927bb4d13c46a683bcfff7",
        "embedded": {
            "isscript": false,
            "iswitness": true,
            "witness_version": 0,
            "witness_program": "6da71bc5de0c0b59bbf73520df7e7d4048d02594",
            "pubkey": "02a7065a210c28d27a591e55ac6be092111349fc4b23927bb4d13c46a683bcfff7",
            "address": "tb1qdkn3h3w7ps94nwlhx5sd7lnagpydqfv5pyqurf",
            "scriptPubKey": "00146da71bc5de0c0b59bbf73520df7e7d4048d02594"
        },
        "label": "test",
        "ischange": false,
        "timestamp": 1561438016,
        "hdkeypath": "m/0'/0'/375509'",
        "hdseedid": "e2e9dd17501f967b789c28c4be1dbf64897ad8d2",
        "hdmasterfingerprint": "a1696bdc",
        "labels": [
            {
                "name": "test",
                "purpose": "receive"
            }
        ]
    },
    "error": null,
    "id": 1
}
  • do you have same code for create the P2SH, if yes, can you public it? – vincenzopalazzo Sep 11 at 9:14
  • @vincenzopalazzo, of course bro: pastebin.com/dL5vW22T – mmo2112 Sep 11 at 9:44
  • if possible the bitcoin RPC and the bitcoinj generated two scripts different p2shScript? – vincenzopalazzo Sep 11 at 10:33
  • @vincenzopalazzo, is that true? I don't think that bro... Maybe by someway can create many p2sh address? – mmo2112 Sep 11 at 12:49
  • 1
    That's because you changed your private/public key when switched method! The private key you posted has a public key starting with 033452B8 the "node" is using a public key starting with 02a7065a – Coding Enthusiast Sep 11 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.