How to import address of one node to another in multichain

+2 votes

Hi, 

I am trying to import address of one node in a multichain to another node using "importaddress" API.But I am getting this error:

error code: -5
error message:
Invalid MultiChain address or script

I am importing address of 2nd node in that same multichain to get watch-only address on available on that node. Could you suggest a solution for this problem?

 

 

asked Oct 27, 2016 by John Doe

1 Answer

0 votes

This should work fine, so long as both nodes are on the same network/blockchain. Perhaps you can check that with getinfo and getblockchainparams? By default, MultiChain uses a separate address space for each chain to prevent transactions intended for one chain accidentally being performed on another, but this can be overridden in the blockchain parameters file when setting up a chain.

If the nodes are on the same chain, then it would be helpful to see a full transcript of what you're doing to understand where the problem might lie.

answered Oct 27, 2016 by MultiChain
I had just changed the rpcport in multichain.conf file while setting up the chain. Is it possible that has created some problem in importaddress? Nothing else is changed in the blockchain params.
The rpcport will not affect the addressing. If possible, please post the output of getblockchainparams for both chains, and a transcript of the steps you're taking.
this is node 1 blockchain params:
{
    "chain-protocol" : "multichain",
    "chain-description" : "<my-chain-name>",
    "chain-is-testnet" : false,
    "target-block-time" : 60,
    "maximum-block-size" : 1000000,
    "default-network-port" : 7359,
    "default-rpc-port" : 7358,
    "anyone-can-connect" : false,
    "anyone-can-send" : false,
    "anyone-can-receive" : false,
    "anyone-can-issue" : false,
    "anyone-can-mine" : false,
    "anyone-can-activate" : false,
    "anyone-can-admin" : false,
    "allow-p2sh-outputs" : true,
    "allow-multisig-outputs" : true,
    "setup-first-blocks" : 60,
    "mining-diversity" : 0.30000000,
    "admin-consensus-admin" : 0.50000000,
    "admin-consensus-activate" : 0.50000000,
    "admin-consensus-mine" : 0.50000000,
    "admin-consensus-issue" : 0.00000000,
    "mining-requires-peers" : true,
    "first-block-reward" : -1,
    "initial-block-reward" : 0,
    "reward-halving-interval" : 52560000,
    "reward-spendable-delay" : 1,
    "minimum-per-output" : 0,
    "maximum-per-output" : 100000000000000,
    "minimum-relay-fee" : 0,
    "native-currency-multiple" : 100000000,
    "skip-pow-check" : false,
    "pow-minimum-bits" : 16,
    "target-adjust-freq" : 86400,
    "allow-min-difficulty-blocks" : false,
    "only-accept-std-txs" : true,
    "max-std-tx-size" : 100000,
    "max-std-op-return-size" : 4096,
    "max-std-op-drops-count" : 5,
    "max-std-element-size" : 600,
    "chain-name" : "scmpoc",
    "protocol-version" : 10005,
    "network-message-start" : "f9e9e4ee",
    "address-pubkeyhash-version" : "00f07e68",
    "address-scripthash-version" : "05f42081",
    "private-key-version" : "80f7abc4",
    "address-checksum-value" : "98149bf7",
    "genesis-pubkey" : "036e2ef95799ddbefb844ecaa8205bb2c8085e06d14cefd6b945cafb843a7c513f",
    "genesis-version" : 1,
    "genesis-timestamp" : 1475829458,
    "genesis-nbits" : 520159231,
    "genesis-nonce" : 87612,
    "genesis-pubkey-hash" : "725daa9a3a2c02152e7e7c3d0576057530f4d49b",
    "genesis-op-return-script" : "5b6e6f74207365745d",
    "genesis-hash" : "000046407f20f50c7ec83ffac1f2a7b33296ae371cbb009a7089ac9763124bad",
    "chain-params-hash" : "42c1bcd269d250392c41fba2811877f3ee4b59c78dc5f590e2faba68bfe84cbe"
}

node 2:
{
    "chain-protocol" : "multichain",
    "chain-description" : "<my-chain-name>",
    "chain-is-testnet" : false,
    "target-block-time" : 60,
    "maximum-block-size" : 1000000,
    "default-network-port" : 7359,
    "default-rpc-port" : 7358,
    "anyone-can-connect" : false,
    "anyone-can-send" : false,
    "anyone-can-receive" : false,
    "anyone-can-issue" : false,
    "anyone-can-mine" : false,
    "anyone-can-activate" : false,
    "anyone-can-admin" : false,
    "allow-p2sh-outputs" : true,
    "allow-multisig-outputs" : true,
    "setup-first-blocks" : 60,
    "mining-diversity" : 0.30000000,
    "admin-consensus-admin" : 0.50000000,
    "admin-consensus-activate" : 0.50000000,
    "admin-consensus-mine" : 0.50000000,
    "admin-consensus-issue" : 0.00000000,
    "mining-requires-peers" : true,
    "first-block-reward" : -1,
    "initial-block-reward" : 0,
    "reward-halving-interval" : 52560000,
    "reward-spendable-delay" : 1,
    "minimum-per-output" : 0,
    "maximum-per-output" : 100000000000000,
    "minimum-relay-fee" : 0,
    "native-currency-multiple" : 100000000,
    "skip-pow-check" : false,
    "pow-minimum-bits" : 16,
    "target-adjust-freq" : 86400,
    "allow-min-difficulty-blocks" : false,
    "only-accept-std-txs" : true,
    "max-std-tx-size" : 100000,
    "max-std-op-return-size" : 4096,
    "max-std-op-drops-count" : 5,
    "max-std-element-size" : 600,
    "chain-name" : "scmpoc",
    "protocol-version" : 10005,
    "network-message-start" : "f9e9e4ee",
    "address-pubkeyhash-version" : "00f07e68",
    "address-scripthash-version" : "05f42081",
    "private-key-version" : "80f7abc4",
    "address-checksum-value" : "98149bf7",
    "genesis-pubkey" : "036e2ef95799ddbefb844ecaa8205bb2c8085e06d14cefd6b945cafb843a7c513f",
    "genesis-version" : 1,
    "genesis-timestamp" : 1475829458,
    "genesis-nbits" : 520159231,
    "genesis-nonce" : 87612,
    "genesis-pubkey-hash" : "725daa9a3a2c02152e7e7c3d0576057530f4d49b",
    "genesis-op-return-script" : "5b6e6f74207365745d",
    "genesis-hash" : "000046407f20f50c7ec83ffac1f2a7b33296ae371cbb009a7089ac9763124bad",
    "chain-params-hash" : "42c1bcd269d250392c41fba2811877f3ee4b59c78dc5f590e2faba68bfe84cbe"
}
Great, so those are definitely identical. Can you please also publish a transcript of the full process of getting the address from one node to the other? That will also let us check the address using your blockchain parameters.
I had created assets for nodes and transferred some amount to other. Then I had done some transactions using raw exchange. After that only i tried importaddress API
multichain-cli <my-chain-name> importaddress <my-other-node-address>

and got this error:

 error code: -5
error message:
Invalid MultiChain address or script
Thanks, but we need to see the address you tried to import. It would also be helpful to see the output from getaddresses on both nodes.
first node address: [
    "1GTWfMEiPJiYCXxf6sPqUFaM5fyhjnZD3qJMYT"
]
second node address:
[
    "17jzKBagvRsAjVD7dcsuT9AKi7PcuUPh9FCP7H"
]
It is working now. Thanks. I just tried once again.
How you get those address information for each node ?
...