Skip to content

Latest commit

 

History

History
72 lines (41 loc) · 4.31 KB

DEMO.md

File metadata and controls

72 lines (41 loc) · 4.31 KB

Demo

Prerequisites

  1. Compile and run the ISO-8583 chain as described in the README
  2. Have the ISO-8583 standard infrastructure mock running with docker-compose

Insert keys to the keystore

To enable offchain worker, you need to insert your keys to the keystore. You can use the following command to do that:

curl -H "Content-Type: application/json" \
 --data '{ "jsonrpc":"2.0", "method":"author_insertKey", "params":["'"iso8"'", "'"news slush supreme milk chapter athlete soap sausage put clutch what kitten"'", "'"0xd2bf4b844dfefd6772a8843e669f943408966a977e3ae2af1dd78e0f55f4df67"'"],"id":1 }' \
"http://localhost:9944"

Note that the above private key is used for demo purposes, i.e the trusted oracle and payment processor API expect this key to sign requests from offchain worker.

On-chain transfers

Usual Balances::transfer extrinsic and the whole balances pallet in general, is disabled. The only way to move funds between accounts is through ISO8583::initiate_transfer extrinsic. This is done to ensure that all transfers go through the payment processor as a ISO-8583 message.

Disabled transfers

Now, using either Charlie, Dave or Demo User, sign and submit initiate_transfer() extrinsic:

Submit

Heading back to the explorer, we will see:

Screenshot 2024-03-22 at 8 08 40

And this will confirm the finality of the transfer, since it was processed by the bank, aka PCIDSS compliant oracle gateway.

On-chain reversals

One of the key points of ISO-8583, is that it gives the flexibility to reverse the transactions. ISO-8583 pallet implements ERC20R standard, enabling on-chain reversals, obviously not without the help from the oracle. Similar to transfer request, reversal is also triggered by an extrinsic. But before moving to the Extrinsics tab, make sure to copy hash value from the ProcessedTransaction event for previous transfer:

Screenshot 2024-03-22 at 8 14 06

Fill the extrinsic form, sign and submit it:

Screenshot 2024-03-22 at 8 14 46

Once it is submitted, Oracle picks up the event, transforms it to an ISO-8583 standard message and sends it to payment processor. After some due diligence, i.e

  1. only the sender of the transaction can reverse it
  2. transaction can be reversed only once
  3. there is some period after which it's not possible to reverse

Then, reversal request is either approved or ignored.

Screenshot 2024-03-22 at 8 20 02

In our case, it is approved.

More ERC20R features

Pallet leverages a special feature of approvals, where unlimited approval from any account is given to the pallet's system account. This way we are able to handle reversals. However, approvals can also be used for normal users:

Screenshot 2024-03-22 at 8 30 51

Here, Demo User gives an allowance of 10 UNITs to Charlie. Charlie then can transfer this to Dave:

Screenshot 2024-03-22 at 8 32 07

There are two caveats with this feature right now:

  • spender should at least have an ED. This is bit harder in our case, because issuance is controlled by the offchain ledger, but in the future it would be possible to implement paying for fees with the allowance.
  • if spender initiates transfer and for some reason that transfer is rejected by the oracle, allowance is decreased anyway. So spender needs to be approved again if remaining allowance is not enough. This is due to finality of transfers being asynchronous.

Screenshot 2024-03-22 at 8 42 48