0

I would like to ask the following. I've downloaded Bitcoin Core and just start using their "Console". Before I can createrawtransaction, I need to first set up a node in Bitcoin Core, right? If yes, I did follow the instruction in https://developer.bitcoin.org/reference/rpc/index.html.

However, when I want to apply a node for myself that is using --> addnode "167.172.250.161:8333" "onetry"

but end up is Null although I have requested for "getnodeaddresses" as per the screenshot:

enter image description here

Please advise as I need to "importprivkey" in order to perform the createrawtransaction.

Also, my apology I would like to ask this as well. Why when I send createrawtransaction in the Bitcoin Core Console, the error it states here that the error - Method not found (code -32601). Anyone can advise or provide guidance to me? I'm no expert in this. Thanks in advance.

enter image description here

1 Answer 1

1

Running Bitcoin Core (bitcoind or bitcoin-qt) already means running a node. You don't need to set it up.

The addnode function is used to manually add a connection to another node. This is not something necessary, unless you have specific reasons to connect to a particular node (e.g. a node you trust). This function does not return any object (although executed successfully), which is why get null in return.

getnodeaddresses returns a random subset of node addresses known to your node.

As for the RPC methods, generateprivkey does not exist, while the error for createrawtransaction is probably due to a wrong input format (you are missing the squared brackets in the second object) The correct format is:

[{"txid":"id","vout":n},...] [{"address":amount},{"data":"hex"},...]

Also note that you won't be able to create a transaction without having the corresponding keys in your wallet.

7
  • Thanks for correcting my mistakes and explain that I don't need to set up a node in it. As for the createrawtransaction format, I would like to ask the following: createrawtransaction [{"txid":"hex","vout":n,"sequence":n},...] [{"address":amount},{"data":"hex"},...] Okay, as for the "sequence" is the private key right? (this one I'm stuck with error in the command line in Console using "importprivkey") and the "data" --> it said as "key-value pair" where can I get this?
    – Jsim
    Sep 10, 2020 at 4:36
  • A basic transaction has 1 or more inputs of the type (txid:vout), corresponding to unspent outputs from previous transactions sent to your address, and 1 or more outputs of the type (address:amount). The correct sequence of actions you need is: 1. create the raw transaction, 2. sign it, 3. broadcast it. You might want to take a look at some step-by-step guide, like this one: medium.com/coinmonks/… . You will find many on the Internet.
    – FedFranz
    Sep 11, 2020 at 11:09
  • When you import a private key, the client should rescan the blockchain to see what transactions are spendable with such a key. You can then check the list of unspent outputs to create a new transaction. Please consider using testnet to learn, instead of mainnet. You can obtain testnet coins for free from any "faucet" on the internet
    – FedFranz
    Sep 11, 2020 at 11:13
  • thanks for the clear explanation. I have checked out on the link medium.com/coinmonks/… sorry as I'm no expert and non-developer. those script of Create a raw transaction, where can I run it? Like Atom Editor? Command Prompt? But I don't think I can run that script in Bitcoin Core right? Correct me and guide me, many thanks.
    – Jsim
    Sep 11, 2020 at 14:00
  • Those are command line instructions (so from the prompt). I don't know the console, I guess it works the same way. But if you are no expert and you do not need to use the console to send transactions. Just look for the corresponding function in the software interface.
    – FedFranz
    Sep 11, 2020 at 14:21

Your Answer

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

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