Rare Goods – System Architecture & Tech Stack Overview

Below is a high-level overview of the systems and technology we have at the core of our current NFT Marketplace infrastructure. Our stack and product is ever-evolving to accommodate new features, clients and partnerships.

For a more detailed inquiry into specific elements of our system, please contact taylor@raregoods.com

Admin API

–   Custom Rare Goods Admin designed specifically for NFTs 

–   All standard APIs to support out of the box views, models, routes, etc

–   Custom Admin Actions

–   s3 file uploads

–   NFT Drafting, Minting, and Listing mechanisms

–   Blockchain interactions (see below)

Blockchain interactions

–   AWS KMS

–   Private Key (PK) stored in AWS KMS (an abstraction layer on top of HSM)

–   Tx signing happens inside of KMS, being sent by an API call from the Admin API so that PKs do not need to be stored on any computer or our own infrastructure and is not exposed/viewable

–   AWS IAM and Admin access is role-based and limited to approved individuals

–   AWS IAM access so that users cannot access AWS KMS

–   Admin limited so that users cannot send txs to KMS to be signed

–   24/7 monitoring for breach occurrences, AWS credentials rotated on a predetermined schedule. 

Polygon Alchemy Node

–   Bridge between off and on-chain infra to be able to interact with Polygon (ex. to be able to send tx to the Polygon blockchain, determined when settled, check to see that our DB NFT info matches on-chain data on outside transfers)

IPFS via Piñata

–   Used to store files on IPFS

–   Hosted IPFS Node to guarantee persistence

–   Generate URI with CID to be stored in metadata

–   Heroku for hosting

–   MongoDB Atlas

–   Cloud MongoDB hosting

Smart Contracts

–   Solidity smart contracts deployed on Polygon testnet and mainnet*

–   Factory Contract

–   Contract to deploy other contracts for new clients and organizations (ex. the ERC-721s)

–   Customized ERC-721

–   Standard ERC-721 with some OpenZeppelin extensions (including upgradable, access control, pausable)

–   Variable Metadata

–   100% test coverage using hardhat

–   launch scripts

–   Connects to AWS KMS to sign and deploy

*NFTs minted, transferred, etc on Polygon. Compatible with Ethereum 

User Facing App

–   Next.js app (react, node, mongo, server-side rendering)

–   Multi-tenant organization structure

–   Shared DB, API, users shared across organizations

–   Each company/school/brand has a custom subdomain

–   Organization-specific info is pulled based on subdomain. Filters DB for org first + whatever applicable query

–   All user-facing info is pulled from our secure MongoDB instance

–   Blockchain-related info (ex. NFTs) are set up and pulled from our DB and the Admin API is responsible for syncing and interacting with Polygon

Sentry

–   For crash reports and monitoring, recommend upgrading before launch

Vercel

–   Hosting

Infrastructure 

Behind the scenes uses lambdas (serverless architecture) configured to autoscale, but monitoring additionally

–   MongoDB Atlas

–   Cloud MongoDB hosting

–   Shared DB with Admin

–   User Authentication using Auth0

–   Passwordless SMS authentication

–   User info securely stored in Auth0 (and within Admin)

Payments

–   Sales Tax – Collecting sales tax in all states via TaxJar

–   For applicable transactions, the sales tax fee is added on top of the transaction fee for the buyer to pay

–   Not using a particular product code since it’s NFTs, just generic

–   Using TaxJar to dynamically calculate sales tax in real-time based on current rates for 100% accuracy

Royalties

–   Per-item royalty amounts configured and tracked in Admin

–   Sum of royalty fees deducted from seller payout (not paid by buyer)

–   Rare Goods keeps detailed transaction history to track and issue royalty payouts

–   CC processing through Circle

–   Processed CC payments settle into Circle account in USDC

–   We keep a record in DB of all transactions

Custody

If something happens with payment, we revert all transactions related to the NFT back to the previous state (ex. NFT owner, balances per user in tx)

–   If a card payment fails

–   If a chargeback occurs within the 14 waiting period in which we are listening for chargebacks. After this period, RG admin would need to decide how to deal with chargeback

–   RG admin can configure the holding period/chargeback window completion

–   Users cannot resell items or get unlockable content within this holding period

–   An internal ledger is kept of all the transactions

–   Internal ledger is used by RG to be able to pay organizations and royalties

–   This is used to determine the amount of earnings balance that each user has on the platform

–   After the holding period, a user can withdraw their balance from the platform

–   Amount each user is eligible to withdraw is calculated as the sum of their earnings from all recorded transactions that have passed the holding period

–   User can initiate a wire transfer after completing KYC and once 14 day holding period has cleared. (as required by Circle for payment processing)

–   The wire transfer will withdraw USDC from the RG circle account balance wired USD the applicable balance minus a $25 wire transfer fee to the user

Payout requirements:

–   KYC per Circle rules and industry best practices

KYC

–   KYC is required and automatically triggered for users: on purchases over $500, if expenses for the last day are $2k or $10k lifetime, and for withdrawals

–   KYC valid for a user for a year

–   Using Trulioo for KYC

–   If KYC fails (ex. returns No Match for user), admin can override the “match” field in DB to do manual KYC for user

Background Jobs

–   Github actions to perform cron jobs (time-based scheduled jobs)

–   Routine jobs to process actions, transactions, etc. in the background

–   Runs every 5 min

–   Mailgun  

–   Send email notifications to users

Leave a Reply

Your email address will not be published. Required fields are marked *