Blockchain networks have long been an effective method for executing payments. However, using popular networks like Tron, Ethereum, and Binance Smart Chain for payments presents certain challenges. These challenges stem primarily from technical and financial issues. On the technical side, the difficulties include the complexity of developing wallets for each user or invoice and managing incoming transactions. Financially, the high transaction fees associated with these networks pose significant barriers to efficiently accumulating incoming funds.
To address the aforementioned issues, we have developed a method called Memorized. This approach is inspired by the memo field used in blockchain networks like Ripple and Stellar, with additional enhancements to improve its functionality. This method aims to track and manage transfers between users (via cryptocurrency exchanges or wallets) and merchants (businesses that accept cryptocurrency payments).
As you've likely noticed, Memorized operates with two key participants: cryptocurrency exchanges and merchants. Below, we outline how each player can use our APIs to take advantage of this proposed method.
In this method, merchants need to follow two key steps. First, they must create memorized addresses for each user. Second, they should retrieve a list of confirmed transactions and take appropriate action, such as crediting the user's account. A comprehensive description of each step is provided below.
Creating memorized addresses
To create a memorized address, the merchant must provide our API with a real blockchain address and specify the corresponding network name. By providing these two parameters, our API will return an alternative computed address that is directly mapped to the given blockchain address and its network. A code snippet illustrating this step is provided below.
Request:
x
curl -X 'POST' 'https://api.memorized.io/v1/addresses' -H 'accept: text/plain' -H 'Content-Type: application/json' -d '{
"network": "TRX",
"endpointAddress": "TKp2RKrCAqXWe5zVjwNii2T7r2uqAe1dBo"
}'
Response:
x
{
"value": {
"memorizedAddress": "MDD97ygvPEBTpcrJMqU6h2ozZbibv4Vaqn"
},
"isSuccess": true
}
Retrieving list of confirmed transaction
After creating memorized addresses and delivering them to the merchant's users, the next step is to get notified about incoming transactions. To retrieve the list of transactions, an example is provided below.
Request:
x
curl -X 'GET' 'https://api.memorized.io/v1/transactions/TRX/TKp2RKrCAqXWe5zVjwNii2T7r2uqAe1dBo/confirmed?fromUtc=2024-02-15&toUtc=2024-02-20&page=1&pageSize=50' -H 'accept: text/plain'
Response:
x
{
"value": {
"total": 12,
"pages": 2,
"items": [
{
"createdOnUtc": "2024-02-15T08:32:39",
"modifiedOnUtc": "2024-02-15T08:32:40",
"memorizedAddress": "MDD97ygvPEBTpcrJMqU6h2ozZbibv4Vaqn",
"network": "TRX",
"asset": "TRX",
"incomingAmount": 10,
"incomingHash": "d522426403ad5226530212257c0d36dd3a9695d3bc500c3616bd7e543048249f",
"outgoingAmount": 8,
"outgoingHash": "90c2ccc0b416221f3db9bb83c8cc62d743be58cf7a6b528bd689a4152dbcc658",
"state": "Confirmed"
}
]
},
"isSuccess": true
}
Merchants should keep track of the modifiedOnUtc
and createdOnUtc
fields from the most recent transaction they have observed. This information is crucial for setting the fromUtc
field in subsequent API calls, helping to avoid revisiting transactions that have already been processed. Additionally, it is important to note that the toUtc
field is optional and can be omitted to retrieve transactions up to the present moment.
As previously mentioned, the next participants are cryptocurrency exchanges. To facilitate cryptocurrency transfers to a merchant, exchanges must generate a gateway address using our API for each network they plan to use and store them in their side. A gateway address is a real blockchain address that serves as a relay for transferring funds. Exchanges should direct their cryptocurrency transfers to these previously created gateway addresses. After that, Memorized will transfer the funds received at these gateway addresses to the merchant's blockchain address. The following code snippet will illustrate this step.
Request:
x
curl -X 'POST' 'https://api.memorized.io/v1/gateways' -H 'accept: text/plain' -H 'Content-Type: application/json' -d '{
"network": "TRX"
}'
Response:
x
{
"value": {
"publicAddress": "TVoEXMXAJpS479t7a61BT5SohxksUBLDeN",
"secret": "4d99a259-8f42-420a-9833-7cbbd3455734"
},
"isSuccess": true
}
Exchanges must securely store the returned secret
, as it will be needed later to submit transactions to the Memorized ledger. After creating a gateway, the next step is to activate it. To do so, the exchange must send funds—5 TRX for the Tron network, 0.0002 ETH for the Ethereum network, and 0.0012 BNB for the Binance Smart Chain network—to the gateway address and submit the transaction via the Memorized API. To notify Memorized about activating the gateway, exchanges can use the following example to push their transaction.
Request:
x
curl -X 'POST' 'https://api.memorized.io/v1/transactions' -H 'accept: text/plain' -H 'Content-Type: application/json' -d '{
"memorizedAddress": "M-ACTIVATE",
"network": "TRX",
"asset": "TRX",
"amount": 5,
"hash": "58427e9e77285fabbd04c36cdce201244d5f2d86131b14f30a774b1ffe2ee112",
"secret": "4d99a259-8f42-420a-9833-7cbbd3455734"
}'
Response:
x
{
"isSuccess": true
}
With the gateway now active, the exchange can proceed to transfer funds on behalf of its users. To transfer funds via gateways, follow next three steps.
Retrieving the network of the memorized address
For an exchange, it's crucial to identify the blockchain network associated with the user's memorized address to select the appropriate gateway. To detect network of a memorized address, exchanges can use the following example.
Request:
xxxxxxxxxx
curl -X 'GET' 'https://api.memorized.io/v1/addresses/MDD97ygvPEBTpcrJMqU6h2ozZbibv4Vaqn' -H 'accept: text/plain'
Response:
xxxxxxxxxx
{
"network": "TRX",
"endpointAddress": "TKp2RKrCAqXWe5zVjwNii2T7r2uqAe1dBo"
}
This endpoint functions as the reverse of the memorize endpoint. Exchanges can disregard the endpointAddress
field, as it is not needed.
Pushing the transaction
Now that the exchange has identified the blockchain network associated with the memorized address, it can select the corresponding pre-generated gateway information and send the funds to it. After transferring the funds on the blockchain and obtaining the transaction hash, the exchange must submit the transaction using the following example.
Request:
xxxxxxxxxx
curl -X 'POST' 'https://api.memorized.io/v1/transactions' -H 'accept: text/plain' -H 'Content-Type: application/json' -d '{
"memorizedAddress": "M-ACTIVATE",
"network": "TRX",
"asset": "TRX",
"amount": 5,
"hash": "58427e9e77285fabbd04c36cdce201244d5f2d86131b14f30a774b1ffe2ee112",
"secret": "4d99a259-8f42-420a-9833-7cbbd3455734"
}'
Response:
xxxxxxxxxx
{
"isSuccess": true
}
Tracking pushed transaction state
After submitting a transaction, an exchange can use the following example to track its status within the Memorized network. To retrieve transaction information, the network name and transaction hash is required.
Request:
xxxxxxxxxx
curl -X 'GET' 'https://api.memorized.io/v1/transactions/TRX/58427e9e77285fabbd04c36cdce201244d5f2d86131b14f30a774b1ffe2ee112' -H 'accept: text/plain'
Response:
xxxxxxxxxx
{
"value": {
"createdOnUtc": "2024-02-15T08:32:39",
"modifiedOnUtc": "2024-02-15T08:32:40",
"memorizedAddress": "MDD97ygvPEBTpcrJMqU6h2ozZbibv4Vaqn",
"network": "TRX",
"asset": "TRX",
"incomingAmount": 10,
"incomingHash": "d522426403ad5226530212257c0d36dd3a9695d3bc500c3616bd7e543048249f",
"outgoingAmount": 8,
"outgoingHash": "90c2ccc0b416221f3db9bb83c8cc62d743be58cf7a6b528bd689a4152dbcc658",
"state": "Confirmed"
},
"isSuccess": true
}
A transaction will be in the Accepted
state if the cryptocurrencies sent by the exchange are received by Memorized without issues. It will be in the Rejected
state if there are problems with receiving the funds. Additionally, the transaction will be in the Confirmed
state if the funds are successfully delivered to the merchant, and in the Failed
state if there are any issues with sending the cryptocurrencies.