Skip to content

Instantly share code, notes, and snippets.

@rhazberries
rhazberries / README.md
Last active September 23, 2020 22:24
Harmony External Infrastructure Research

Harmony External Infra Research

Infura.io

Website // FAQ

Infura is a centralized solution that provides access to Ethereum API to developers. This allows developers to create their apps without having to manage their own node infrastructure, sync to the network, etc. Used by MetaMask.

They use a private Vipnode pool to manage access to Ethereum nodes. According to their website, they run Geth (Go), Parity (Rust) & Hyperledger Besu (Java) Ethereum clients. They also provide a Dashboard to provide analytics to the developers.

Monetization
@rhazberries
rhazberries / README.md
Created August 26, 2020 05:03
SeeSwap Features

SeeSwap

Missing Features

  • Creating your own pool
  • Displaying/calculating pool slippage, expected tokens returned, pool ownership percent
  • Generalized UI to support pools with more than 2 tokens
  • Ability to get list of available pools

Stretch Goals

  • Ability to use multiple pools to fulfill a single token swap order
@rhazberries
rhazberries / README.md
Last active August 20, 2020 19:56
Check Harmony endpoint health

New RPCs

hmy_inSync Returns a boolean, indicating whether the node is sync with the shard chain (true) or currently syncing to catch up to the shard chain max height (false)

hmy_beaconInSync Returns a boolean. It is the same as the previous one, but it checks the beacon chain (shard 0) currently on the node.

These RPCs will work for any of our endpoints & any nodes that have open RPC ports!

Example CURL commands:

@rhazberries
rhazberries / README.md
Last active August 14, 2020 13:53
Get Harmony wallet balance at specified time

Get Balance at Specified Time

Requirements

  • Python 3.6
  • Pyhmy (Harmony Python sdk)

Install Harmony Python sdk

pip3 install pyhmy
@rhazberries
rhazberries / keybase.md
Last active July 22, 2020 23:58
Keybase Integration Notes

Keybase Integration

Initial Issue

#183 [Feature] Add Keybase Integration to Harmony protocol

Problem: The existing method for uploading a validator image to the Staking Dashboard is cumbersome. (Github repo + pull requests)

Proposed Solution: Use Keybase PGP keys & the CLI to verify uploaded pictures.

Additional Security Concerns

@rhazberries
rhazberries / endpoints.md
Last active July 23, 2020 00:02
API Endpoints

Current Issues

  1. Data consistency between backing nodes is not guarenteed.
  2. Health checks are bypassed, so nodes are not automatically removed from the target group when they are down.
  3. Inconsistent errors reported by users when querying every second.
  4. Block explorer backend is reliant on one explorer node.
  5. Endpoints briefly go down during rolling upgrades.

Proposals

Data Consistency

Use an IP Hash load balancing algorithm, instead of the current Round Robin algorithm. All requests from the same IP will be send to the same node, guarenteeing data consistency, but requests would no longer be evenly split among the nodes.

import argparse
import json
import os
from collections import (
defaultdict
)
from pyhmy import (
blockchain
import argparse
import json
import os
from collections import (
defaultdict
)
from pyhmy import (
blockchain
import argparse
import json
import os
from pyhmy import (
blockchain,
staking
)
def last_block_before_epoch(epoch_num, bpe):
$ hmyStaking blockchain delegation by-validator one1s7fp0jrmd97estwye3mhkp7xsqf42vn5x2sfqy
{
"id": "0",
"jsonrpc": "2.0",
"result": [
{
"Undelegations": [],
"amount": 1.18e+24,
"delegator_address": "one1s7fp0jrmd97estwye3mhkp7xsqf42vn5x2sfqy",
"reward": 6.990514030965153e+21,