How could I get my wallet address on testnet ?



  • Hello,

    I've build Qtum core on my Mac following the instruction here:
    https://github.com/qtumproject/qtum/blob/master/README.md

    The get info command is :
    ./qtum-cli -getinfo -rpcport=13889 -rpcuser=test -rpcpassword=test1234

    And the output seems to be OK:
    {
    "version": 160200,
    "protocolversion": 70016,
    "walletversion": 159900,
    "balance": 0.00000000,
    "stake": 0.00000000,
    "blocks": 256945,
    "timeoffset": 0,
    "connections": 8,
    "proxy": "",
    "difficulty": {
    "proof-of-work": 1.52587890625e-05,
    "proof-of-stake": 759981.482879773
    },
    "testnet": true,
    "moneysupply": 101007780,
    "keypoololdest": 1543221433,
    "keypoolsize": 1000,
    "paytxfee": 0.00000000,
    "relayfee": 0.00400000,
    "warnings": ""
    }

    But I couldn't find my wallet anywhere in the config files. Or do I need to create a new one? I need address to ask for some test coin to develop my first smart contract on Qtum.

    Any advice is kindly regarded. Thanks in advance.
    Michael



  • Hey sontranrad,

    Looks like you are making good progress. If you have reached that state your wallet is running and has created a wallet.dat file which holds the private keys which create the public keys and Qtum addresses. Please try the command listaddressgroupings, which you can enter with qtum-cli to get a response like this:

    qtum-cli listaddressgroupings
    
    [
      [
        [
          "qWfzQsi4rFA6u3zCguC9t3wYjd6Sm693g7",
          0.00000000
        ],
        [
          "qNf6fad5wLyeMT5e3hYy4qWnxcbV6GenWK",
          0.00000000
        ],
        [
          "qUytYGp47McSy8N6GzycV2Wt92d8JqHWCy",
          0.00000000
        ],
    <snip>
      ]
    ]
    

    This shows the receiving addresses in your wallet, and you can pick one to sent test QTUM from the testnet faucet at http://testnet-faucet.qtum.info/#!/



  • @jb395 said in How could I get my wallet address on testnet ?:

    qtum-cli listaddressgroupings

    hi jb395,

    Thanks for your kind support. I tried the command as you said but it keeps saying the it couldn't connect to server, although the getinfo command still works well. Please advise if I'm missing something

    0_1543294424466_Screen Shot 2018-11-27 at 11.53.27 AM.png



  • Okay, try some other things.

    Sometimes you can get an error like that if the wallet is busy syncing the blocks.

    Try the command getconnectioncount and look for up to 8 connections.

    Try the command getblockchaininfo and look for "blocks" and "headers" to both show the same block height, about 257,628 for Testnet. This will show that your wallet is synced with the latest block.

    Then try listaddressgroupings again.



  • Hello JB395,

    I tried to use docker installation instead of building it on my real machine. And it works now. Thanks a lot. Btw, have you been able to parse txs in every block to detect if that tx is an invocation to a specific smart contract ? Hope to hear your sharing. Regards



  • @sontranrad this might be easier using the Insight API (since if has a view of the entire blockchain) than the node (which wants to talk about its transactions). Does your application have access to both of these?



  • @sontranrad

    To identify contract calls in block transactions, the command sequence you want looks like this:

    getblockhash <block number>

    • returns block hash

    getblock <block hash>

    • returns block details including transaction IDs

    getrawtransaction <transaction ID>

    • returns details about a transaction, parse these to identify the contract calls

    For getrawtransaction you need to launch the wallet with the -txindex parameter, to rebuild the database with an index for all transactions. Here is an example for recent block 272063:

    getblockhash 272063

    returns

    a7086557bc5e19e56c67a5fe4261490bffed3877699bdc95f52458d86e4e24bf

    getblock a7086557bc5e19e56c67a5fe4261490bffed3877699bdc95f52458d86e4e24bf

    returns a bunch of data, including

    "tx": [
      "ab1c7b4ad1ca7efee475181be606cf1c8ebea27c2b6e2c70efd333dedf4e9742",
      "c86af83f1344db0940acdddf1089f7776626f7890d992899459a5f6e30e93568",
      "561d18bf296d236742fe09297cb67bafada742043f4815104930acf97e4cf222",
      "9ad41d4f0620c15d49fd66ca53e9efc476c3c8f84179cb395a99e003aff6e77b",
      "b748e57212ff096b2e23952558fd60a805d1b192e2a4cce10ee9eac66874a52d",
      "e628c817cd0075dd6a1ba6bb717bf0fd6faf47e278ad2e0fc39a06ef8547febb",
      "0b13583cee553c9a30dbd7528ef0251c4e2ee610238d179b164cf0c429021fbe",
      "9fd00726f89b0e6f576b0b290d32f6d0e33403f190c014aeec3d0584264b0c01",
      "68e89657e9e459fc9cfad00760ddcc5eadc965910a92e5254e84b797552b8f4a",
      "d16bc388310b22b2033be8b6df15f7b815b4a33790c54e4462e4bd30d46d6bbf",
      "f690d6c9a1650d5fb8e8e82b53dbd07d48de362a98aacd0b04a3d6f781f4910b"
    ],
    

    I happen to know (from the Explorer) that the last one f690… is a contract call. In practice, just get all of these transactions and parse them to identify the contract calls. Here is the last one:

    getrawtransaction f690d6c9a1650d5fb8e8e82b53dbd07d48de362a98aacd0b04a3d6f781f4910b true

    returns

    {
      "txid": "f690d6c9a1650d5fb8e8e82b53dbd07d48de362a98aacd0b04a3d6f781f4910b",
      "hash": "f690d6c9a1650d5fb8e8e82b53dbd07d48de362a98aacd0b04a3d6f781f4910b",
      "version": 1,
      "size": 467,
      "vsize": 467,
      "locktime": 0,
      "vin": [
        {
          "txid": "093d7e0f1fcaf6ab1681342459d90ec99c0947e5625c90f17c832f3c0b54f7e0",
          "vout": 1,
          "scriptSig": {
            "asm": "3045022100915610a768334809950e899308e0bce62e18ba938c452956af894cc7ceb621bc02207f6090d56994f67bd5b0eb1b48be94c9b6d472e879b2380bf5f806f4bf884aef[ALL|ANYONECANPAY] 029da1c74c2df135ade22d1f77dc53b3ff32faa3821c94e54f8ed7906fbfa909f2",
            "hex": "483045022100915610a768334809950e899308e0bce62e18ba938c452956af894cc7ceb621bc02207f6090d56994f67bd5b0eb1b48be94c9b6d472e879b2380bf5f806f4bf884aef8121029da1c74c2df135ade22d1f77dc53b3ff32faa3821c94e54f8ed7906fbfa909f2"
          },
          "sequence": 4294967295
        },
        {
          "txid": "2d525aaa2022d846f6669644b804a10a08727f562326cf0e79a17442ae0057d0",
          "vout": 1,
          "scriptSig": {
            "asm": "3045022100b9e0d1790061f3fdfc3f969e6cde06e67e8c749d6cfc5f5d566c089bcf4afb7602205aa4e51f1f0cbbf66f2f6a6d581d44ef2ec84bd2e75ede4cfe94197487ccf928[ALL|ANYONECANPAY] 029da1c74c2df135ade22d1f77dc53b3ff32faa3821c94e54f8ed7906fbfa909f2",
            "hex": "483045022100b9e0d1790061f3fdfc3f969e6cde06e67e8c749d6cfc5f5d566c089bcf4afb7602205aa4e51f1f0cbbf66f2f6a6d581d44ef2ec84bd2e75ede4cfe94197487ccf9288121029da1c74c2df135ade22d1f77dc53b3ff32faa3821c94e54f8ed7906fbfa909f2"
          },
          "sequence": 4294967295
        }
      ],
      "vout": [
        {
          "value": 0.00000000,
          "n": 0,
          "scriptPubKey": {
            "asm": "4 a086010000000000 2800000000000000 a9059cbb0000000000000000000000004b2ec2ef77be9611c1d400d057c1d9fb364b3ef1000000000000000000000000000000000000000000000000000090dc644d6a80 72e531e37c31ecbe336208fd66e93b48df3af420 OP_CALL",
            "hex": "040400000008a0860100000000000828000000000000004d4400a9059cbb0000000000000000000000004b2ec2ef77be9611c1d400d057c1d9fb364b3ef1000000000000000000000000000000000000000000000000000090dc644d6a804d140072e531e37c31ecbe336208fd66e93b48df3af420c2",
            "type": "call"
          }
        },
        {
          "value": 0.07772600,
          "n": 1,
          "scriptPubKey": {
            "asm": "OP_DUP OP_HASH160 a0e0c87fec6b4359803483aea15b0cf59ebaf026 OP_EQUALVERIFY OP_CHECKSIG",
            "hex": "76a914a0e0c87fec6b4359803483aea15b0cf59ebaf02688ac",
            "reqSigs": 1,
            "type": "pubkeyhash",
            "addresses": [
              "QbGdWChEcbF6STTxyqdHhFLy3gbsk3gs2v"
            ]
          }
        }
      ],
      "hex": "0100000002e0f7540b3c2f837cf1905c62e547099cc90ed95924348116abf6ca1f0f7e3d09010000006b483045022100915610a768334809950e899308e0bce62e18ba938c452956af894cc7ceb621bc02207f6090d56994f67bd5b0eb1b48be94c9b6d472e879b2380bf5f806f4bf884aef8121029da1c74c2df135ade22d1f77dc53b3ff32faa3821c94e54f8ed7906fbfa909f2ffffffffd05700ae4274a1790ecf2623567f72080aa104b8449666f646d82220aa5a522d010000006b483045022100b9e0d1790061f3fdfc3f969e6cde06e67e8c749d6cfc5f5d566c089bcf4afb7602205aa4e51f1f0cbbf66f2f6a6d581d44ef2ec84bd2e75ede4cfe94197487ccf9288121029da1c74c2df135ade22d1f77dc53b3ff32faa3821c94e54f8ed7906fbfa909f2ffffffff02000000000000000076040400000008a0860100000000000828000000000000004d4400a9059cbb0000000000000000000000004b2ec2ef77be9611c1d400d057c1d9fb364b3ef1000000000000000000000000000000000000000000000000000090dc644d6a804d140072e531e37c31ecbe336208fd66e93b48df3af420c2b8997600000000001976a914a0e0c87fec6b4359803483aea15b0cf59ebaf02688ac00000000",
      "blockhash": "a7086557bc5e19e56c67a5fe4261490bffed3877699bdc95f52458d86e4e24bf",
      "confirmations": 148,
      "time": 1543400096,
      "blocktime": 1543400096
    }

Log in to reply
 

Looks like your connection to QTUM was lost, please wait while we try to reconnect.