Problem: P2P crypto swaps require bank transfer confirmation. This leads to centralization, delays, and errors.
example: swap DAI to USD on Bank of America
Solution: Protocol for P2P swaps based on onchain wire transfer confirmation
- Bob creates a deal to sell DAI.
- Alice accepts the deal and freezes Bob's DAI.
- Alice sends USD via Zelle.
- Alice creates onchain proof of her Zelle transfer.
- Alice uses this confirmation to close the deal and take Bob's DAI.
The confirmation works with Plaid and the LIT Protocol nodes.
- Alice connects Plaid and creates an API key with access to transaction history from the bank.
- Alice calls Programmable PKPs action on LIT Protocol with Plaid transactionId and API key (demo.js).
- Inside the
LitAction
, it executes the request on Plaid and verifies that the transaction actually exists in Alice's bank account. (litActionPlaidCheck.js) - The
LitAction
signs the transaction information using the decentralizedsignEcdsa()
. - Alice adds the signed transaction to the "vault" smart contract (plaid-transactions-storage.sol), and now everyone can verify that she actually made the transaction from her bank account.
- Bob creates a deal to sell DAI on p2p-market (
createPaymentRequest(...)
) - Alice accepts the deal and freezes Bob's DAI (
confirmPayment(...)
) - Alice sends USD via Zelle.
- Alice creates onchain proof of her Zelle transfer on plaid-transactions-storage (
addTransaction(...)
) - Alice uses this confirmation to close the deal and take Bob's DAI on p2p-market (
reservePayment(...)
)
- p2p-market.sol - P2P Market smart contract
- plaid-transactions-storage.sol - onchain wire transactions storage
- litActionPlaidCheck.js - LIT Action to verify Plaid requests
- bos - Frontend
Url: https://bos.gg/#/azbang.near/widget/peer2peer
- BOS Component: https://bos.gg/#/azbang.near/widget/peer2peer
- LIT-Protocol action ipfsId:
QmVcetXaAnDcHmpX6cWxsGKGSoid4buVK2PkXQEDmgh6wQ
- LIT-Protocol PKPs: https://explorer.litprotocol.com/pkps/110216617645918104171481682055149393821345448971586480839222858944196209976493
- Goerli Plaid transactions endpoint: https://goerli.etherscan.io/address/0xa52210eA78f678D10e0dD47DeC64ff6ACD3Fbe8B
- Goerli P2P Market: https://goerli.etherscan.io/address/0xa3724030aA74016d1AE1e1B54bD79608F0E5866F