Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timestamping tx #455

Open
benjiqq opened this issue Nov 14, 2024 · 0 comments
Open

timestamping tx #455

benjiqq opened this issue Nov 14, 2024 · 0 comments

Comments

@benjiqq
Copy link

benjiqq commented Nov 14, 2024

how to determine timestamp of a tx in general? the block meta will arrive after the tx for commitment level processed? how to match the two for confirmed, finalized and processed

const req = {
slots: {},
accounts: {},
transactions: {},
transactionsStatus: {},
 blocks: {},
blocksMeta: { blockmetadata: {} },
entry: {},
accountsDataSlice: [],
};

when data arrives

const blockTime = data.blockMeta.blockTime.timestamp;
const slot = data.blockMeta.slot;
const currentTime = Date.now(); // Get the current local time in milliseconds
const timestamp = Math.floor(Date.now() / 1000);
const latency = timestamp - blockTime; // Calculate latency in seconds

see #452

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant