In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to install and dock the Bitcoin Core wallet, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let's take a look at it.
Bitcoin introduction
The concept of Bitcoin was first proposed by Satoshi Nakamoto on November 1, 2008, and was officially born on January 3, 2009. According to the ideas of Satoshi Nakamoto, we design and release the open source software and construct the P2P network on it. Bitcoin is a virtual encrypted digital currency in the form of P2P. Peer-to-peer transmission means a decentralized payment system. Unlike all currencies, Bitcoin does not rely on specific monetary institutions to issue, it is generated through a large number of calculations according to specific algorithms. Bitcoin economy uses a distributed database composed of many nodes in the entire P2P network to confirm and record all transactions, and uses cryptographic design to ensure the security of all aspects of money circulation. The decentralized nature of P2P and the algorithm itself ensure that currency values cannot be artificially manipulated by mass production of bitcoins. Cryptography-based designs allow bitcoin to be transferred or paid only by the real owner. This also ensures the anonymity of currency ownership and circulation transactions. The biggest difference between Bitcoin and other virtual currencies is that its total quantity is very limited and has a strong scarcity. Bitcoin Baidu encyclopedia bitcoin Wikipedia
Introduction to Bitcoin core Wallet
At present, many communities on the network have developed a variety of bitcoin wallets, of which bitcoin core Wallet will download all nodes after installation, and there is a set of rpc interface protocol, the code is also all open source in github, bitcoin core supports multiple operating systems, we can install it according to our own needs. I have done the project requirements are trading system and payment system to achieve recharge, withdrawal, and collection functions, bitcoin core is enough for me, so I chose him. As for other wallets, I don't have a specific in-depth study. If there is a business with special needs, I can also study whether other wallets support it. To study other wallets, click on the link: bitcoin Wikipedia
What Bitcoin needs to know
Because the value of virtual coins is relatively high, many hackers will try their best to steal virtual currency assets, such as first-line exchanges. At present, the simplest and lowest-cost prevention method is to isolate hot and cold wallets. We should also consider the solution in this aspect when designing the system, and then extend it in this way of thinking. My solution is for users to recharge the virtual coins in their wallets. I transfer the virtual coins from hot wallets to cold wallets through scheduled tasks every day. In this way, even if the hacker hacks our wallets, he can steal very little money, which can reduce the loss of the platform.
Hot wallet, what we are building now is a hot wallet. To put it simply, the wallet connected to the outside world and the coin of the recharge address will be transferred to the cold wallet every day.
Cold wallet, completely isolated from the outside network, there are also many related hardware wallet products on the market.
The mechanism of blockchain is that once a transaction is generated, it cannot be tampered with and withdrawn. We should also pay more attention to it when developing, especially when changing currencies.
Utxo, the official explanation is the unused transaction output. For a specific introduction, you can click to see the detailed introduction written by other eldest brothers, utxo introduction.
Bitcoin core wallet installation 1. Server hardware configuration
The server configuration I am currently using is aws ubuntu 2cMagne8gQuery 500g hard disk. The following configuration information is my advice.
Cpu:2c (cpu will be occupied when synchronizing chunks)
Memory: 8GB
Hard disk: 500g (there is no shortage of money on solid state, solid state synchronization block speed will be much faster)
two。 Matters needing attention
When the block is synchronized, the cpu will be full, so don't make a fuss at that time. This is normal. After the block synchronization is completed, it will return to normal.
3. Install the wallet
There are also many ways to install. You can download the installation file at the above address. Here, I download and install directly through ubuntu's apt. First of all, I need to add the source of bitcoin:
Sudo add-apt-repository ppa:bitcoin/bitcoin
After adding the source successfully, you need to update the following source:
Sudo apt-get update
Install bitcoind:
Sudo apt-get install bitcoind
You can install bitcoin-qt selectively. Bitcoin-qt is not required on the ubuntu-service version. If you want to use bitcoin-qt on ubuntu-desktop, you can choose to install it:
Sudo apt-get install bitcoin-qt4. Run bitcoind
Enter the bitcoind command directly to allow bitcoind to run directly in the foreground:
Bitcoind
You can also run it in the background, or you can use nohup to print the log as I did.
Nohup bitcoind &
Use the command to check the wallet version and whether the installation is successful
Bitcoind-versionBitcoin Core Daemon version v0.18.0.0-g2472733a24a9364e4c6233ccd04166a26a68cc65Copyright (C) 2009-2019 The Bitcoin Core developersPlease contribute if you find Bitcoin Core useful. Visit for further information about the software.The source code is available from .This is experimental software.Distributed under the MIT software license, see the accompanying file COPYINGor This product includes software developed by theOpenSSL Project for use in theOpenSSL Toolkit and cryptographic software written byEric Young and UPnP software written by Thomas Bernard.
After startup, the wallet will automatically synchronize the block, and you can open the log to view the specific synchronization situation.
Tail-f nohup.out
Enter the bitcoin installation directory
Cd $HOME/.bitcoinlsbanlist.dat bitcoind.pid blocks chainstate debug.log peers.dat walletsls wallets/database db.log wallet.dat
Because the version I installed this time is 0.18, there are some changes compared with the previous version. The wallet.bat file is in the wallet folder. Above, we can see the latest structure of the folder. Here is the description of the specific folder.
Process files run by bitcoind.pid bitcoind blocks blockchain data files chainstate blockchain status databases use LevelDB to store db.log database log files debug.log runtime log files wallet.dat wallet files (this is important, this file holds the private key generated by our wallets, especially important, it is recommended to write a shell script or use a daemon to make a backup every day)
Install supervisor (process Monitoring) and hang up your wallet to make the program self-starting.
Sudo apt-get install supervisor5. The wallet command describes bitcoin-cli getwalletinfo to view wallet details, in version 0.18 The previous getinfo has been cancelled {"walletname": "," walletversion ": 169900, wallet version" balance ": 0.00000000, wallet balance" unconfirmed_balance ": 0.00000000, unconfirmed balance" immature_balance ": 0.00000000, this is not clear" txcount ": 0, number of wallet transactions" keypoololdest ": 1562826486 Earliest key creation time in the key pool "keypoolsize": 1000, key pool size "keypoolsize_hd_internal": 1000, "paytxfee": 0.00000000, formality rate (this is more important Later separately) "hdseedid": "ed13b2019c2e28e9dc84cf7124ba2e36cebcb656", "private_keys_enabled": true} bitcoin-cli getblockchaininfo to view block details {"chain": "main", "blocks": 238558, wallet current block (usually 1-2 days after btc installation is started) "headers": 584893, the latest block height. There is other information later. Let's not pay attention to} bitcoin-cli sendtoaddress transfer interface (described later) Response:1. "address" (string, required) receive address 2. "amount" (numeric or string) Required) transfer amount Result: "txid" (string) unique ID tx_idExamples: > bitcoin-cli sendtoaddress "1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd" 0.1 > curl-- user myusername-- data-binary'{"jsonrpc": "id": "curltest", "method": "sendtoaddress", "params": ["1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd", 0.1]}'- H 'content-type: text/plain 'The http://127.0.0.1:8332/ business system interfaces with BTC wallet 1. The realization of recharge and withdrawal
When the user enters the btc top-up page, the backend is called to query the top-up address. If there is no top-up address, we use the btc wallet rpc interface "getnewaddress" to create a top-up address that belongs to the user, save it to the database and return it to the page, where the user transfers coins to recharge.
A thread or scheduling task starts in the background to scan the transaction records in the current block according to the height of the block, and compares it with the top-up address in the database. If it is the top-up address transaction record of the platform user, save it in the block transfer record table (tx_id can be set as the primary key in the table, and tx_id is the unique identification of the block transfer information, which will not be repeated).
Cash
After the ordinary user submits the withdrawal form, if the number of withdrawals is greater than the set number of audits, you need to go to the management background for manual audit, transfer money to the withdrawal address synchronously after passing the audit, update the audit status and modify the user asset information.
Transfer record update (processing the record confirmation result of recharge and withdrawal in the block)
Add scheduling tasks to scan the records to be processed in the block transfer table, and decide whether to carry out follow-up processing according to the number of confirmations
two。 Transfer user interface
At present, there are many ways and interfaces to transfer money. The following is a detailed description:
It is a native transaction that uses offline signature, which is suitable for cold wallet transfer transactions. The general step is to first create transaction information for signature, and then broadcast it through the returned hash value (broadcasting can also be broadcast using third-party services). You need to set a separate service fee and set change address.
Sendfrom interface, which can be set to specify the sending address
Sendmany interface. You can probably know the name of this API. You can transfer money in batches.
Sendtoaddress interface, this interface uses the utxo of the entire wallet (simply understood as the available balance of the entire wallet) for external transfer. The advantage is that it aggregates all the balances of the wallet for external transfer, such as the user withdrawal 1btc. If I use other interfaces to specify the transfer address, the balance of the transfer address cannot be transferred without 1btc, but because this interface adds up the balance of the wallet to transfer. All can be successfully transferred out.
3. User recharge btc balance collection
At present, my project is to set a timer to perform the collection task three times a day. Because of the sendtoaddress transfer interface, I check whether the wallet balance exceeds the collection threshold every time, and do the collection operation when I exceed the collection threshold.
Thank you for reading this article carefully. I hope the article "how to install and dock Bitcoin Core Wallet" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.