As I understood I should use `importmulti` request. But I do not know which kind of script, address etc should place if I just need to import bulk of keys
If your private keys start with "5", it means their public key is uncompressed. So, it's P2PKH. So make sure your wallet is not descriptor.
For example which request should I run to import such of keys?
Why don't you loop
importprivkey?
bitcoin-cli importprivkey "private_key" "label" false
With RPC, it'd be:
curl -u USERNAME:PASSWORD --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "importprivkey", "params": ["PRIVATE_KEY", "label_x", false]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/wallet/WALLET_NAME
Create a txt file and insert your private keys there like:
5Jza3odChZ1vfzmRSSK6qJZCuGdXYR4RndFHXx1KEWq9AiDkwCj
5JebES9429R4HNFUcX5kFgR7FAoFWxpHZ3XrvAf4bSNNxijzxRB
5J4WYCjKqG7JxY3fjj2ukusd36mXMVas42bTh2nesd6HwaFtwh7
Now create this bash script. It reads every line of your text file and runs the
curl command.
#!/bin/bash
for i in `seq 1 3`;
do
line="`head -$i foo.txt | tail +$i`"
echo $line;
curl -u USERNAME:PASSWORD --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "importprivkey", "params": ["'$line'", "any_label", false]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/wallet/WALLET_NAME;
done
Replace USERNAME, PASSWORD and WALLET_NAME accordingly. On linux you can run it with:
I'd make sure I connect to my Bitcoin server via a secure transfer protocol, because there's sensitive info transferred.