Hodl Hodl continues a series of educational posts dedicated to traders who trade on other P2P venues but are familiar or not very familiar with Hodl Hodl (hodlhodl.com).
This material is from the Upgrade to Hodl Hodl series.explains the internal process of the exchange, how it looks from a technical point of view, and why Hodl Hodl can’t get access to your bitcoins and run away with them.
Let's take it in order.
In this article, we will mainly explain how contracts for Hodl Hodl work, because multisig contracts are still new to many Bitcoin users.
With Hodl Hodl, you have a choice: trade on the Bitcoin blockchain (transactions on-chain) or on the Lightning network. We will explain how the two types of contracts differ and delve into both types of contracts.
For on-chain contracts, we provide an automated non-custodial solution that allows the exchange to avoid storing funds, and our customers can trade safely and anonymously.
When a contract is created, Hodl Hodl generates 2of 3 multisig bitcoin address. Each address is generated in SegWit format (P2SH-P2WSH) and everyone can send and receive funds directly from escrow to Bech32 addresses.
There are 3 keys to escrow, two of which are necessary for withdrawing bitcoins from escrow: a buyer, a seller and an exchange, each of which stores one of the keys.
- A user key pair is generated in the browser and encrypted with a payment password that each user creates before the start of his first contract. We only store private keys, encrypted payment password on our servers, thereforeIt is not possible to decrypt a user private key without a payment password. The password is known only to users and is never known and is not stored with us.
The contract begins with the fact that the buyer andthe seller confirms his payment password before we provide the seller with an escrow address where he needs to send bitcoins. Confirming the password, users can encrypt the private keys they received and generate an escrow address.
When a seller sends bitcoins to multisigaddress, we immediately see this and, as soon as the necessary number of confirmations is entered, indicated in the description of the contract, we automatically change the status of the contract and inform the buyer that the bitcoins are blocked in escrow and he can safely continue the transaction.
Further, the buyer pays the seller, there are two scenarios with three different outcomes:
The contract is successful: the seller simply withdraws funds from escrow toBitcoin buyer's address. In order to do this, the seller enters his payment password, thereby signing the transaction with his private key, while Hodl Hodl automatically signs the transaction with his key.
The dispute begins: Hodl Hodl resolves the dispute:
- If the dispute is decided in the direction of the seller, Hodl Hodl makes it possible to withdraw bitcoins from escrow to the seller’s wallet, automatically signing the transaction with his key.
- If the dispute is decided in the direction of the buyer, HodlHodl makes it possible to withdraw bitcoins from escrow to the buyer's wallet using his payment password and automatically signing the transaction with his key.
If it is not possible to determine who is right, Hodl Hodl is notIt allows you to withdraw bitcoins from escrow and does not sign the transaction, leaving bitcoins blocked in escrow until the evidence necessary for making the right decision is presented.
The transaction signing process is as follows:
- The client receives an unprocessed, unsigned transaction and as soon as the payment password is confirmed, the transaction is signed with an encrypted user key directly in the user's browser.
- A semi-signed transaction is sent back to the server.
- Hodl Hodl signs the transaction with its key on the server and passes it on.
When (and only if) the contract is completed successfully,Hodl Hodl also receives exchange commission from the transaction - we simply add an additional output to the withdrawal transaction and subtract the commission from the amount blocked in escrow.
Exchange mode Lightning
When we started working with the Lightning network, we did not know that it was possible to introduce a non-custodial solution, and decided to act as an intermediary in Lightning contracts.
We launched our Lightning node using LND(030bde3ee226b7cf456703811976e4241a929d11e5fc0549e9a1c6d10a8e23a738), through which we have our Lighting wallet. We also wrote our own library, which allows you to automate and secure the bidding process.
When the contract has begun, the exchange generates an invoice for the amount of the contract, and the seller pays it from his wallet, blocking the funds in the wallet of the exchange for the duration of the contract.
When we see funds in our wallet,the buyer pays the seller, and then sends an invoice from his wallet in order to withdraw funds from our wallet. As with on-chain contracts, there are two scenarios with three different outcomes:
The contract was successfully completed: the seller simply withdraws bitcoins by paying the invoice provided by the buyer.
The dispute begins: Hodl Hodl resolves the dispute:
- If the dispute is decided in the direction of the seller, Hodl Hodl makes it possible to withdraw bitcoins by paying the invoice issued by the seller.
- If the dispute is decided in the direction of the buyer, Hodl Hodl makes it possible to withdraw bitcoins from the exchange wallet to the buyer's wallet by paying the invoice issued by the buyer.
If it is not possible to determine who is right, Hodl Hodl is notIt allows you to withdraw bitcoins and does not sign the transaction, leaving the bitcoins blocked in our Lightning wallet until the evidence necessary for making the right decision is presented.
Invoice payment is an automated process,which is managed using our own Lightning network library. On the client’s side, everything is simple: the user only needs to click a few buttons on the contract page.
When (and only if) the contract is successfully completed,Hodl Hodl also receives an exchange commission, we just ask the seller to send us an invoice for a certain amount, which includes our exchange commission.
BitNovosti.com publishes this press release “as is” and the information provided cannot be regarded as investment advice from the editorial board. The reader conducts an independent analysis and makes a decision at his own risk.