> For the complete documentation index, see [llms.txt](https://blockhead.gitbook.io/bh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://blockhead.gitbook.io/bh/technical-documentation/architecture.md).

# Architecture

Each components use during a transaction is illustrated in the diagram below

<figure><img src="https://3837242389-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5UzCRCLb5VwxOn41UVsO%2Fuploads%2F9pkY6aUa46HLTlUuYw3f%2Fimage.png?alt=media&amp;token=4ac1d403-5e2c-44cb-96f1-b0efe90ba8e7" alt=""><figcaption><p>Interaction Flow in Blockhead Payment System</p></figcaption></figure>

1. Request for Invoice Creation: The creator submits a request to the contract to create an invoice. The contract generates a unique invoice ID and attaches the necessary data to it.
2. Smart Contract Requests Escrow Address: The invoice smart contract requests that the Escrow Factory generate a special escrow address for the invoice and it is sent back to the invoice smart contract.
3. Payment URL Generated: A payment URL is created by the invoice smart contract by emitting an event with the escrow address and sent to the creator.
4. Payer Accesses URL: The payment procedure is started by the Payer using the payment URL that the Creator supplied.
5. Payment Sent to Escrow: The Payer transfers the designated sum of money straight to the distinct escrow address that the Escrow smart contract controls.
6. Escrow Holds Funds: Until release conditions, including invoice approval, or refund triggers, are satisfied, the money is safely held by the Escrow smart contract.
