Hello everyone! π
How's your coding journey going so far? I hope you're doing great! My name is Matias Affolter, and I'm excited to share insights into the project Iβve been working on during 2024 and beyond.
π Building a Business & Blockchain-Powered Social Media
While I love coding, I had to step away from full-time frontend development to run a business and establish a company in Switzerland. Setting up a Swiss company requires around $120,000 in capital, but the good part is that you can contribute intellectual property, such as software. Thatβs how my previous project, Pixa.pics, which allows users to draw pixel art on the web, became an asset for the company.
ποΈ The Blockchain Foundation
Did you ever hear about STEEM or HIVE? These blockchains were among the top 10 in 2017, some reaching a $1 billion market cap! They feature a super-fast 3-second block time and use a layer-1 distributed ledger fully governed by decentralized consensus. Inspired by high-speed transaction processing in online gaming, Dan Larimer developed Graphene, a technology capable of handling 300,000 transactions per second, surpassing Visa and Mastercard combined! π€―
π¨ Why Store Pixel Art on the Blockchain?
A year ago, I decided to fork STEEM/HIVE and integrate on-chain pixel art storage as NFTs! Unlike most NFTs (which store only a hash), our blockchain stores the actual pixel art in Base64. This means the data remains immutable forever.
π‘ Storing 30kB of pixel art on Ethereum could cost thousands of dollarsβon our fork, itβs fast and efficient! With 21 primary nodes (witnesses) ensuring redundancy, our solution can scale to millions of users. Beyond that, sharding would be necessary, but it's technically feasible.
π₯οΈ ReactJS UI - Essential Tips and Tricks π οΈ
Iβm building the Pixagram UI in ReactJS. Here are some impactful tips for optimizing CSS, HTML, and JavaScript:
π¨ 1. Homepage Animations & Graphics
β
Use CSS gradients and SVGs instead of raster imagesβthey are lightweight and scalable.
β
Check out the fading rainbow effect on Pixagram.io π
πΈ 2. Handling Images Efficiently
β
Pixel art needs upscaling, not downscalingβuse Canvas API instead of HTML <img>
for rendering.
β
Use react-virtualized
to handle large lists of posts smoothly.
β
Lazy-load content with Webpack chunk splitting for better performance.
ποΈ 3. Pixel Art Upscaling - WebGL & XBRZ
β
Hexagonal rendering engine (Canvas2D) was slowβWebGL shaders are better.
β
XBRZ algorithm can upscale pixel art by 6x into smooth shapes without AI.
β
Runs in a worker thread, making it fast & deterministic.
π€ 4. AI-Powered Pixel Art
β
We use Hugging Face AI to generate pixel art from selfies.
β
Color quantization ensures pixel art remains authentic & lightweight.
β
WebP format > PNG (smaller file size, same quality).
π¨ 5. Sorting Colors Smartly
β
Sorting colors in RGB space requires sorting 3D vectors.
β
Z-order curve and Hilbert curve are optimal for sorting color palettes.
β‘ 6. CSS Performance Optimizations
β
Use transform
and effects
instead of opacity
, left
, or top
βthey run on the GPU for smoother animations.
β
Apply contain
to prevent layout recalculations and improve render performance.
β
will-change
optimizations: Set it right before an animation starts and remove it after to avoid slowdowns.
π₯ 7. React Rendering & Hydration
β
Use PureComponent to prevent unnecessary re-renders.
β
No automatic hydrationβeverything is handled deterministically for better performance.
π Final Thoughts
This project is a blend of blockchain, pixel art, and AIβa unique combination that makes Pixagram an innovative platform. Weβre currently working towards government approval for fundraising, and once thatβs set, weβre rolling out big updates! π
- https://pixagram.io/ (DEMO)
- https://vimeo.com/1058112712 (VIDEO)
- https://tinyurl.com/pixadata (WHITEPAPER & PITCH DECK)
- https://www.linkedin.com/company/pixagram-blockchain/ (LINKEDIN)
Let me know what you think! Do you have other performance tricks you use in your React projects? Drop them in the comments below! π¬π
Top comments (0)