P03 E-Commerce Blockchain (EuroToken + Stripe + 4 apps)#2
Open
P03 E-Commerce Blockchain (EuroToken + Stripe + 4 apps)#2
Conversation
dApp completa para almacenar y verificar autenticidad de documentos
en blockchain Ethereum mediante firmas digitales ECDSA.
Stack: Solidity 0.8.18 · Foundry · OpenZeppelin ECDSA ·
Next.js 14 · TypeScript · ethers.js v6 · Tailwind CSS
Incluye:
- Smart contract optimizado (sin bool exists, modifiers, optimizer)
- 11/11 tests pasando con script de visualizacion detallada
- Frontend con dark mode, drag & drop, CSV export, busqueda
- Script start.sh para arrancar todo el stack en un comando
- Documentacion completa: README, lecciones aprendidas, guion video
- Submodulos: OpenZeppelin contracts + forge-std
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Rename practica-01-eth-document-registry → P01-eth-document-registry and fix all submodule references (.gitmodules, .git/config, worktrees) - Add P02-dao: DAO Voting Gasless with MinimalForwarder (ERC-2771), Next.js frontend, meta-tx relay, gasless voting with nonce fix - Add docs for P01 and P02: GUIA_DE_USO, GUION_VIDEO, EJERCICIO_MULTI_VOTANTE - Add root .gitignore, CLAUDE.md, docs/LECCIONES_APRENDIDAS.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Complete the rename: delete tracked files at old path after P01-eth-document-registry/ rename was committed in previous commit. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- P01-eth-document-registry: smart contract + Next.js dapp (complete) - P02-dao: DAO Voting Gasless with ERC-2771 meta-transactions (complete) - Root: .gitignore, CLAUDE.md, docs/LECCIONES_APRENDIDAS.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Smart contracts (46 tests, 0 failed): - stablecoin/sc: EuroToken ERC20, 6 decimals, mint by owner (19 tests) - sc-ecommerce: CompanyRegistry, ProductCatalog, ShoppingCart, InvoiceSystem, PaymentGateway, EcommerceMain (27 integration tests) Web apps (Next.js 15 + ethers v6 + Tailwind v4): - compra-stablecoin :6001 — buy EURT with Stripe card + webhook mint - pasarela-de-pago :6002 — pay invoices with EURT (approve + processPayment) - web-admin :6003 — company dashboard, products, invoices - web-customer :6004 — catalog, cart, checkout, orders restart-all.sh orchestrates Anvil + both deploys + 4 apps Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- fix(restart-all.sh): use taskkill to reliably kill anvil.exe on Windows - fix(restart-all.sh): replace --root flag with cd-based approach (--root incompatible with Unix paths on Windows forge.exe) - fix(restart-all.sh): clear broadcast/cache dirs before each deploy to avoid stale state conflicts - fix(restart-all.sh): show forge output on failure for easier debugging - chore: add package-lock.json and next-env.d.ts for all 4 Next.js apps (generated by npm install) - chore: tsconfig.json reformatted by Next.js (expanded arrays) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- add .gitattributes: force LF line endings for all .sh, .sol, .ts, .json, .md files (prevents CRLF issues when running .sh scripts from WSL) - docs: add section §11 P03 E-Commerce with Windows-specific lessons: forge --root incompatible with Unix paths, pkill vs taskkill, broadcast cache conflicts, set -e swallowing forge errors, cast send for testing without Stripe Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- trap cleanup on EXIT/INT/TERM: kills all child PIDs, node.exe, anvil.exe
- track CHILD_PIDS for Anvil and all 4 Next.js apps
- preserve existing Stripe keys from .env.local instead of overwriting
with bash ${VAR:-placeholder} syntax that Next.js doesn't expand
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Use eth_accounts (silent) on mount to restore wallet session without prompting. Also update accountsChanged handler to reconnect when user switches accounts instead of just disconnecting. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
P03 — E-Commerce Blockchain con EuroToken + Stripe
Contratos inteligentes (Foundry + Solidity 0.8.24)
EuroToken— ERC20 mintable (6 decimales), stablecoin respaldada por StripeCompanyRegistry— registro de empresas en blockchainProductCatalog— catálogo de productos con control de stock on-chainShoppingCart— carrito persistente en contratoInvoiceSystem— facturas inmutables creadas al hacer checkoutPaymentGateway— ejecutatransferFromERC20 y marca facturas como pagadasEcommerceMain— punto de entrada único que expone todas las direccionesApps web (Next.js 15 + ethers.js v6 + Tailwind)
approve+processPaymentcon MetaMaskFlujo completo verificado
:6003:6001→ webhook mintea tokens on-chain:6004→ checkout crea factura en blockchain:6002ejecutaERC20.approve+processPayment→ tokens transferidos al merchant:6003Arrancar el proyecto
cd P03-ecommerce bash restart-all.sh