Python/Perl/Bash Billing Bitcoin + python

Dec 29, 2021
In this topic, I want to talk about my attempts to write billing in python for almost any project based on bitcoin.

The material is raw, I'm not a super coder, so criticism is accepted.
Let's go...

The first thing we need is a server. I used debian linux (my favorite) 64 bit.

To get started, we need to download the official bitcoin client. Download page

Download the client, unpack it into an arbitrary user folder.
In my case, /home/usr/bitcoind is used.
Go to the bin/64/ folder.
Run ./bitcoind

He has already created everything that is necessary. Next, we have to configure this software.
Write killall bitcoind to the console

Go to /home/usr/.bitcoin
And here we create a configuration file. mcedit bitcoin.conf
I used the following settings:
You must reply before you can see the hidden data contained here.
We return to the folder /home/usr/bitcoind/bin/64
We start the daemon again ./bitcoind

That's it. Our client became a daemon and began to synchronize blocks.
For the curious, the second line is the setting for bitcoin to work through the Tor network. I have it installed on the server, but it is not used to speed up synchronization.

Further, we will take as an axiom the fact that I write software myself and start from what hits my head. And my clients are all identified by jabber account.

I create the following folders:
Set permissions to 777 on the db folder. It is important.
And create the following files:
chmod 777 btc.log
mcedit btc.py
You must reply before you can see the hidden data contained here.
The request protocol is encrypted. There is only one key, but two can be used. One from the client and one from the server.

The principle of operation is simple. There is a demon and there is a database. In order not to pull the demon every time I write the data to the database. Made specifically on sqlite for greater portability.

Client code:
You must reply before you can see the hidden data contained here.
The client first of all encrypts the passphrase and sends it to the server. If everything is OK, the server responds with encrypted true. Well, then there is a request to the client (we send a toad or soap), the answer is a BTC address.

At the moment, what I have not completed:
1. determining who has what balance
2. sending a command to replenish the balance in the client panel
3. transferring money from the billing server to my wallet.

This miracle is written simply from the bulldozer. From a big neher to do and can be useful to someone. I'm waiting for the reaction and criticism of the code. And also those who want to refine this work.