Skip to content

Commit 6c73de9

Browse files
MantisClonegitbook-bot
authored andcommitted
GITBOOK-114: feat: Hinkal Private Payments
1 parent a46019c commit 6c73de9

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
* [Escrow Payment](sdk-guides/payment/escrow-request.md)
7070
* [Streaming Payment](sdk-guides/payment/streaming-request.md)
7171
* [Pay through a proxy-contract with a multisig](sdk-guides/payment/pay-through-a-proxy-contract-with-a-multisig.md)
72+
* [Hinkal Private Payments](sdk-guides/payment/hinkal-private-payments.md)
7273

7374
## Learn Request Network
7475

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Hinkal Private Payments
2+
3+
The Request Network SDK supports Hinkal Private Payments using ERC-20 tokens. Hinkal is a middleware and suite of smart contracts on EVM-compatible chains that leverage zero-knowledge proofs and shielded addresses to facilitate compliant and private transactions. 
4+
5+
Each public address has exactly one Hinkal shielded address.
6+
7+
The `@requestnetwork/payment-processor` package provides functions to:
8+
9+
* **Pay a request from a Hinkal shielded address to a public address:** such that the payment sender's public address never appears on-chain.
10+
* **Deposit to a Hinkal shielded address from a public address**: such that the payment recipient's public address never appears on-chain. Callers can choose to deposit to their own shielded address or someone else's shielded address.
11+
12+
{% hint style="info" %}
13+
Paying a request where the payment recipient address is a Hinkal shielded address is not supported because the Request Network payment proxy smart contracts can only send funds to public addresses. Consider using [declarative-request.md](declarative-request.md "mention") instead.
14+
{% endhint %}
15+
16+
## Benefits
17+
18+
* **Privacy**: Obfuscates payer address when paying a request.
19+
* **Compliance**: Ensures transactions adhere to regulatory requirements. See [Hinkal Compliance](https://hinkal-team.gitbook.io/hinkal/hinkal-wallet/compliance) for details
20+
21+
## Installation
22+
23+
To use the Hinkal Private Payments feature, install the necessary package:
24+
25+
```bash
26+
npm install @requestnetwork/payment-processor
27+
npm install @requestnetwork/request-client.js
28+
```
29+
30+
## Usage
31+
32+
### **Pay a request from a Hinkal shielded address**
33+
34+
To pay a request from a Hinkal shielded address to a public address, where only the payment sender's address is obfuscated, use the \``` payErc20FeeProxyRequestFromHinkalShieldedAddress()` `` function. Ensure the payment sender's Hinkal shielded address has a positive balance.
35+
36+
{% hint style="warning" %}
37+
Strongly consider using [encryption-and-decryption](../encryption-and-decryption/ "mention")to keep the request contents private, including the payer and payee identity addresses, when paying requests from a Hinkal shielded address!
38+
{% endhint %}
39+
40+
```typescript
41+
import { payErc20FeeProxyRequestFromHinkalShieldedAddress } from '@requestnetwork/payment-processor';
42+
43+
// Instantiation of `RequestNetwork` and `Signer` omitted for brevity
44+
45+
const request = await requestClient.fromRequestId('insert request id');
46+
const requestData = request.getData();
47+
48+
const paymentResult = await payErc20FeeProxyRequestFromHinkalShieldedAddress(requestData, signer);
49+
```
50+
51+
{% hint style="info" %}
52+
See [quickstart-browser.md](../../get-started/quickstart-browser.md "mention") for how to instantiate a `RequestNetwork` and `Signer`
53+
{% endhint %}
54+
55+
### Deposit to a Hinkal shielded address
56+
57+
To deposit funds to a Hinkal shielded address from a public address, where only the payment recipient's address is obfuscated, use the `sendToHinkalShieldedAddressFromPublic()` function.  
58+
59+
* Deposit to own Hinkal shielded address: omit the `recipientInfo`argument
60+
* Deposit to someone else's Hinkal shielded address: set `recipientInfo` to the shielded address of the payment recipient.
61+
62+
{% hint style="info" %}
63+
Hinkal shielded addresses must be shared out-of-band. This SDK doesn't offer functions for sharing Hinkal shielded addresses.
64+
{% endhint %}
65+
66+
{% code overflow="wrap" %}
67+
```typescript
68+
import { sendToHinkalShieldedAddressFromPublic } from '@requestnetwork/payment-processor';
69+
70+
// Instantiation of `Signer` omitted for brevity
71+
72+
const recipientShieldedAddress = '142590100039484718476239190022599206250779986428210948946438848754146776167,0x096d6d5d8b2292aa52e57123a58fc4d5f3d66171acd895f22ce1a5b16ac51b9e,0xc025ccc6ef46399da52763a866a3a10d2eade509af27eb8411c5d251eb8cd34d'
73+
await sendToHinkalShieldedAddressFromPublic({
74+
signerOrProvider: paymentSender,
75+
tokenAddress: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', // USDC on Base
76+
amount: '1000000', // 1 USDC
77+
recipientInfo: recipientShieldedAddress, // omit to deposit to own Hinkal shielded address
78+
})
79+
```
80+
{% endcode %}
81+
82+
{% hint style="info" %}
83+
See [quickstart-browser.md](../../get-started/quickstart-browser.md "mention") for how to instantiate a `Signer`
84+
{% endhint %}
85+
86+
## Details
87+
88+
For more details, refer to the [Pull Request #1482](https://github.com/RequestNetwork/requestNetwork/pull/1482) on GitHub.

0 commit comments

Comments
 (0)