Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

367
Views
How to get the Solana unix_timestamp on the front-end (in JavaScript)?

Solana Rust smart contracts have access to

solana_program::clock::Clock::get()?.unix_timestamp

which is seconds from epoch (midnight Jan 1st 1970 GMT) but has a significant drift from any real-world time-zone as a product of Solana's slowdowns over time. Many contracts factor in this unix timestamp when calculating reward amounts (notably Step Finance and therefore Gem Farm which reuses the logic). How can I reconstruct this Solana unix timestamp on the front-end in JavaScript without requiring any transaction / wallet signature? Calls to a Solana node RPC are fine.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use the getBlockTime endpoint from JSON RPC. First you'll need the highest slot using the getSlot. That would become:

const connection = new Connection('https://api.testnet.solana.com', 'processed');
const slot = await connection.getSlot();
const timestamp = await connection.getBlockTime(slot);

More info at https://docs.solana.com/developing/clients/jsonrpc-api#getblocktime and https://docs.solana.com/developing/clients/jsonrpc-api#getslot

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!