I'm trying to send bitcoins from node2 with my address using private key noted that my address is created in node1.I followed this link: "https://en.bitcoin.it/wiki/How_to_import_private_keys" I dump private key in node1 using this command:

bitcoin-cli -testnet -rpcuser=test -rpcpassword=test123 dumpprivkey "2N7YvA6ZBjFvXE3wuNQH4csev1QUWtrzYgA"

Then I imported private key in node2 through this command:

bitcoin-cli -testnet -rpcuser=test -rpcpassword=test123 importprivkey cNKbGVQvQgJsJuRy25ggZ71BRA9UZyEPCMekdntnZDWjYTg9TpRu

now I want to send bitcoin from node2 with my address to different address

can anyone please give me solution to make transaction using my address private key thanking you in advance


2 Answers 2


I performed the scenario described, using these commands:

// create a new wallet. Extra options are needed to not create a descriptor-based wallet, to be able to dump privkey
bitcoin-cli -testnet -rpcuser=XXX -rpcpassword=XXX createwallet "test1" false false "" false false
bitcoin-cli  ...  getwalletinfo
// generate an address
bitcoin-cli  ...  getnewaddress
--> tb1qha...zxejw7
// dump its private key
bitcoin-cli  ...  dumpprivkey "tb1qha...zxejw7"
--> cRJzVP...cZTcV5
// send some funds to this address
bitcoin-cli  ...  getwalletinfo

// in another instance, create another wallet
bitcoin-cli  ...  createwallet "test2" false false "" false false
bitcoin-cli  ...  getwalletinfo
// import privkey of previous address. This can take a long time (many minutes), due to rescanning
bitcoin-cli  ...  importprivkey "cRJzVP...cZTcV5"
bitcoin-cli  ...  getwalletinfo
--> balance of the address shows up here
// Perform a send to another address
bitcoin-cli  ...  sendtoaddress "tb1qp2...n9qw92" 0.0001 "" "" true
bitcoin-cli  ...  getwalletinfo

You can use createrawtransaction to create a raw transaction, in which you can specify your custom inputs and outputs. In this case you would specify the input to be the address from node2, and output/outputs to be addresses you are sending bitcoins to. Use signrawtransaction to sign raw transaction it using your imported private key and sendrawtransaction to send it to the network.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.