It has been a while since I last tried posting a tutorial series.
As I am getting closer to releasing my first 'real app' for Hive, I want to blog about its development and what thoughts have gone into the system I am using.
Developing for Hive (blockchain) has some unique challenges.
Instead of describing these abstract problems, I'll try to 'hack' my way into it.
This is a hands-on approach.
Inspired by: A Hackers' Guide to Language Models, by Jeremy Howard
I watched all sorts of talks and presentations on LMs. This guide actually made it 'click' for me. He brushes over the necessary theory you need to know, but then jumps straight into 'how to use it'. Turns out, he is not some random dude, but his 'invention' caused the current revolution in AI. Not comparing myself to him, but I let his 'hacker' approach inspire me.
Let's say you know a little bit about
...you found Hive and want to build a service, a 'bot', a game...
...you go to https://hive.io/
It's blockchain. It's fast. It's scalable...
In the following I try to work out the only things you absolutely need to know.
The most practical approach; Treat Hive like a black box.
API reference:
import requests
hive_api_url = 'https://api.hive.blog'
def hive_api_get_properties(url):
data = '{"jsonrpc":"2.0", "method":"database_api.get_dynamic_global_properties", "id":1}'
return requests.post(url, data=data)
response = hive_api_get_properties(hive_api_url)
result = response.json()["result"]
print(result)
pip install requestsrequests just makes this so much cleaner...test.py, run like: python test.pyIf you need any help with Python, please ask below.
<!DOCTYPE html>
<html>
<script>
const hive_api_url = 'https://api.hive.blog'
const hive_api_get_properties = async(url) => {
fetched = await fetch(
url, {
method: 'POST',
body: JSON.stringify({
"id": 1,
"jsonrpc": "2.0",
"method": "database_api.get_dynamic_global_properties"
})
}
)
let response = await fetched.json()
console.log(response['result'])
}
hive_api_get_properties(hive_api_url)
</script>
</html>
test.html, open with browserIf you need any help with JS, please ask below.
Hive's a black box, that changes state over time.
Please let me know, if this interests you and if I should tag you in the next post.
Happy New Year!