Layr-Labs / eigenda

Secure, high-throughput, and decentralized Data Availability
https://www.eigenlayer.xyz/
Other
220 stars 168 forks source link

Add an API to fetch blobs from a given batch header hash #688

Closed dmanc closed 1 month ago

dmanc commented 2 months ago

Why are these changes needed?

Adds a new endpoint to the data api server to fetch blob metadata from a batch header hash. This API should enable others to build blob explorers on top of our data.

The endpoint is paginated and returns a next_token field which is a base64 encoded token of the last evaluated key in the page.

Example: Sample query:

 curl -X 'GET' \
  'http://localhost:8080/api/v1/feed/batches/6E2EFA6EB7AE40CE7A65B465679DE5649F994296D18C075CF2C490564BBF7CA5/blobs?limit=1' \  
  -H 'accept: application/json

Sample response

{"meta":{"size":1,"next_token":"eyJCbG9iSGFzaCI6ImRkMjZjYTk3YmNlNzhhYTk2ZTAxMGUwMzNhY2ZjNDZmOWRhYTEwODVjZDVhMzg1MTRiNTAyNzUwZjU5YjlkMTMiLCJNZXRhZGF0YUhhc2giOiIzMTM3MzIzMjMzMzgzODM4MzkzMzMwMzkzNzMyMzMzMzM3MzczNjJmMzAyZjMzMzMyZjMxMmYzMzMzMmZlM2IwYzQ0Mjk4ZmMxYzE0OWFmYmY0Yzg5OTZmYjkyNDI3YWU0MWU0NjQ5YjkzNGNhNDk1OTkxYjc4NTJiODU1IiwiQmF0Y2hIZWFkZXJIYXNoIjoiYmk3NmJyZXVRTTU2WmJSbFo1M2xaSitaUXBiUmpBZGM4c1NRVmt1L2ZLVT0iLCJCbG9iSW5kZXgiOjB9"},"data":[{"blob_key":"dd26ca97bce78aa96e010e033acfc46f9daa1085cd5a38514b502750f59b9d13-313732323338383839333039373233333737362f302f33332f312f33332fe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","batch_header_hash":"6e2efa6eb7ae40ce7a65b465679de5649f994296d18c075cf2c490564bbf7ca5","blob_index":0,"signatory_record_hash":"3dfc70eafe5215ca1051a74e3609bb1d160e1f99005fc13d8c86c539d9114f7b","reference_block_number":2035851,"batch_root":"d9a658a5646d8d41fcea70afd9339d8d8b9041050c1ad2b2f4abe36f45613d2a","blob_inclusion_proof":"64bcc95c806f5d656192872c558988e9ec83d22ec1e000c5a1f13e31e100c8aa700baf3003f5453f2dbf13a9d5d12024d2a55c705ea225c81693145c2cc13fd78216d5479cda9f844af7864a92a42c23333290122fbc811bd604d9f9a9784a66dcaf7c45e683d49118884ebbb397d59b01e2dee2fc97b902c33ad712a276cfb5003ab3aa93c3ae8ab3b4132e0be40d87fb4f58cc5e49d4186e8b8831c014a6e2618bd5f8fdbbb6bccc68df2c04e1db82e8be1fadde0450cfdaf1c34263b92c7fe11f108590db529ec088a0a7ed08f9b2edbb799c85da41654e2f28317411032644096cdc49dd590f3f89d99ade73cb7c2347feb09d49c9450dc26a2fdc37c713c17eab2130c9bc5f84734ea6ccca24ce6f0339017d2877661858f2808b41aca94c86b4810e9fad5f48deb82578e6c2caa165fa64d3c4e49875bd0d91096997987bc6c3d811864bf293dbb728f9f436c5db38eec6ee6008ed82801254eabd178816f60734844264a7f53675b60d0ed1872987854c4d98ec09b9facfe59239bdff495d297de4fdccf4cc0e6dba7772c2880feee533993c1defe1c3d39bce42534cdca435e988da10ec5384b3ba21d2863a9b8f701a9405b7fa631f817f3326d04f32d4f17265cd8c17fe4edf564f7d2818c5c97baf1b39f30316b3d2f3ee53d051","blob_commitment":{"commitment":{"X":"10654988599870587770787393200552110054687298615607967764937097592038258411754","Y":"18734666437462819052584172468786552309751381314655805698672660714753147273453"},"length_commitment":{"X":{"A0":"5061480280063149801552916064155196935940417917920806083877037326616821363934","A1":"14062936678877092061763909390797389513408830393357964905007718131886911533835"},"Y":{"A0":"5745003969301824632454161959921145214502865986519377269450276040077026980010","A1":"6074252507891203505580637063317121427461816738102068256590025258852140830928"}},"length_proof":{"X":{"A0":"21399264865984950761164626890540180632049418151916889200045365655764199070011","A1":"17196068782888244615236694895883064928167854490786996353102920417690165216790"},"Y":{"A0":"17448100457771843994069640177381667809841110272430530510830195951164391042871","A1":"10444118721190278594390330487379515821747120086963435285720236784527226967237"}},"length":54},"batch_id":27961,"confirmation_block_number":2036016,"confirmation_txn_hash":"0xdfa70b7fbcedb568a792b495f0c74ba84c89519399e31287c839fb0b36871337","fee":"00","security_params":[{"QuorumID":0,"AdversaryThreshold":33,"ConfirmationThreshold":55,"QuorumRate":3072},{"QuorumID":1,"AdversaryThreshold":33,"ConfirmationThreshold":55,"QuorumRate":3072}],"requested_at":1722388893,"blob_status":3}]}

next_token decoded:

{"BlobHash":"dd26ca97bce78aa96e010e033acfc46f9daa1085cd5a38514b502750f59b9d13","MetadataHash":"313732323338383839333039373233333737362f302f33332f312f33332fe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","BatchHeaderHash":"bi76breuQM56ZbRlZ53lZJ+ZQpbRjAdc8sSQVku/fKU=","BlobIndex":0}

Checks

dmanc commented 1 month ago

lgtm. Can you make sure the cloudflare cache is enabled for all endpoints?

I'll track it as a separate item