tinychain icon indicating copy to clipboard operation
tinychain copied to clipboard

Testnet V2 todo

Open liamzebedee opened this issue 7 months ago • 0 comments

tinychain testnet 1 is running, and we've sent a couple txs and mined a bunch of blocks. lots of todo items that are spread out among different areas of the stack, nearly all of these are linearized tasks - ie. small in size, low risk, don't involve a lot of unknowns

https://x.com/liamzebedee/status/1816057946369057070

  • bugs
    • [x] sync panics process after downloader has no more peers for jobs
    • [x] node doesn't sync to full tip yet (need to ingest bodies)
    • [x] test is failing in CI for some reason, can't access logs
  • refactorings
    • [ ] getlongestchainhaslist returns the headers tip, should return full tip
    • [x] explorer accounts page returns accounts in random order
    • [ ] the explorer is horribly inefficient lol. needs to hot reload too for new blocks from the node
  • security
    • [ ] setup txs so they have unique nonces
    • [ ] add transaction replay protection / build "seen" index or "nonce" index
  • sync
    • [ ] test branches and reorgs (gut: this will be straightforward)
    • [ ] upon first start, scan for missing block bodies. add these to wantlist
    • [ ] wait until fully synced before mining and spamming the net
    • [ ] update full tip
    • [ ] interactive bissect with peers to get common ancestor. then sync from that point.
    • [ ] when we receive a new block and don't know parent, do "fast path" and ask for most recent 10 headers
  • [ ] build mempool (https://github.com/tinychainorg/tinychain/pull/18)
    • add fee mechanism
    • reingest old txs??
    • add to block body
  • [ ] mining
    • [ ] restart miner whenever we have a new full tip
    • [ ] restart miner whenever we have a new tx bundle from mempool
  • [ ] add ability to send transactions
    • design some interface for users / CLI
    • "add transaction" user endpoint
    • gossip transactions, if !seen then add to mempool
    • add "gettxstatus" to check where/if tx was confirmed
  • [x] saving state
    • [x] save the miner public key to database under wallets, load on start
    • [x] save the peers we've seen to database, load from db on start
  • [ ] performance improvements
    • [ ] verify signatures in parallel (maybe using GPU?)
    • [ ] fetch blocks in parallel for syncgetblockdata
    • [x] add proper indexes on sql database for various things
    • [ ] add a cache / memoize the longestchainhashlist function
    • [ ] add a cache / memoize the reconstructstate function
  • [x] simple block explorer on each node (https://github.com/tinychainorg/tinychain/pull/19)
    • take the sqlite database
    • get the longest chain hash list
    • then build a simple HTML interface around it
      • homepage - latest block, num transactions
      • /blocks/:hash
      • /txs/:hash
      • /accounts/:pubkey

Stretch:

  • [ ] load peers from dns seed? or load peers from bittorrent or ethereum or something.
  • [ ] move to using protobufs for rpc https://github.com/tinychainorg/tinychain/pull/13

Nice to have:

  • [ ] add ecdsa recovery or use schnor signatures to reduce tx/pubkey size by 50%
  • [ ] add the state root
    • maybe via something like https://twitter.com/fede_intern/status/1818273961148383361
  • [ ] setup hole punching / NAT stuff
  • [ ] size improvements
    • use hash(pubkey) for accounts instead of pubkey. could be smaller ([32] vs. [20]byte).
  • [ ] build a simple terminal UI interface
    • list of blocks
    • list of accounts
    • after every update
  • [ ] mining algorithm
    • use ethash

liamzebedee avatar Jul 24 '24 15:07 liamzebedee