# AWS Architecture
## Resources
### DynamoDB
We have 5 different tables for this application in DynamoDB. They are as follows:
There are two user types in this application, streamers and users. Streamers create streams and questions for users to bet on.
The **streamer** table has an attached username(their display name for the application) and info about their stream.
```
export type Streamer = {
address: Address; // primary key
username: string; // username of streamer
active_stream: string; // uuid of active stream in stream table
past_streams: string[]; // uuid of past streams in stream table
};
```
The users have information pertaining to their bets, deposits, and withdrawals.
```
export type User = {
address: Address; // primary key
username: string; // username of user for leaderboards
bets: string[]; // uuid of bets in bets table
deposits: Transaction[]; // transactions of deposits
withdrawals: Transaction[]; // transactions of withdrawals
};
export type Transaction = {
transaction_hash: string; // primary key
date: number; // date of transaction in unix timestamp
amount: number; // amount of transaction
};
```
The **stream** table stores information about the stream, such as which game is playing, which questions are attached to this stream, what platform is this stream on, and the url of the stream.
```
export type Stream = {
stream_uuid: string; // uuid, primary key
stream_url: string; // url of stream, ie twitch.tv/username
platform: string; // twitch, youtube, etc
game: string; // game being played
questions: string[]; // uuid of questions in questions table
};
```
The **question** table stores information about the question that is not stored on the blockchain. This includes the question text, the outcome texts, the associated streamer, and the associated bets.
```
export type Question = {
question_uuid: string; // uuid, primary key
answer_reported: boolean; // true if the oracle has reported the answer
game: string; // uuid of game in games table
question: string; // the question
outcomes: string[]; // array of possible outcomes
question_id: string; // the question id
owner_address: string; // the owner of the question
oracle_address: string; // the oracle of the question
chain_id: number; // the chain id of the question
collateral_token: string;
fpmm_address: Address;
betting_end_time: number; // milliseconds since epoch
bets: string[]; // uuid of bets for this question in the bets table
streamer: Address; // the streamer of the question
stream_uuid: string; // the stream uuid of the question
};
```
The **bet** table is used to store user bets. This allows us to fetch all the bets they have placed and retrieve that quickly.
```
export type Bet = {
bet_uuid: string; // primary key
question_uuid: string;
chain_id: number;
outcome_index: number;
buy_amount: number;
bettor: Address;
active: boolean;
};
```
### App Runner
App Runner is just used to host our application, happy to send over the endpoints and codebase as needed.
## Security
## How do customers access services
The main entrypoint that customers use to take an action is via the [web app](https://app.sweep.gg/). Note that the application is not currently live, but it is functional
### How customer data is encrypted and stored
The first thing is that anything that involves funds is done through third party services. We use [privy](https://privy.io/) to store user funds, and actual funds are custodied on the blockchain.
Besides that, we do not store any passwords(authentication is handled by privy) or anything that should require encryption as shown above, but we'd love to hear your thoughts.
The rest of the customer data is stored in dynamoDB, as mentioned above.
### Hosting
We are hosting the frontend of the [web app](https://app.sweep.gg/) on vercel, the domain is stored on namecheap.
We are hosting the backend on aws app runner.
## Questions
Problem: We want to change the url of our api server from https://pbxmgts9q6.us-east-1.awsapprunner.com to api.sweep.gg. We need to configure DNS settings in aws to do so, but the record name and record value is too long since domain name registrars max out at 60 characters for the host name but the aws app runner suggested host name is 70 characters.
AWS Record host name: `_2d6f4cd9c162fe8a83497f7abc24e0b7.2a57j78kno9625niimzv5i3ywjyq5bm.api.sweep.gg.`
AWS Record value:
`_32c18cc4cc66612e77331e2f5f6037ef.mhbtsbpdnt.acm-validations.aws.`
Is there a way to configure a custom domain for aws app runner?
## Computer vision
### Classification model
Params: ~1 million
size: 3 MB
Pytorch - yes
General Architecture
5 Convolutional Layers
4 csp bottleneck layers
1 FC layer for classification
### Detection model
Params: 3 M
size: 6 MB
Pytorch - yes
Arch:
7 Convolutional Layers
8 csp Bottleneck layers
1 pooling layer