Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add blobscan client #31

Closed
mattsse opened this issue Feb 6, 2024 · 7 comments · Fixed by #42
Closed

Add blobscan client #31

mattsse opened this issue Feb 6, 2024 · 7 comments · Fixed by #42
Labels
good first issue Good for newcomers

Comments

@mattsse
Copy link
Member

mattsse commented Feb 6, 2024

TODO

add simple client for https://sepolia.blobscan.com/

swagger:

https://api.blobscan.com/

@mattsse mattsse added the good first issue Good for newcomers label Feb 6, 2024
@kamuik16
Copy link

kamuik16 commented Feb 9, 2024

TODO

add simple client for https://sepolia.blobscan.com/

swagger:

https://api.blobscan.com/

Hey @mattsse! Could you give more context about the issue and point out where to add this? Thanks!

@mattsse
Copy link
Member Author

mattsse commented Feb 9, 2024

hey @kamuik16

so this should ideally be another client implementation.

like struct BlobClient or something then we need functions for all the endpoints defined in the swagger, similar to the existing etherscan client we have, but this should be a new client type.

there are perhaps some tools that generate rust code for swagger for example https://github.com/OpenAPITools/openapi-generator

In my experience, their usefulness is very limited though, but definitely helpful to get all the stubs and json types then do a cleanup pass.

@mattsse
Copy link
Member Author

mattsse commented Feb 9, 2024

I think this is the spec

'{"openapi":"3.0.3","info":{"title":"Blobscan API","description":"OpenAPI compliant REST API built using tRPC with Express","version":"1.0.0"},"servers":[{"url":"https://api.blobscan.com/api"}],"paths":{"/blocks/{number}":{"get":{"operationId":"block-getByBlockNumber","summary":"Get blocks time series stats","tags":["blocks"],"parameters":[{"name":"number","in":"path","required":true,"schema":{"type":"number"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"blobAsCalldataGasUsed":{"type":"string"},"blobGasUsed":{"type":"string"},"excessBlobGas":{"type":"string"},"blobGasPrice":{"type":"string"},"number":{"type":"number"},"hash":{"type":"string"},"slot":{"type":"number"},"timestamp":{"type":"string","format":"date-time"},"transactions":{"type":"array","items":{"type":"object","properties":{"hash":{"type":"string"},"fromId":{"type":"string"},"toId":{"type":"string"},"blobs":{"type":"array","items":{"type":"object","properties":{"blobHash":{"type":"string"},"index":{"type":"number"},"blob":{"type":"object","properties":{"size":{"type":"number"}},"required":["size"],"additionalProperties":false}},"required":["blobHash","index","blob"],"additionalProperties":false}}},"required":["hash","fromId","toId","blobs"],"additionalProperties":false}}},"required":["blobAsCalldataGasUsed","blobGasUsed","excessBlobGas","blobGasPrice","number","hash","slot","timestamp","transactions"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/indexer/slot":{"get":{"operationId":"indexer-getSlot","summary":"Get the latest processed slot from the database","tags":["indexer"],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"slot":{"type":"number"}},"required":["slot"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}},"put":{"operationId":"indexer-updateSlot","summary":"Update the latest processed slot in the database","tags":["indexer"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"slot":{"type":"number"}},"required":["slot"],"additionalProperties":false}}}},"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{}}}},"default":{"$ref":"#/components/responses/error"}}}},"/indexer/block-txs-blobs":{"put":{"operationId":"indexer-indexData","summary":"Index data in the database","tags":["indexer"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"block":{"type":"object","properties":{"number":{"type":"number"},"hash":{"type":"string"},"timestamp":{"type":"number"},"slot":{"type":"number"},"blobGasUsed":{"type":"string"},"excessBlobGas":{"type":"string"}},"required":["number","hash","timestamp","slot","blobGasUsed","excessBlobGas"],"additionalProperties":false},"transactions":{"type":"array","items":{"type":"object","properties":{"hash":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"blockNumber":{"type":"number"},"gasPrice":{"type":"string"},"maxFeePerBlobGas":{"type":"string"}},"required":["hash","from","to","blockNumber","gasPrice","maxFeePerBlobGas"],"additionalProperties":false}},"blobs":{"type":"array","items":{"type":"object","properties":{"versionedHash":{"type":"string"},"commitment":{"type":"string"},"data":{"type":"string"},"txHash":{"type":"string"},"index":{"type":"number"}},"required":["versionedHash","commitment","data","txHash","index"],"additionalProperties":false}}},"required":["block","transactions","blobs"],"additionalProperties":false}}}},"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{}}}},"default":{"$ref":"#/components/responses/error"}}}},"/stats/overall":{"get":{"operationId":"stats-getAllOverallStats","summary":"Get all overall stats","tags":["overall"],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"blob":{"type":"object","properties":{"totalBlobs":{"type":"number"},"totalUniqueBlobs":{"type":"number"},"totalBlobSize":{"type":"integer","format":"int64"},"avgBlobSize":{"type":"number"},"updatedAt":{"type":"string","format":"date-time"}},"required":["totalBlobs","totalUniqueBlobs","totalBlobSize","avgBlobSize","updatedAt"],"additionalProperties":false},"block":{"type":"object","properties":{"totalBlocks":{"type":"number"},"totalBlobGasUsed":{"type":"string"},"totalBlobAsCalldataGasUsed":{"type":"string"},"totalBlobFee":{"type":"string"},"totalBlobAsCalldataFee":{"type":"string"},"avgBlobFee":{"type":"number"},"avgBlobAsCalldataFee":{"type":"number"},"avgBlobGasPrice":{"type":"number"},"updatedAt":{"type":"string","format":"date-time"}},"required":["totalBlocks","totalBlobGasUsed","totalBlobAsCalldataGasUsed","totalBlobFee","totalBlobAsCalldataFee","avgBlobFee","avgBlobAsCalldataFee","avgBlobGasPrice","updatedAt"],"additionalProperties":false},"transaction":{"type":"object","properties":{"totalTransactions":{"type":"number"},"totalUniqueReceivers":{"type":"number"},"totalUniqueSenders":{"type":"number"},"avgMaxBlobGasFee":{"type":"number"},"updatedAt":{"type":"string","format":"date-time"}},"required":["totalTransactions","totalUniqueReceivers","totalUniqueSenders","avgMaxBlobGasFee","updatedAt"],"additionalProperties":false}},"required":["blob","block","transaction"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/stats/blobs":{"get":{"operationId":"stats-getBlobDailyStats","summary":"Get blobs time series stats","tags":["blobs"],"parameters":[{"name":"timeFrame","in":"query","required":true,"schema":{"type":"string","enum":["1d","7d","15d","30d","180d","360d","All"]}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"days":{"type":"array","items":{"type":"string"}},"totalBlobs":{"type":"array","items":{"type":"number"}},"totalUniqueBlobs":{"type":"array","items":{"type":"number"}},"totalBlobSizes":{"type":"array","items":{"type":"number"}},"avgBlobSizes":{"type":"array","items":{"type":"number"}}},"required":["days","totalBlobs","totalUniqueBlobs","totalBlobSizes","avgBlobSizes"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/stats/blobs/overall":{"get":{"operationId":"stats-getBlobOverallStats","summary":"Get blobs overall stats","tags":["blobs"],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"totalBlobs":{"type":"number"},"totalUniqueBlobs":{"type":"number"},"totalBlobSize":{"type":"integer","format":"int64"},"avgBlobSize":{"type":"number"},"updatedAt":{"type":"string","format":"date-time"}},"required":["totalBlobs","totalUniqueBlobs","totalBlobSize","avgBlobSize","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/stats/blocks":{"get":{"operationId":"stats-getBlockDailyStats","summary":"Get blocks time series stats","tags":["blocks"],"parameters":[{"name":"timeFrame","in":"query","required":true,"schema":{"type":"string","enum":["1d","7d","15d","30d","180d","360d","All"]}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"days":{"type":"array","items":{"type":"string"}},"totalBlocks":{"type":"array","items":{"type":"number"}},"totalBlobGasUsed":{"type":"array","items":{"type":"string"}},"totalBlobAsCalldataGasUsed":{"type":"array","items":{"type":"string"}},"totalBlobFees":{"type":"array","items":{"type":"string"}},"totalBlobAsCalldataFees":{"type":"array","items":{"type":"string"}},"avgBlobFees":{"type":"array","items":{"type":"number"}},"avgBlobAsCalldataFees":{"type":"array","items":{"type":"number"}},"avgBlobGasPrices":{"type":"array","items":{"type":"number"}}},"required":["days","totalBlocks","totalBlobGasUsed","totalBlobAsCalldataGasUsed","totalBlobFees","totalBlobAsCalldataFees","avgBlobFees","avgBlobAsCalldataFees","avgBlobGasPrices"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/stats/blocks/overall":{"get":{"operationId":"stats-getBlockOverallStats","summary":"Get blocks overall stats","tags":["blocks"],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"totalBlocks":{"type":"number"},"totalBlobGasUsed":{"type":"string"},"totalBlobAsCalldataGasUsed":{"type":"string"},"totalBlobFee":{"type":"string"},"totalBlobAsCalldataFee":{"type":"string"},"avgBlobFee":{"type":"number"},"avgBlobAsCalldataFee":{"type":"number"},"avgBlobGasPrice":{"type":"number"},"updatedAt":{"type":"string","format":"date-time"}},"required":["totalBlocks","totalBlobGasUsed","totalBlobAsCalldataGasUsed","totalBlobFee","totalBlobAsCalldataFee","avgBlobFee","avgBlobAsCalldataFee","avgBlobGasPrice","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/stats/transactions":{"get":{"operationId":"stats-getTransactionDailyStats","summary":"Get transactions time series stats","tags":["transactions"],"parameters":[{"name":"timeFrame","in":"query","required":true,"schema":{"type":"string","enum":["1d","7d","15d","30d","180d","360d","All"]}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"days":{"type":"array","items":{"type":"string"}},"totalTransactions":{"type":"array","items":{"type":"number"}},"totalUniqueSenders":{"type":"array","items":{"type":"number"}},"totalUniqueReceivers":{"type":"array","items":{"type":"number"}},"avgMaxBlobGasFees":{"type":"array","items":{"type":"number"}}},"required":["days","totalTransactions","totalUniqueSenders","totalUniqueReceivers","avgMaxBlobGasFees"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/stats/transactions/overall":{"get":{"operationId":"stats-getTransactionOverallStats","summary":"Get transactions overall stats","tags":["transactions"],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"totalTransactions":{"type":"number"},"totalUniqueReceivers":{"type":"number"},"totalUniqueSenders":{"type":"number"},"avgMaxBlobGasFee":{"type":"number"},"updatedAt":{"type":"string","format":"date-time"}},"required":["totalTransactions","totalUniqueReceivers","totalUniqueSenders","avgMaxBlobGasFee","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/healthcheck":{"get":{"operationId":"healthcheck","summary":"Connection healthcheck","tags":["system"],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"string"}}}},"default":{"$ref":"#/components/responses/error"}}}}},"components":{"securitySchemes":{"Authorization":{"type":"http","scheme":"bearer"}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string"},"issues":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false}}}}}},"tags":[{"name":"blobs"},{"name":"blocks"},{"name":"transactions"},{"name":"overall"},{"name":"system"}],"externalDocs":{"url":"https://docs.blobscan.com/"}}'

@DaniPopes
Copy link
Member

I would like us to split this report into multiple crates as this is not related to etherscan.

@mattsse
Copy link
Member Author

mattsse commented Feb 9, 2024

agree, we can do it either before this pr or after

before sounds easier

@kamuik16 lmk if you want to take this

@kamuik16
Copy link

agree, we can do it either before this pr or after

before sounds easier

@kamuik16 lmk if you want to take this

Prob not, I haven't even understood the issue.

@DoTheBestToGetTheBest
Copy link

TODO

add simple client for https://sepolia.blobscan.com/

swagger:

https://api.blobscan.com/

hello, i'd be happy to take this (:

@DoTheBestToGetTheBest DoTheBestToGetTheBest removed their assignment Apr 13, 2024
mattsse added a commit that referenced this issue Apr 20, 2024
prep for #31

puts the block-explorers crate into a new folder
`crates/block-explorers`, so we can add `blob-explorers`
mattsse added a commit that referenced this issue Apr 23, 2024
closes #31

support for most useful endpoints:
* blocks/id
* transactions/id

types will most likely be changed a bit because some of them can be
potentially unified for multiple endpoints

---------

Co-authored-by: Oliver Nordbjerg <onbjerg@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants