TeachMeBitcoin

The Human Interface: CLI vs GUI vs RPC

From TeachMeBitcoin, the free encyclopedia Reading time: 2 min

36. The Human Interface: CLI vs GUI vs RPC

How do you talk to your node? There are three main ways.

The Bitcoin-CLI Bridge

In src/bitcoin-cli.cpp, the node translates your typed words into "JSON" messages that the node can understand. It is the "Translator of the Terminal." It is the "Bridge of the Bash."

/**
 * Translates a human command (like "getbalance") into an RPC request.
 * Sends the request to the bitcoind node and displays the answer.
 */
int main(int argc, char* argv[])
{
    // Building the "Request" message.
    UniValue reply = CallRPC(strMethod, args);

    // Printing the answer to the user's screen.
    printf("%s\n", reply.write().c_str());
}

Explaining the Code: The Voice of the User

  1. CallRPC: This is the "Phone Call" from the terminal to the daemon. It travels through a "Socket" (a local network connection). It is the "Communication of the Core." It is the "Dialogue of the Daemon."

  2. UniValue reply: The node's answer. It is always formatted in "JSON" (JavaScript Object Notation), which is easy for both humans and computers to read. It is the "Common Language of the Bit." It is the "Universal Word."


☕ Help support TeachMeBitcoin

TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!