Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 72 additions & 1 deletion content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,75 @@ Closure proceeds as follows:

## Backup closure

In the case that the server disappears or does not cooperate with the current owner, the current owner can reclaim their funds to an address they control by submitting their backup transaction when the `nLocktime` is reached.
In the case that the server disappears or does not cooperate with the current owner, the current owner can reclaim their funds to an address they control by submitting their backup transaction when the `nLocktime` is reached.

# Token Payment

## Token payment process

This document describes the `/token/token_init` endpoint, which returns a response like the following example:

`https://api.mercurylayer.com/token/token_init`

```
{
"btc_payment_address": "bc1qu2vs2z58m4dnyzuyk4240wdm2qd9jm827rnrjw",
"fee": "50",
"lightning_invoice": "lnbc939970n1pnvtm8ypp525ssrlm7senz7pf9z7h4sx7mz8nd2r7d6nxvldwjw7k2wm7hs8eqdp68psnxv3jxcekytf5x5cnwtf5xp3rwttzxpskxttzxumrgwpc8yer2cej8qcqzzsxqzjcsp5rd992e42ff4my6safcjce3gs0cz74rsuyffhqpragclzzkfw0lcq9qxpqysgq83hpdfxvsgh6ve8afvj38f2uuhg6nzm042sz98ge4qknfrcurlr8n3prw5qtmvjvcc7lpkhrfvm09ex5q3v6aq3tsprq958fakkrljgp2zfy80",
"processor_id": "bb038002-b7cf-49e7-8425-da4d28e8242e",
"token_id": "8a32263b-4517-40b7-b0ac-b76488925c28"
}
```

The fee is provided in euros. The invoice can be paid via Lightning Network (LN). To get additional details or to pay on-chain, make a call to:

`https://api.swiss-bitcoin-pay.ch/checkout/bb038002-b7cf-49e7-8425-da4d28e8242e`

with the `processor_id`. This will return the on-chain payment amount (in millisatoshis), as shown in the example below:

```
{
"id": "bb038002-b7cf-49e7-8425-da4d28e8242e",
"amount": 93997000,
"wallet": "041feacad5e94ead9cf1e6b6b3acda14",
"time": 1724247268,
"expiry": 1724250868,
"grossAmount": null,
"title": "8a32263b-4517-40b7-b0ac-b76488925c28",
"description": null,
"status": "open",
"input": {
"unit": "EUR",
"amount": 50
},
"paymentDetails": [
{
"network": "lightning",
"paymentRequest": "lnbc939970n1pnvtm8ypp525ssrlm7senz7pf9z7h4sx7mz8nd2r7d6nxvldwjw7k2wm7hs8eqdp68psnxv3jxcekytf5x5cnwtf5xp3rwttzxpskxttzxumrgwpc8yer2cej8qcqzzsxqzjcsp5rd992e42ff4my6safcjce3gs0cz74rsuyffhqpragclzzkfw0lcq9qxpqysgq83hpdfxvsgh6ve8afvj38f2uuhg6nzm042sz98ge4qknfrcurlr8n3prw5qtmvjvcc7lpkhrfvm09ex5q3v6aq3tsprq958fakkrljgp2zfy80",
"hash": "VSEB/36GZi8FJRevWBvbEebVD83UzM+10nesp2/XgfI="
},
{
"network": "onchain",
"address": "bc1qu2vs2z58m4dnyzuyk4240wdm2qd9jm827rnrjw"
}
],
"device": {},
"extra": {
"originalHash": "bb038002-b7cf-49e7-8425-da4d28e8242e",
"tag": "invoice-web"
},
"createdAt": 1724247268,
"delay": 3600,
"pr": "lnbc939970n1pnvtm8ypp525ssrlm7senz7pf9z7h4sx7mz8nd2r7d6nxvldwjw7k2wm7hs8eqdp68psnxv3jxcekytf5x5cnwtf5xp3rwttzxpskxttzxumrgwpc8yer2cej8qcqzzsxqzjcsp5rd992e42ff4my6safcjce3gs0cz74rsuyffhqpragclzzkfw0lcq9qxpqysgq83hpdfxvsgh6ve8afvj38f2uuhg6nzm042sz98ge4qknfrcurlr8n3prw5qtmvjvcc7lpkhrfvm09ex5q3v6aq3tsprq958fakkrljgp2zfy80",
"isPaid": false,
"isExpired": false,
"hash": "bb038002-b7cf-49e7-8425-da4d28e8242e",
"fiatAmount": 50,
"fiatUnit": "EUR",
"onChainAddr": "bc1qu2vs2z58m4dnyzuyk4240wdm2qd9jm827rnrjw",
"minConfirmations": 1,
"isPending": false
}
```

Once the payment is made, calling the `/token/token_verify/<token_id>` endpoint will return `true` or `false`. If `true`, the `token_id` can then be used with the client deposit functions.
160 changes: 156 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,19 @@ <h3 class="text-center title-text">
<div class="toc-item-child">
<a class="subtext" href="https://www.mercurylayer.com/#backup-closure"><small>- Backup closure</small></a>
</div>

<div class="toc-item">
<a class="subtext" href="https://www.mercurylayer.com/#token-payment">Token Payment</a>
</div>



<div class="toc-item-child">
<a class="subtext" href="https://www.mercurylayer.com/#token-payment-process"><small>- Token payment process</small></a>
</div>

<div class="toc-item-child">
<a class="subtext" href="https://www.mercurylayer.com/#terms-and-conditions"><small>- Terms and Conditions</small></a>
</div>

</div>
</div>

Expand Down Expand Up @@ -348,8 +358,150 @@ <h2 id="orderly-closure">Orderly Closure</h2>
</ol>
<h2 id="backup-closure">Backup closure</h2>
<p>In the case that the server disappears or does not cooperate with the current owner, the current owner can reclaim their funds to an address they control by submitting their backup transaction when the <code>nLocktime</code> is reached. </p>

</div>
<h1 id="token-payment">Token Payment</h1>
<h2 id="token-payment-process">Token payment process</h2>
<p>To initialize token, the <code>/token/token_init</code> endpoint is called, which returns a response like the following example:</p>
<p><code>https://api.mercurylayer.com/token/token_init</code></p>
<blockquote style="overflow-x: auto; white-space: pre;">
{
"btc_payment_address": "bc1qu2vs2z58m4dnyzuyk4240wdm2qd9jm827rnrjw",
"fee": "50",
"lightning_invoice": "lnbc939970n1pnvtm8ypp525ssrlm7senz7pf9z7h4sx7mz8nd2r7d6nxvldwjw7k2wm7hs8eqdp68psnxv3jxcekytf5x5cnwtf5xp3rwttzxpskxttzxumrgwpc8yer2cej8qcqzzsxqzjcsp5rd992e42ff4my6safcjce3gs0cz74rsuyffhqpragclzzkfw0lcq9qxpqysgq83hpdfxvsgh6ve8afvj38f2uuhg6nzm042sz98ge4qknfrcurlr8n3prw5qtmvjvcc7lpkhrfvm09ex5q3v6aq3tsprq958fakkrljgp2zfy80",
"processor_id": "bb038002-b7cf-49e7-8425-da4d28e8242e",
"token_id": "8a32263b-4517-40b7-b0ac-b76488925c28"
}
</blockquote>
<p>The fee is provided in euros. The invoice can be paid via Lightning Network (LN). To get additional details or to pay on-chain, make a call to:</p>
<p><code>https://api.swiss-bitcoin-pay.ch/checkout/bb038002-b7cf-49e7-8425-da4d28e8242e</code></p>
<p>with the <code>processor_id</code>. This will return the on-chain payment amount (in millisatoshis), as shown in the example below:</p>
<blockquote style="overflow-x: auto; white-space: pre;">
{
"id": "bb038002-b7cf-49e7-8425-da4d28e8242e",
"amount": 93997000,
"wallet": "041feacad5e94ead9cf1e6b6b3acda14",
"time": 1724247268,
"expiry": 1724250868,
"grossAmount": null,
"title": "8a32263b-4517-40b7-b0ac-b76488925c28",
"description": null,
"status": "open",
"input": {
"unit": "EUR",
"amount": 50
},
"paymentDetails": [
{
"network": "lightning",
"paymentRequest": "lnbc939970n1pnvtm8ypp525ssrlm7senz7pf9z7h4sx7mz8nd2r7d6nxvldwjw7k2wm7hs8eqdp68psnxv3jxcekytf5x5cnwtf5xp3rwttzxpskxttzxumrgwpc8yer2cej8qcqzzsxqzjcsp5rd992e42ff4my6safcjce3gs0cz74rsuyffhqpragclzzkfw0lcq9qxpqysgq83hpdfxvsgh6ve8afvj38f2uuhg6nzm042sz98ge4qknfrcurlr8n3prw5qtmvjvcc7lpkhrfvm09ex5q3v6aq3tsprq958fakkrljgp2zfy80",
"hash": "VSEB/36GZi8FJRevWBvbEebVD83UzM+10nesp2/XgfI="
},
{
"network": "onchain",
"address": "bc1qu2vs2z58m4dnyzuyk4240wdm2qd9jm827rnrjw"
}
],
"device": {},
"extra": {
"originalHash": "bb038002-b7cf-49e7-8425-da4d28e8242e",
"tag": "invoice-web"
},
"createdAt": 1724247268,
"delay": 3600,
"pr": "lnbc939970n1pnvtm8ypp525ssrlm7senz7pf9z7h4sx7mz8nd2r7d6nxvldwjw7k2wm7hs8eqdp68psnxv3jxcekytf5x5cnwtf5xp3rwttzxpskxttzxumrgwpc8yer2cej8qcqzzsxqzjcsp5rd992e42ff4my6safcjce3gs0cz74rsuyffhqpragclzzkfw0lcq9qxpqysgq83hpdfxvsgh6ve8afvj38f2uuhg6nzm042sz98ge4qknfrcurlr8n3prw5qtmvjvcc7lpkhrfvm09ex5q3v6aq3tsprq958fakkrljgp2zfy80",
"isPaid": false,
"isExpired": false,
"hash": "bb038002-b7cf-49e7-8425-da4d28e8242e",
"fiatAmount": 50,
"fiatUnit": "EUR",
"onChainAddr": "bc1qu2vs2z58m4dnyzuyk4240wdm2qd9jm827rnrjw",
"minConfirmations": 1,
"isPending": false
}
</blockquote>
<p>Once the payment is made, calling the <code>/token/token_verify/{token_id}</code> endpoint will return <code>true</code> or <code>false</code>. If <code>true</code>, the <code>token_id</code> can then be used with the client deposit functions.</p>
<h2 id="terms-and-conditions">Terms and Conditions</h2>
<p>Users of the <a href="https://api.mercurylayer.com">api.mercurylayer.com</a> blind key service should carefully read the terms of use detailed below. By completing token_init with the supplied token_id or accessing our services a User agrees to be bound by these Terms of Use. These Terms of use are not assignable by the user to anyone else.</p>

<p>Mercury layer is an implementation of a system that uses a blind co-signing and key-update service that enables statechains. The Mercury blind key service generates and updates key shares on request in addition to partial blinded signatures. The blind key-update server never has control or custody, and is never aware of the identity of any shared key.</p>

<h3>Mercury Layer Service</h3>
<p>The Mercury layer service generates a private key share s1 on initialization of a session. To initialize a session, a client must provide a valid token_id which controls access to the service.</p>

<p>The client then initializes a session with an auth_pubkey which is used to authenticate all subsequent messages with the server. The server responds with the public key corresponding to the session private key share s1.</p>

<p>Once initialized, the server can then perform two operations using the key share:</p>
<ul>
<li><strong>Partial signature generation</strong> - the server uses the key share to compute a partial signature from a blinded challenge value provided by the client.</li>
<li><strong>Key update</strong> - an encrypted value is sent to the server and used to update the key share along with a new auth_pubkey for the updated key. The previous key share is then deleted securely.</li>
</ul>
<p>The server does not ever receive any other information regarding the client state.</p>

<h3>Token ID Generation</h3>
<p>Valid Token IDs (token_id) can be generated by first initializing a token_id (GET <a href="https://api.mercurylayer.com/token/token_gen">api.mercurylayer.com/token/token_gen</a>) and then agreeing to the terms of use (GET <a href="https://api.mercurylayer.com/token/token_init">api.mercurylayer.com/token/token_init</a>/<token_id>).</p>

<p>This returns a JSON object that specifies an amount (in EUR) required to be paid in BTC via a Lightning invoice or on-chain. The JSON object contains the invoice and swiss-bitcoin-pay.ch invoice ID (the invoice can be viewed at <a href="https://api.swiss-bitcoin-pay.ch/checkout">api.swiss-bitcoin-pay.ch/checkout</a>/<processor_id>).</p>

<p>Once the invoice has been paid (via the Lightning Network or on-chain) the token_id is verified (GET <a href="https://api.mercurylayer.com/token/token_verify">api.mercurylayer.com/token/token_verify</a>/<token_id>).</p>

<p>The token_id is now valid and can be used to generate a blind key share 'session' (see <a href="https://docs.mercurylayer.com">docs.mercurylayer.com</a> for API details).</p>

<p>The 'session' will maintain the key share privately for a period of 12 months, or until the session is closed by the user. The session will enable the generation of up to 10,000 blind partial signatures and up to 10,000 key update operations.</p>

<h3>Security and User Responsibility</h3>
<p>All services provided by Mercury Layer are on a non-custodial basis. The Mercury service software does not have access to, or the ability to decrypt or access a user’s wallet. Mercury Layer service does not keep or store User’s keys. The safekeeping of User’s keys is the sole responsibility of the User.</p>

<p>Mercury Layer service will not ask for recovery words, passwords or similar security-related information. Users should never provide any security-critical information to any person purporting to represent Commerceblock, its affiliates or partners.</p>

<p>The user bears the sole responsibility for performing the broadcast of backup transactions. Commerceblock will not be held responsible for failures to perform this function on time.</p>

<p>Users use this service at their own discretion and in compliance with all applicable laws and regulations. Users assume full responsibility for the consequences of their use of the service, including the safekeeping of their recovery words, passwords and stored keys. The user uses the services at their own risk.</p>

<p>Mercury Layer service is unable to monitor or regulate the User's use of the services, due to the nature of the blinded cryptography employed.</p>

<h3>User Warranties</h3>
<p>The User confirms and warrants that:</p>
<ul>
<li>Where they are representing a legal entity or company, they have the authorization and power to bind the legal entity or company to the terms of service agreement and/or to use this service on behalf of that entity or company.</li>
<li>They have the legal capacity to accept these terms and conditions and enter into this agreement. The service is not available to persons under the age of 18 years old. Users who do not qualify are not permitted to use the Mercury Layer service unless specifically permitted to contract under their applicable domestic law.</li>
<li>They are using the services in compliance with their own local laws and jurisdiction.</li>
<li>The user is aware that national taxation laws may apply to Bitcoin transactions. The User undertakes sole responsibility for determining, calculating, and paying any taxes or duties applicable to their transactions under the laws or regulations applicable to their use of the service. Commerceblock Limited will not calculate, determine, pay, or collect any revenue on behalf of any national government or user.</li>
<li>Users assume use of the service at their own risk. Commerceblock is not liable for the actions, decisions, or other behavior of the user taken in reliance on information provided by third-party services.</li>
</ul>

<h3>Prohibited Activities</h3>
<p>Notwithstanding the generality of the foregoing, the User agrees to use Mercury Layer service in a lawful manner and to refrain from any activity which hinders or otherwise adversely affects the performance of or the provision by Commerceblock of its services to the User or any other users.</p>
<p>The User undertakes not to "Reverse Engineer", change, modify, hack, translate, copy, distribute, pledge, assign, transfer, make derivative works, exploit, encumber or crack any portion of the service. </p>
<p>The User specifically agrees to defend, indemnify and hold harmless Commerceblock against any and all claims, costs, losses, damages, liability, judgments and expenses (including without limitation costs and reasonable attorneys’ fees) in connection with or arising from or in any way related to the use of the Mercury Layer service by the User in breach of these Terms of Use or use of the Mercury Layer service. </p>
<p>The User undertakes to inform Commerceblock immediately, or as early as possible, of any use of the Mercury Software by it, whether advertent or inadvertent which may negatively affect the rights of or cause any loss or damage to, any other person or entity.</p>

<h3>Fees for Services</h3>
<p>The fee charged for the use of the Mercury Layer service is taken in advance via swiss-bitcoin-pay.ch. The User will be liable for transactions fees charged by the Bitcoin network, a third party separate from Commerceblock.</p>

<h3>Inapplicability of Financial Regulation Law</h3>
<p>Commerceblock Limited is not a financial institution and does not provide banking services to the User. It does not perform any acts as a bank, including receiving money deposits, extending credit, investment of funds, providing money transmission services, or acting as a custodian or financial intermediary for the User's Bitcoins.</p>

<p>The User accepts full knowledge that Commerceblock Limited is not performing the functions of a financial institution or bank and that the transactions undertaken using the Mercury Layer service are exempt from the provisions of law applying to financial institutions.</p>

<h3>Assumption of Liability</h3>
<p>The User assumes the full risk and conditions of liability attaching to the use of the Mercury Layer service.
TO THE MAXIMUM EXTENT PERMITTED BY LAW, UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, DELICT/TORT, CONTRACT OR OTHERWISE, SHALL COMMERCEBLOCK LIMITED, OR ANY OF ITS UNDERLYING SERVICE PROVIDERS, BUSINESS PARTNERS, INFORMATION PROVIDERS, ACCOUNT PROVIDERS, LICENSORS, OFFICERS, DIRECTORS, EMPLOYEES, DISTRIBUTORS OR AGENTS; BE LIABLE TO THE USER OR ANY OTHER PERSON FOR ANY MONEY DAMAGES, WHETHER DIRECT, INDIRECT, SPECIAL, INCIDENTAL, COVER, RELIANCE OR CONSEQUENTIAL DAMAGES, EVEN IF COMMERCEBLOCK LIMITED SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
IN THE EVENT THAT, NOTWITHSTANDING THE FOREGOING, COMMERCEBLOCK LIMITED IS FOUND LIABLE TO THE USER FOR DAMAGES FROM ANY CAUSE WHATSOEVER, AND REGARDLESS OF THE FORM OF THE ACTION [WHETHER IN CONTRACT, TORT (INCLUDING NEGLIGENCE), DELICT, SOFTWARE LIABILITY OR OTHERWISE], THE MAXIMUM AGGREGATE LIABILITY OF COMMERCEBLOCK LIMITED TO THE USER ARISING IN CONNECTION WITH THIS AGREEMENT SHALL BE LIMITED TO THE AMOUNT THE USER PAID FOR THE SERVICE IN THE TWELVE (12) MONTHS PRIOR TO THE ACCRUAL OF THE APPLICABLE CLAIM, LESS ANY DAMAGES PREVIOUSLY PAID BY COMMERCEBLOCK LIMITED TO THE USER IN THAT TWELVE (12) MONTH PERIOD.</p>

<p>These Terms of Use constitute the entire agreement (complete and exclusive) between Commerceblock Limited and the User and supersede or replace any previous or contemporaneous terms or agreements, representations, warranties or understandings, whether written or oral. </p>
<p>If any provision of the Agreement is found to be unenforceable or invalid, that provision will be limited or eliminated to the minimum extent necessary so that this Agreement will otherwise remain in full force, in effect and enforceable.</p>

<h3>Assignment</h3>
<p>The rights and obligations arising under these Terms may be assigned to the parties' parent companies, subsidiaries, or legal affiliates and will survive a merger, consolidation, or sale of Commerceblock Limited's assets.</p>

<h3>No waiver</h3>
<p>Delayed, late or failed performance by Commerceblock Limited to exercise or enforce any right or remedy (or any part thereof) accruing to it under these Terms of Use or by law does not constated a waiver of that or any other right or remedy. Commerceblock Limited will not be precluded from further exercising that or any other lawful right or remedy.</p>

<h3>Governing law and choice of jurisdiction</h3>

<p>Any dispute or claim arising out of or in connection with the use of Commerceblock Limited's services, including disputes related to or arising from these Terms of Use, shall be governed exclusively by UK law and the courts of UK shall have exclusive jurisdiction to hear and determine any such disputes or claims.</p>
<p>Commerceblock Limited will not be held liable for actions of its users in breach of foreign laws. End users are solely responsible for ensuring that they comply with the laws of the country in which they are resident, domiciled or otherwise present.</p>

</div>



Expand Down
Loading