-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcbdc.npm
More file actions
32 lines (25 loc) · 807 Bytes
/
cbdc.npm
File metadata and controls
32 lines (25 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
CREATE TABLE cbdc_transactions (
id NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
type VARCHAR2(50),
recipient VARCHAR2(50),
bank VARCHAR2(50),
amount NUMBER,
status VARCHAR2(20),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
Oracle Blockchain (Hyperledger Fabric) Smart Contract (cbdcContract.js)
'use strict';
const { Contract } = require('fabric-contract-api');
class CBDCContract extends Contract {
async sendToBank(ctx, bank, amount) {
let cbdcRecord = {
type: 'SEND_TO_BANK',
bank,
amount,
timestamp: new Date().toISOString(),
};
await ctx.stub.putState(bank, Buffer.from(JSON.stringify(cbdcRecord)));
return JSON.stringify(cbdcRecord);
}
}
module.exports = CBDCContract;