Skip to content
Merged
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
7,586 changes: 4,492 additions & 3,094 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ members = [
#'integration-tests/*',
]
resolver = "2"

[profile.release]
panic = 'unwind'
74 changes: 74 additions & 0 deletions docs/article.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Hyperfridge: Bridging Traditional Banking with Web3 using Zero-Knowledge Proofs

## Introduction

Hyperfridge is an innovative solution that bridges the traditional banking system with the Polkadot ecosystem through EBICS (Electronic Banking Internet Communication Standard) and Zero-Knowledge Proofs (ZKPs). This article explores how Hyperfridge enables trustless atomic swaps between FIAT currency and blockchain assets.

## Core Components

### 1. EBICS Integration

Hyperfridge utilizes the EBICS banking interface (ISO20022) to connect with traditional bank accounts. This allows for:
- Real-time balance synchronization
- Secure transaction processing
- Standardized communication protocol

### 2. Substrate Off-chain Workers

The system employs Substrate off-chain workers to:
- Poll EBICS service for latest bank statements
- Queue and process transactions
- Generate and verify ZK proofs
- Handle burn requests for withdrawals

### 3. Zero-Knowledge Proofs

ZKPs are crucial for:
- Proving bank account ownership without revealing sensitive details
- Verifying transaction validity
- Ensuring privacy while maintaining transparency

## Workflow

1. **Account Creation**
- Users link their bank account to their on-chain identity
- ZK proofs verify ownership without exposing bank details

2. **On/Off Ramping**
- Users can deposit (peg) or withdraw (unpeg) funds
- Transactions are verified through ZK proofs
- Automatic synchronization between bank and chain state

3. **Cross-Chain Integration**
- Seamless integration with Asset Hub parachain
- XCM compatibility for cross-chain communication
- Support for stablecoin operations

## Technical Architecture

Hyperfridge consists of:
- A Substrate-based parachain
- EBICS service integration
- ZK proof generation and verification system
- Off-chain worker infrastructure
- Frontend interface for user interactions

## Security Considerations

- Bank account privacy through ZK proofs
- Trustless verification of transactions
- Automated reconciliation
- Secure off-chain worker operations

## Future Development

Planned improvements include:
- Enhanced ZK proof systems
- Additional banking protocol support
- Expanded cross-chain functionality
- Improved user experience

## Conclusion

Hyperfridge represents a significant step forward in bridging traditional finance with blockchain technology, offering a secure and private solution for users to interact with both systems seamlessly.

36 changes: 13 additions & 23 deletions ebics-demo/DEMO.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,21 @@ This demo is a decentralized application that allows users to buy someone a coff

To get started, obviously make sure you have the necessary setup for Substrate development. Go through the main [README.md](../README.md) file to get started.

### Makefile

Makefile configuration is provided for convenience. You can use it to build the chain and the frontend, as well as to run the chain and the frontend in development mode.

Run both:

```bash
make launch-demo-app
```

Run only the chain:

```bash
make launch-chain
```
### Frontend

### Chain
To run the website, go through it's [README.md](./README.md) file.

If you prefer to not use the Makefile, you can run the setup manually.
Make sure to set the `PROVIDER_SOCKET` in `src/config/production.json` to one of the collator nodes from `zombienet`, for example:

Start the chain in development mode with:
```bash
cargo run --release -- --dev --tmp
export REACT_APP_PROVIDER_SOCKET=ws://127.0.0.1:50999
```

### Frontend

To run the website, go through it's [README.md](./README.md) file.

In another terminal, start the frontend with:

```bash
yarn start
yarn run start
```

### Offchain worker key
Expand Down Expand Up @@ -138,6 +120,14 @@ Once you click the `Withdraw` button, you will see the status of the transaction

![Withdraw success](./assets/jack-withdraw-success.png)

### Getting ZK proof of bank statement

You can also get a ZK proof of your bank statement and verify it yourself. To do that, you can select Jack's account from the top right corner, if you haven't added Jack's wallet to your `Polkadot.js` extension, please do it using the seed from the above mapping.

![Get proof](./assets/jack-get-proof.png)
Once you have selected Jack's account, you can see that `Get proof` is now available in transfer destination options. Select `Get proof` and it will generate a ZK proof of Jack's bank statement after couple of seconds.


## Conclusion

This demo shows integration of EBICS fiat on/off-ramp into the Substrate chain. It also shows how to use the EBICS fiat on/off-ramp to build a decentralized application that allows users to donate to each other.
10 changes: 9 additions & 1 deletion ebics-demo/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import React, { createRef } from 'react'
import 'semantic-ui-css/semantic.min.css'
import {
Container,
Dimmer, Grid, Loader, Message, Sticky
Dimmer,
Grid,
Loader,
Message,
Sticky,
} from 'semantic-ui-react'

import { SubstrateContextProvider, useSubstrateState } from './substrate-lib'
Expand All @@ -11,6 +15,7 @@ import { DeveloperConsole } from './substrate-lib/components'
import AccountSelector from './AccountSelector'
import FiatRampsModule from './FiatRampsModule'
import TransferTx from './TransferTx'
// import ProofDownloadModule from './ProofDownload'

function Main() {
const { apiState, apiError, keyringState } = useSubstrateState()
Expand Down Expand Up @@ -60,6 +65,9 @@ function Main() {
<TransferTx />
</Grid.Row>
</Grid>
<Grid.Row>
<ProofDownloadModule />
</Grid.Row>
</Container>
<DeveloperConsole />
</div>
Expand Down
53 changes: 53 additions & 0 deletions ebics-demo/src/ProofDownload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import React, { useState } from 'react'
import { Button, Message, Grid, Card } from 'semantic-ui-react'
import { useSubstrateState } from './substrate-lib'

export default function ProofDownloadModule() {
const { api } = useSubstrateState()
const [error, setError] = useState(null)

const downloadProof = async () => {
try {
// Mock API call - replace with actual endpoint
const response = await fetch('/api/get-proof')
const proofData = await response.json()

// Create blob and trigger download
const blob = new Blob([JSON.stringify(proofData, null, 2)], {
type: 'text/plain',
})
const url = window.URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = 'zkproof.txt'
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
window.URL.revokeObjectURL(url)
} catch (err) {
setError('Failed to download proof: ' + err.message)
}
}

return (
<Grid.Column>
<Card fluid>
<Card.Content>
<Card.Header>Download ZK Proof</Card.Header>
<Card.Description>
Download the Zero-Knowledge proof for offline verification.
</Card.Description>
<Button primary onClick={downloadProof} style={{ marginTop: '1em' }}>
Download Proof
</Button>
{error && (
<Message negative>
<Message.Header>Error</Message.Header>
<p>{error}</p>
</Message>
)}
</Card.Content>
</Card>
</Grid.Column>
)
}
Loading
Loading