Bitcoin network – Review, p2p structure, payments - BitcoinWiki (2024)

Bitcoin network – Review, p2p structure, payments - BitcoinWiki (1)

Bitcoin network is a peer-to-peer payment network that operates on a cryptographic protocol. Users send and receive bitcoins, the units of currency, by broadcasting digitally signed messages to the network using bitcoin cryptocurrency wallet software. Transactions are recorded into a distributed, replicated public database known as the blockchain, with consensus achieved by a proof-of-work system called mining. Satoshi Nakamoto, the designer of bitcoin claimed that design and coding of bitcoin begun in 2007. The project was released in 2009 as open source software.

The Blockchain network requires minimal structure to share transactions. An ad hoc decentralized network of volunteers is sufficient. Messages are broadcast on a best effort basis, and nodes can leave and rejoin the network at will. Upon reconnection, a node downloads and verifies new blocks from other nodes to complete its local copy of the blockchain.

Bitcoin network is used as a simple broadcasting network to propagate transactions and blocks. All communications are done over TCP. Bitcoin is fully able to use ports other than 8333 via the -port parameter. IPv6 is supported with Bitcoind/Bitcoin-Qt v0.7.

Contents

  • 1 Bitcoin Network Messages
  • 2 Blockchain Network Connection
  • 3 Standard relaying
  • 4 Initial block download
  • 5 Thin SPV Clients
  • 6 Bootstrapping
    • 6.1 Addr
    • 6.2 DNS
    • 6.3 IRC
  • 7 Heartbeat
  • 8 External links
  • 9 See Also
  • 10 References

Bitcoin Network Messages

  • version – Information about program version and block count. Exchanged when first connecting.
  • verack – Sent in response to a version message to acknowledge that we are willing to connect.
  • addr – List of one or more IP addresses and ports.
  • inv – “I have these blocks/transactions: …” Normally sent only when a new block or transaction is being relayed. This is only a list, not the actual data.
  • getdata – Request a single block or transaction by hash.
  • getblocks – Request an inv of all blocks in a range.
  • getheaders – Request a headers message containing all block headers in a range.
  • tx – Send a transaction. This is sent only in response to a getdata request.
  • block – Send a block. This is sent only in response to a getdata request.
  • headers – Send up to 2,000 block headers. Non-generators can download the headers of blocks instead of entire blocks.
  • getaddr – Request an addr message containing a bunch of known-active peers (for bootstrapping).
  • submitorder, checkorder, and reply – Used when performing an IP transaction.
  • alert – Send a Bitcoin network alert key.
  • ping – Does nothing. Used to check that the connection is still online. A TCP error will occur if the connection has died.

More information and in-depth technical information is in the Bitcoin Network Protocol Specification.

Blockchain Network Connection

To connect to a peer, you send a version message containing your version number, block count, and current time. The remote peer will send back a verack message and his own version message if he is accepting connections from your version. You will respond with your own verack if you are accepting connections from his version.

The time data from all of your peers is collected, and the median is used by Bitcoin for all network tasks that use the time (except for other version messages)[1].

You then exchange getaddr and addr messages, storing all addresses that you don’t know about. addr messages often contain only one address, but sometimes contain up to 1000. This is most common at the beginning of an exchange.

Standard relaying

When someone sends a transaction, they send an inv message containing it to all of their peers. Their peers will request the full transaction with getdata. If they consider the transaction valid after receiving it, they will also broadcast the transaction to all of their peers with an inv, and so on. Peers ask for or relay transactions only if they don’t already have them. A peer will never rebroadcast a transaction that it already knows about, though transactions will eventually be forgotten if they don’t get into a block after a while. The sender and receiver of the transaction will rebroadcast, however.

Anyone who is generating will collect valid received transactions and work on including them in a block. When someone does find a block, they send an inv containing it to all of their peers, as above. It works the same as transactions[2].

Everyone broadcasts an addr containing their own IP address every 24 hours. Nodes relay these messages to a couple of their peers and store the address if it’s new to them. Through this system, everyone has a reasonably clear picture of which IPs are connected to the network at the moment. After connecting to the network, you get added to everyone’s address database almost instantly because of your initial addr.

Blockchain Network alerts are broadcast with alert messages. No inv-like system is used; these contain the entire alert. If a received alert is valid (signed by one of the people with the private key), it is relayed to all peers. For as long as an alert is still in effect, it is rebroadcast at the start of every new connection.

Initial block download

At the start of a connection, you send a getblocks message containing the hash of the latest block you know about. If Bitcoin p2p doesn’t think that this is the latest block, it will send an inv that contains up to 500 blocks ahead of the one you listed. You will then request all of these blocks with getdata, and the peer will send them to you with block messages. After you have downloaded and processed all of these blocks, you will send another getblocks, etc., until you have all of the blocks.

Thin SPV Clients

BIP 0037 introduced support for thin or lite clients by way of Simple Payment Verification. SPV clients do not need to download the full block contents to verify the existence of funds in the blockchain, but rely on the chain of block headers and bloom filters to obtain the data they need from other nodes. This method of client communication allows high security trustless communication with full nodes, but at the expensive of some privacy as the peers can deduce which addresses the SPV client is seeking information about.

MultiBit and Bitcoin wallet work in this fashion using the library bitcoinj as their foundation.

Bootstrapping

You choose which peers to connect to by sorting your address database by the time since you last saw the address and then adding a bit of randomization.

Bitcoin has three methods of finding peers[3].

Addr

The addr messages described above create an effect similar to the IRC bootstrapping method. You know reasonably quickly whenever a peer joins, though you won’t know for a while when they leave.

Bitcoin comes with a list of addresses known as “seed nodes”. If you are unable to connect to IRC and you’ve never connected to the network before, the client will update the address database by connecting to one of the nodes from this list.

The -addnode command line option can be used to manually add a node. The -connect option can force bitcoin to connect only to a specific node.

DNS

Bitcoin looks up the IP Addresses of several host names and adds those to the list of potential addresses. This is the default seeding mechanism, as of v0.6.x and later.

IRC

As-of version 0.6.x of the Bitcoin client, IRC bootstrapping is no longer enabled by default. The information below is accurate for most versions prior.

Bitcoin joins a random channel between #bitcoin00 and #bitcoin99 on irc.lfnet.org. Your nick is set to an encoded form of your IP address. By decoding all the nicks of all users on the channel, you get a list of all IP addresses currently connected to Bitcoin.

For hosts that cannot make outbound connections on port 6667, the lfnet servers are also listening on port 7777.

Heartbeat

If thirty minutes or more has passed since the client has transmitted any messages it will transmit a message to keep the connection to the peer node alive.

If ninety minutes has passed since a p2p node has communicated any messages, then the client will assume that connection has closed.

External links

See Also on BitcoinWiki

  • Satoshi Client Node Discovery
  • Transaction fee
  • Satoshi Nakamoto
  • Smart contract

References

  1. Bitcoin Mining Guide – Getting started with Bitcoin mining
  2. Bitcoin – Open P2P money
  3. BitClub Network
Bitcoin network – Review, p2p structure, payments - BitcoinWiki (2024)

FAQs

What is the Bitcoin P2P network? ›

A peer-to-peer (P2P) network is based on the concept of decentralisation, which allows the participants to conduct transactions without needing a central server. The peers or nodes (usually a computer) communicate with each other on the network freely without an intermediary.

How to join Bitcoin P2P network? ›

Connecting to a peer is done by sending a “version” message, which contains your version number, block, and current time to the remote node. The remote node responds with its own “version” message. Then both nodes send a “verack” message to the other node to indicate the connection has been established.

How to earn 1 Bitcoin per day without investment? ›

Obtaining 1 BTC per day without any cost or risk is not possible. While there are various ways to obtain Bitcoin, such as through mining or trading, all of these methods come with some level of cost or risk.

Is Bitcoin.org legit? ›

Site is an independent open source project

Bitcoin.org is not Bitcoin's official website. Just like nobody owns the email technology, nobody owns the Bitcoin network. As such, nobody can speak with authority in the name of Bitcoin.

Are P2P networks illegal? ›

Sharing work or media through a peer-to-peer (P2P) network is legal if you own the copyright, thus you own the right to determine if and how that work is distributed. For example, you can write and produce an original song and make it available for others to download for free through a P2P file sharing program.

Are P2P networks still used? ›

Most P2P technologies still work on the same principles as the original Napster clones, with some new enhancements. The central database that 'advertises' files available for download is now shared among the users themselves, while transfers still take place directly from user to user.

Can anyone join the bitcoin network? ›

As mentioned, anyone with an active Internet connection and running a bitcoin client. Seriously, anyone can join the bitcoin network. All you need is an internet connection and a bitcoin client, which is a piece of software like any other.

How to make money on P2P? ›

You can profit from P2P trading by offering competitive rates to attract more customers. This will increase your trading volume and, consequently, higher profits. You can also explore arbitrage by buying assets for lower prices on one platform and selling for higher on another, then keeping the difference for yourself.

Can I buy Bitcoin with P2P? ›

Why Buy Bitcoin via P2P on Bybit? If you're looking to purchase BTC with Fiat, you can do so via P2P trading on Bybit with zero fees. Moreover, you'll enjoy the freedom to select from various payment methods and local currencies. Complete P2P trades in three steps, and buy coins with zero fees!

How to get BTC for free? ›

A Closer Look at the Top Ways to Earn Free Bitcoin
  1. Join the 99Bitcoins Presale Airdrop. ...
  2. Connect to a Bitcoin Faucet. ...
  3. Open a Crypto Savings Account. ...
  4. Participate in Coinbase's Learn and Earn Program. ...
  5. Sign up for a Crypto Casino and Claim a Welcome Bonus. ...
  6. Mine Bitcoin with a Mining Pool. ...
  7. Join a Play-to-earn Crypto Game.
Apr 23, 2024

How to receive free Bitcoin? ›

How to earn free cryptocurrency: 11 easy ways
  1. Sign up with an exchange. ...
  2. Crypto staking. ...
  3. Free NFTs. ...
  4. Learn and earn. ...
  5. Crypto savings account. ...
  6. Crypto lending. ...
  7. Get cash from a brokerage. ...
  8. Participate in an airdrop.
Oct 24, 2023

Which app gives free Bitcoin? ›

Coinbase, Spare, Blockfolio, and Xapo are some of the well-known Bitcoin applications. While some free Bitcoin apps provide a way to earn small amounts of cryptocurrency, they should not be relied on as a primary source of income.

How to spot a Bitcoin scammer? ›

Examples of scams are giveaways, hustles involving new romance, phishing, extortion emails, fake company alerts, blackmail, "rug pulls," and may involve fake mining apps or networks. Signs of crypto scams include poorly written white papers, excessive marketing pushes, and get-rich-quick claims.

What is the most reliable Bitcoin site? ›

Best Crypto Exchanges and Apps for May 2024
  • Best for Low Fees and Best for Experienced Traders: Kraken.
  • Best for Beginners: Coinbase.
  • Best Mobile App: Crypto.com.
  • Best For Security: Gemini.
  • Best for Altcoins: BitMart.
  • Best for Bitcoin: Cash App.
  • Best Decentralized Exchange: Bisq.

What is the safest website for Bitcoin? ›

Best Most Secure Bitcoin and Crypto Exchanges in 2024
  • #1. Binance. 4.83 / 5. promotions. ...
  • #2. Blockchain.com. 4.83 / 5. promotions. ...
  • #3. LBank. 4.83 / 5. promotions. ...
  • #4. Binance TR. 4.67 / 5. promotions. ...
  • #5. BitMEX. 4.67 / 5. promotions. ...
  • #6. MEXC. 4.67 / 5. promotions. ...
  • #7. Okcoin. 4.67 / 5. promotions. ...
  • #8. OKX. 4.67 / 5. promotions.
Jan 30, 2024

What does a P2P network do? ›

In its simplest form, a peer-to-peer (P2P) network is created when two or more PCs are connected and share resources without going through a separate server computer. A P2P network can be an ad hoc connection—a couple of computers connected via a Universal Serial Bus to transfer files.

What is a P2P network and what is its purpose? ›

A peer-to-peer network is an information technology (IT) infrastructure allowing two or more computer systems to connect and share resources without requiring a separate server or server software Workplaces may set up a P2P network by physically connecting computers into a linked system or creating a virtual network.

What is a P2P network in simple terms? ›

In peer-to-peer (P2P) networking, a group of computers are linked together with equal permissions and responsibilities for processing data. Unlike traditional client-server networking, no devices in a P2P network are designated solely to serve or to receive data.

What is an example of a P2P network? ›

For instance, applications such as Skype and WhatsApp use P2P communication to enable users to chat and make voice and video calls directly with each other. Messages and media files are exchanged between users without needing a central server.

Top Articles
Latest Posts
Article information

Author: Reed Wilderman

Last Updated:

Views: 5955

Rating: 4.1 / 5 (52 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Reed Wilderman

Birthday: 1992-06-14

Address: 998 Estell Village, Lake Oscarberg, SD 48713-6877

Phone: +21813267449721

Job: Technology Engineer

Hobby: Swimming, Do it yourself, Beekeeping, Lapidary, Cosplaying, Hiking, Graffiti

Introduction: My name is Reed Wilderman, I am a faithful, bright, lucky, adventurous, lively, rich, vast person who loves writing and wants to share my knowledge and understanding with you.