How to generate public and private keys? And how to use that keys to send and receive bitcoins without using any wallet?
3 Answers
got this from the appendix in Andreas' book "Mastering Bitcoin":
The Python library pycoin, ... is a Python-based library that supports manipulation of bitcoin keys and transactions, even supporting the scripting language enough to properly deal with nonstandard transactions. The pycoin library supports both Python 2 (2.7.x) and Python 3 (after 3.3) and comes with some handy command-line utilities, ku and tx.
and next chapter:
Bitcoin Explorer (bx) is a command-line tool that offers a variety of commands for key management and transaction construction. It is part of the libbitcoin bitcoin library.
There are a plethora of tools on the market, which allow to create the keys, the tx and even send the tx to the network. Using these tools without a wallet application, from the command line, you can create a bitcoin address, you can send transactions, and you can see amounts on you address. However you cannot "receive" bitcoins, there is not directly such concept. You would present your public key to someone, who then sends you some Satoshis might be a better description.
I have created my own set of shell scripts, which allow to do the same (for learning purposes). Shamelessly selfmarketing :-) https://github.com/pebwindkraft/trx_cl_suite.
I highly recommend Andreas' book, it is online and in many languages available, and provides a proper overview of the underlyings of bitcoin.
It would not be possible to do a transaction just with the help of public and private keys without making use of any wallets or Simple Payment Verification (SPV) node.
Basically public and private keys could be generated yourself easily. But bitcoin network needs something more than a public key to represent it as bitcoin node address.
Once you create a random 256 bit (64 digit hexa characters) private key, public key could be computed by using Eliptical Curve Cryptography. Once you have the private key (PK), you have to hash it using SHA and RIPEMD to get a 160 bit payload. SHA-256( RIPEMD-160(PK)). This payload is combined with version code and checksum. Finally, they are Base-58 encoded to get the bitcoin address which is the identity of your node.
If you do not wish to use any available wallets, you can create your own bitcoin SPV node where you can have control over your own private key and create a new key whenever you like.
Here are some reference links:
If you just want to receive and send bitcoin without using any wallet you could generate public/private key using this open source website: bitaddress.org
Just send some bitcoins to generated public key and share the private key with the person who going to spend this bitcoins.
they can spend the bitcoins using bitcoin-core application, electrum or blockchian.info