Skip to content

Latest commit

 

History

History
78 lines (57 loc) · 1.45 KB

File metadata and controls

78 lines (57 loc) · 1.45 KB

Overview

Telegram user IDs are assigned as a serialized incrementing number, allowing us to use a mathematical method called interpolation to estimate the user creation date.

Linear Interpolation

The formula for linear interpolation is defined as:

$$ y = y_0+{\frac{(y_1-y_0)}{(x_1-x_0)}}(x-x_0) $$

Assume we have data sets and a known userId = 21538514

[
 {
  userId: 11538514
  createdAtUnixTimestamp: 1391212000
 },
 {
  userId: 103151531
  createdAtUnixTimestamp: 1433376000
 },
]

Then, we can estimate the user creation date using the formula.

x = 21538514
x0 = 11538514
y0 = 1391212000
x1 = 103151531
y1 = 1433376000

$$ y = 1391212000+{\frac{(1433376000-1391212000)}{(103151531-11538514)}}(21538514-11538514) $$

// known variables
x0, y0 = 11538514, 1391212000 // y0 = 2014.01.31
x1, y1 = 103151531, 1433376000 // y1 = 2015.06.04
// calculate variables
x, y = 21538514, 1395814402 // y was estimated as 2014.03.26

As we obtain more accurate data sets, the estimates will become increasingly precise.

Start P.O.C

  1. create .env file and use the variable as .env.example

  2. initialize and start service

npm install

npm run dev

Usage

create new data

/addData userId createAt(unix-timestamp)

estimate user createdAt

/estimate userId

Demo screenshot

Screenshot 2024-10-19 at 17 04 29