Skip to content

Instantly share code, notes, and snippets.

@mikestaub
Created September 23, 2023 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikestaub/fc2a7d19ae8c6caf2ec9d0820ff51236 to your computer and use it in GitHub Desktop.
Save mikestaub/fc2a7d19ae8c6caf2ec9d0820ff51236 to your computer and use it in GitHub Desktop.
bitcoin transaction ilograph.com sequence diagram
resources:
- id: User
name: User
- id: WalletSoftware
name: Wallet Software
- id: BitcoinNetwork
name: Bitcoin Network
- id: MinerNodes
name: Miner Nodes
- id: Mempool
name: Mempool
- id: MiningSoftware
name: Mining Software
- id: Blockchain
name: Blockchain
perspectives:
- name: Bitcoin Transaction Sequence
relations:
- from: User
to: WalletSoftware
label: "1. Send Bitcoin"
- from: WalletSoftware
to: BitcoinNetwork
label: "2. Broadcast transaction"
- from: MinerNodes
to: Mempool
label: "3. Add transaction to mempool"
- from: MinerNodes
to: WalletSoftware
label: "4. Transaction broadcasted confirmation"
- from: User
to: WalletSoftware
label: "5. Receive broadcast confirmation"
- from: MinerNodes
to: Mempool
label: "6. Select transactions"
- from: MinerNodes
to: MiningSoftware
label: "7. Mine new block"
- from: MinerNodes
to: Blockchain
label: "8. Add new block with transaction"
- from: Blockchain
to: MinerNodes
label: "9. Confirm block added"
- from: MinerNodes
to: WalletSoftware
label: "10. Transaction confirmed"
- from: User
to: WalletSoftware
label: "11. Receive transaction confirmation"
walkthrough:
- highlight: User, WalletSoftware
detail: 1
text: |-
We'll look first at how the User sends Bitcoin through their Wallet Software. [See code](https://github.com/bitcoin/bitcoin/tree/master/src/wallet)
- highlight: WalletSoftware, BitcoinNetwork
detail: 2
text: |-
The Wallet Software then broadcasts the transaction to the Bitcoin Network. [See code](https://github.com/bitcoin/bitcoin/blob/master/src/net_processing.cpp)
- highlight: MinerNodes, Mempool
detail: 3
text: |-
Miner Nodes will then add the transaction to the Mempool. [See code](https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp)
- highlight: MinerNodes, WalletSoftware
detail: 4
text: |-
A confirmation of the broadcasted transaction is sent back to the Wallet Software. [See code](https://github.com/bitcoin/bitcoin/blob/master/src/net_processing.cpp)
- highlight: User, WalletSoftware
detail: 5
text: |-
The User receives a notification confirming the transaction broadcast. [See code](https://github.com/bitcoin/bitcoin/tree/master/src/wallet)
- highlight: MinerNodes, Mempool
detail: 6
text: |-
Miner Nodes then select the transactions to be mined from the Mempool. [See code](https://github.com/bitcoin/bitcoin/blob/master/src/node/miner.cpp)
- highlight: MinerNodes, MiningSoftware
detail: 7
text: |-
The selected transactions are then mined to create a new block. The fact that this step requires intense energy to complete is what keeps the chain protected from attack without having a centralized authority guarding it. Economic incentives align miner behavior. [See code](https://github.com/bitcoin/bitcoin/blob/master/src/node/miner.cpp)
- highlight: MinerNodes, Blockchain
detail: 8
text: |-
The new block, containing the transaction, is then added to the Blockchain. [See code](https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp)
- highlight: Blockchain, MinerNodes
detail: 9
text: |-
A confirmation is sent from the Blockchain to the Miner Nodes indicating the block addition. [See code](https://github.com/bitcoin/bitcoin/blob/master/src/net_processing.cpp)
- highlight: MinerNodes, WalletSoftware
detail: 10
text: |-
The Wallet Software receives a confirmation that the transaction has been validated and added to a block. [See code](https://github.com/bitcoin/bitcoin/tree/master/src/wallet)
- highlight: User, WalletSoftware
detail: 11
text: |-
Finally, the User gets a notification confirming that their transaction has been successfully validated and added to the Blockchain. [See code](https://github.com/bitcoin/bitcoin/tree/master/src/wallet)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment