diff --git a/federation.md b/federation.md index 33714229..41d828b1 100644 --- a/federation.md +++ b/federation.md @@ -1,4 +1,4 @@ -_RoboSats Federation Basis v0.6.0~2_ +_RoboSats Federation Basis v0.6.0~3_ ## Introduction RoboSats is a Free and Open Source project, anyone can spin up a new RoboSats backend instance. This is in fact ideal, given that the more backend instances there are, the more decentralized RoboSats becomes and the harder it is to stop. However, this decentralization creates some challenges: @@ -96,6 +96,16 @@ Some of these badges can be objectively measured and awarded. Other badges rely We also envision more badges in the future, for example milestones by number of trades coordinated (200, 1K, 5K, 25K, 100K, etc). +## New coordinator limits. +The RoboSats client app limits the size of order tha robots can place on newly joined coordinators. This way new coordinators can show their worth with smaller orders before handling all order sizes. The client allows orders of up to 250K Sats for completely new coordinators. The client will increase the size limite by 30% every 2016 blocks (that is, 2 weeks, same as the difficulty adjustment). After 6 months, a coordinator will be considered "mature" and able to host any order size. Coordinator that gained the "Founder" badge by joining before the v0.6.0 release are considered "mature". + +## New Coordinator Order Size Limits +The RoboSats client application imposes limits on the order size that robots can place on newly established coordinators. This mechanism allows new coordinators to demonstrate their capabilities with progressively larger orders. + +New coordinators are initially restricted to hosting orders of up to 250,000 Sats. Over time, the order size limit increases. Specifically, the limit grows by 30% every 2016 blocks (2 weeks), the same cadence of the Bitcoin mining difficulty adjustment. + +After six months, or approximately 12,288 blocks, a coordinator reaches maturity and the app grants it the ability to handle orders of any size. Notably, coordinators that earned the "Founder" badge upon joining prior to the v0.6.0 release are considered mature and can process any order size immediately. + ## Timeline In a sense the RoboSats federation is already online. New coordinators can gradually join. Eventually, the RoboSats "Experimental" coordinator that is run by the development team will be phased out. The RoboSats Federated client app can be used already in `robotestagw3dcxmd66r4rgksb4nmmr43fh77bzn2ia2eucduyeafnyd.onion`. You can also run a pre-release of the v0.6.0 selfhosted client. diff --git a/frontend/src/components/MakerForm/MakerForm.tsx b/frontend/src/components/MakerForm/MakerForm.tsx index 3a6e367f..087979aa 100644 --- a/frontend/src/components/MakerForm/MakerForm.tsx +++ b/frontend/src/components/MakerForm/MakerForm.tsx @@ -126,6 +126,11 @@ const MakerForm = ({ let minAmountLimit: number = limitList[index].min_amount * (1 + premium / 100); let maxAmountLimit: number = limitList[index].max_amount * (1 + premium / 100); + const coordinatorSizeLimit = + (federation.getCoordinator(maker.coordinator).size_limit / 100000000) * + limitList[index].price; + maxAmountLimit = Math.min(coordinatorSizeLimit, maxAmountLimit); + // apply thresholds to ensure good request minAmountLimit = minAmountLimit * amountSafeThresholds[0]; maxAmountLimit = maxAmountLimit * amountSafeThresholds[1]; @@ -134,7 +139,11 @@ const MakerForm = ({ const updateSatoshisLimits = function (limitList: LimitList): void { const minAmount: number = limitList[1000].min_amount * 100000000; - const maxAmount: number = limitList[1000].max_amount * 100000000; + let maxAmount: number = limitList[1000].max_amount * 100000000; + maxAmount = Math.min( + federation.getCoordinator(maker.coordinator).size_limit / 100000000, + maxAmount, + ); setSatoshisLimits([minAmount, maxAmount]); }; diff --git a/frontend/src/models/Coordinator.model.ts b/frontend/src/models/Coordinator.model.ts index bafbc5d2..2de297ab 100644 --- a/frontend/src/models/Coordinator.model.ts +++ b/frontend/src/models/Coordinator.model.ts @@ -74,15 +74,34 @@ export interface Origins { i2p: Origin | undefined; } +function calculateSizeLimit(inputDate: Date): number { + const now = new Date(); + const numDifficultyAdjustments = Math.ceil( + (now.getTime() - inputDate.getTime()) / (1000 * 60 * 60 * 24 * 14), + ); + + let value = 250000; + for (let i = 1; i < numDifficultyAdjustments; i++) { + value *= 1.3; + if (i >= 12) { + // after 12 difficulty adjustments (6 weeks) limit becomes 21 BTC (mature coordinator) + return 21 * 100000000; + } + } + + return value; +} + export class Coordinator { constructor(value: any) { + const established = new Date(value.established); this.longAlias = value.longAlias; this.shortAlias = value.shortAlias; this.description = value.description; this.motto = value.motto; this.color = value.color; - this.size_limit = value.size_limit; - this.established = value.established; + this.size_limit = value.badges.isFounder ? 21 * 100000000 : calculateSizeLimit(established); + this.established = established; this.policies = value.policies; this.contact = value.contact; this.badges = value.badges; @@ -102,7 +121,7 @@ export class Coordinator { public motto: string; public color: string; public size_limit: number; - public established: string; + public established: Date; public policies: Record = {}; public contact: Contact | undefined; public badges: Badges; diff --git a/frontend/static/federation.json b/frontend/static/federation.json index 8517b2f5..0899f144 100644 --- a/frontend/static/federation.json +++ b/frontend/static/federation.json @@ -6,7 +6,6 @@ "motto": "Original Robohost. P2P FTW!", "color": "#1976d2", "established": "2022-03-01", - "size_limit": 0, "contact": { "email": "robosats@protonmail.com", "telegram": "robosats", @@ -50,7 +49,6 @@ "motto": "Privacy and Integrity: Temple of Sats, where Bitcoin's essence thrives.", "color": "#000", "established": "2023-12-02", - "size_limit": 0, "contact": { "email": "cosmos178ftmm4edlahqzj376gwgqzd9re5x0x9h0tfsc@keplr.xyz", "telegram": "venividivici_fr", @@ -95,7 +93,6 @@ "motto": "btc = ɔʇq", "color": "#329239", "established": "2023-12-02", - "size_limit": 0, "contact": { "email": "info@satstralia.com", "telegram": "satstralia", @@ -141,7 +138,6 @@ "motto": "TheBigLake: The Lake of Economic Freedom.", "color": "#000D28", "established": "2023-12-30", - "size_limit": 0, "contact": { "email": "gabbygator184@proton.me", "telegram": "gabbygator184",