web3coach / the-blockchain-bar

The source-code for: "Build a Blockchain from Scratch in Go" eBook.
https://web3.coach
GNU Lesser General Public License v3.0
499 stars 184 forks source link

TIP-2 #25

Closed mwrites closed 2 years ago

mwrites commented 2 years ago

GM 🌈 !

This is the backend implementation of

As a User I want to traverse database blocks, so I can see all The Blockchain Bar's users activity and what happened when.

  • Add a new API endpoint /block?height= to ./node/http_routes.go to retrieve block by number.
  • Add a new API endpoint /block?hash= to ./node/http_routes.go to retrieve block by hash.

I haven't done the REST api version with /block/$height as I couldn't figure out how to do pattern matching without gorilla/mux. I am not sure if you guys are ok adding a dependency just for that, maybe we will need it anyway in the future? Anyway TBC, let me know.

@web3coach

Cheers to Andrej 🍻

mwrites commented 2 years ago

Dangggg, I started the work before seeing you guys started this https://github.com/web3coach/the-blockchain-bar/pull/24

@web3coach @deferbot 🤣🤣

Go with the cache version it's better def

web3coach commented 2 years ago

Ohhhh damn! What a pity @matanwrites , it would be a great contribution!

Do you want to implement the /tx/$hash endpoint instead?