Skip to content

Instantly share code, notes, and snippets.

View xlab's full-sized avatar
:octocat:
Hacking

Max Kupriianov xlab

:octocat:
Hacking
View GitHub Profile

Cosmos Daemon

Examples of bootstraping Cosmos networks:

$ CHAIN_ID=888 DENOM=inj ./test/cosmos/multinode.sh injectived
$ CHAIN_ID=somm DENOM=samoleans STAKE_DENOM=stake SCALE_FACTOR=000000 ./test/cosmos/multinode.sh sommelier

Full list of the supported ENV variables:

  • CHAIN_ID - specifies Cosmos Chain ID, like cosmos-1
executing transaction
transaction: {
"Salt": 1587842612,
"ExpirationTimeSeconds": 1588447418,
"GasPrice": 6000000000,
"SignerAddress": "0x6ecbe1db9ef729cbe972c83fb886247691fb6beb",
"Data": null
}
transaction data: "0x9694a402000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000003e00000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a63100000000000000000000000000000000000000000000000000000000000000000000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a6310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000001bc16d674ec8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
@xlab
xlab / AUSD.sol
Last active February 6, 2019 23:40
pragma solidity ^0.5.1;
interface TokenRecipient {
function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external;
}
contract ERC20Interface {
function totalSupply() public view returns (uint256);
@xlab
xlab / CryptoUtils.js
Created July 13, 2018 03:16 — forked from nakov/CryptoUtils.js
JS Crypto Utils - secp256k1 EC cryptography and blockchain functions
const CryptoJS = require("crypto-js");
const EC = require('elliptic').ec;
const secp256k1 = new EC('secp256k1');
function publicKeyToAddress(pubKey) {
let address = CryptoJS.RIPEMD160(pubKey).toString();
return address;
}
function privateKeyToPublicKey(privKey) {
@xlab
xlab / rc2.md
Last active June 29, 2018 10:05

Atlant announces 1.0.0-rc2 node release

This is a bugfix release that resolves node performance issues and adds new supported platforms.

DB growth issue

The major bug that is closed within this release was about internal state DB growth. For our key-value store we use a 3rd-party component called BadgerDB (https://github.com/dgraph-io/badger/) and at the moment of our initial release it had a flaw, that wasn't properly documented. Since our release they improved that part in their codebase and added guidelines in the documentation, we followed these guidelines and now the issue is closed.

The issue with DB growth had the most effect on our testnet nodes, some of them became unresponsive and failed to sync with new clients. We strongly recommend anyone who tested the node to update the executable and restart the sync.

@xlab
xlab / deps.go
Created December 26, 2017 00:18
Collect Go package dependency file tree (an overkilled version with multiple packages per file).
package main
func findDeps(p *build.Package, includes, excludes []string, debug bool) (map[string]map[string]struct{}, error) {
excludeRxs, err := compileRxs(excludes)
if err != nil {
return nil, err
}
deps := make(map[string]map[string]struct{}, len(p.Imports))
addDeps := func(parent, dep *build.Package) {
if !containsPrefix(dep.ImportPath, includes) {
/* Copyright (C) 1989-2014 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
#ifndef STDBOOL_H
#define STDBOOL_H
typedef int bool;
#define true 1
#define false 0
#endif // STDBOOL_H
@xlab
xlab / parse_json_number.go
Created February 2, 2017 20:17
JSON Number parsing for Go, ported from C version in cJSON
package parseFloat
import "math"
func Parse(num []byte) (n float64) {
var (
sign float64 = 1
scale int
subscale int
signsubscale int = 1
@xlab
xlab / tls_cert_management.go
Created January 10, 2017 13:00
A TLS Cert management example for Go server. For different domains.
package main
import (
"crypto/tls"
"flag"
"log"
"net/http"
"os"
"path/filepath"
"strings"