Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexander C. ice09

View GitHub Profile
@ice09
ice09 / CRCTCConverter.sol
Last active Jun 23, 2022
CirclesUBI Timecircles to Circles Converter
View CRCTCConverter.sol
// SPDX-License-Identifier: AGPL
pragma solidity ^0.8.0;
import "./CRCTCConverterLib.sol";
contract CRCTCConverter {
function crcToTc(uint timestamp, uint amount) external pure returns (uint) {
uint precision = 10 ** 18;
@ice09
ice09 / README.md
Created Mar 28, 2022
Most Simple Spring Boot JPA PostgreSQL Sample
View README.md

Instructions for Linux/WSL2

  1. Create local volume for PostgreSQL data mkdir postgres-data
  2. Use Postgres Docker image, Create Container storage with DB storage, User storage, and Password storage docker run -d --name storage -e POSTGRES_USER=storage -e POSTGRES_PASSWORD=storage -e PGDATA=/var/lib/postgresql/data/pgdata -e POSTGRES_DB=storage -p5432:5432 -v $PWD/postgres-data:/var/lib/postgresql/data postgres
  3. Create Spring Boot Minimal JPA with PostgreSQL https://start.spring.io/#!type=maven-project&language=java&platformVersion=2.6.5&packaging=jar&jvmVersion=11&groupId=dev.wcs.minijpa&artifactId=local-storage&name=local-storage&description=Sample%20Project%20for%20a%20Minimal%20JPA%20with%20local%20Persistence%20using%20PostgreSQL&packageName=dev.wcs.minijpa.local-storage&dependencies=postgresql,data-jpa
@ice09
ice09 / ZipCityConverter.java
Last active Feb 24, 2022
ZipCityConverter as Quarkus JBang sample application
View ZipCityConverter.java
///usr/bin/env jbang "$0" "$@" ; exit $?
// Update the Quarkus version to what you want here or run jbang with
// `-Dquarkus.version=<version>` to override it.
//DEPS io.quarkus:quarkus-bom:${quarkus.version:1.11.0.Final}@pom
//DEPS io.quarkus:quarkus-resteasy
//DEPS io.quarkus:quarkus-resteasy-jackson
//DEPS io.quarkus:quarkus-smallrye-openapi
//DEPS io.quarkus:quarkus-swagger-ui
//Q:CONFIG quarkus.swagger-ui.always-include=true
//FILES germany_zip_codes.json
@ice09
ice09 / docker-compose.yml
Last active Dec 3, 2021
Docker Compose for Full Blockchain Event Streaming Sample
View docker-compose.yml
version: '3'
services:
blockchain-listener-fs:
image: blockchain-listener:0.0.1-SNAPSHOT
container_name: blockchain-listener-fs
restart: on-failure
depends_on:
- neo4j-writer-fs
- rdbms-writer-fs
@ice09
ice09 / circles.csv
Created Apr 25, 2021
Some CirclesUBI Numbers
View circles.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 1 column, instead of 2. in line 2.
# Users with most outgoing trusts
# MATCH (tr:User)-[r:TRUSTS]->(te:User)
# RETURN tr AS Truster, COUNT(r)
# ORDER BY COUNT(r) DESC
Truster,COUNT(r)
"{""name"":cuinima1,""address"":0xBFB9749A89376565C79e17050842413F3AB43821,""image_url"":https://circles-ubi.s3.amazonaws.com/uploads/avatars/285246319f75cbb68f35154d4fa019043ded41ea2ae6010b7156e7ea8c6c099e.jpg}",3297
"{""name"":cuinima3,""address"":0x674Ee4c8B66f54c91e62fe49EadFA1A70b5b8DA4,""image_url"":https://circles-ubi.s3.amazonaws.com/uploads/avatars/609392f19687b3f5c6454b467a539843258bff229fc270c8b7624b575034b850.jpg}",2843
"{""name"":cuinima,""address"":0xD5eFcB307623728989E0431277C6230c2666cA69,""image_url"":https://circles-ubi.s3.amazonaws.com/uploads/avatars/22072a6eafe63a2a10e6dbd7acf6ed72fa4d0d79e6ca4adbcb0c919626dcf8b4.jpg}",2330
"{""name"":f4az3zl8ek,""address"":0xCb5D036b9661D119003C487915b18F7118Cdb8eE}",967
@ice09
ice09 / anyblock_analytics_sql.sql
Last active Apr 1, 2021 — forked from jugf/load_events_from_csv.cypher
Visualizing Trust: Trustgraphs of CirclesUBI in Neo4j
View anyblock_analytics_sql.sql
SELECT event.block_number, args->0->>'hex' as "from",
args->1->>'hex' as "to",
CAST(args->2->'num' AS NUMERIC) AS "value"
FROM event
WHERE event.address = '0x29b9a7fBb8995b2423a71cC17cf9810798F6C543'
AND event.event = 'Trust'
AND event.block_number > 12529458
order by event.block_number desc
View xDaiComp.md

Evaluating xDai Stable Chain for B2B Use Cases

The xDai Stable Chain is an Ethereum sidechain with a native stable coin and a bridge to the Ethereum Mainnet for the native currency xDai, which represents DAI on the Ethereum Mainnet.

A native stable coin is a distinctive feature for financial and other Enterprise use cases which could profit of decentralized aspects of Blockchains, but cannot accept the usage of a highly volatile native crypto currencies.

The xDai Stable Chain is very cheap in transaction fees and very fast, but lacks other important features of the Ethereum Mainnet. This post will try to give enough information to enable the reader to decide if the xDai Stable Chain can be of use for her prototype, PoC, MVP or even a working product.

Intention

View ICirclesToken.sol
// SPDX-License-Identifier: AGPL
pragma solidity ^0.7.0;
abstract contract ICirclesToken {
function look() virtual public view returns (uint256);
/// @notice receive a ubi payout
/// @dev this is the method to actually update storage with new token balance
function update() virtual public;
@ice09
ice09 / BinaryTreePrinter.java
Last active Oct 11, 2020
MerkleTree Implementation with very simple testing, implements proofPath creation and proofPath validation. Is heavily influenced by https://github.com/SimoneStefani/merkle-tree-java.
View BinaryTreePrinter.java
package tech.blockchainers.crypyapi.http.common;
import org.web3j.utils.Numeric;
import java.io.PrintStream;
// taken from https://github.com/eugenp/tutorials/blob/master/data-structures/src/main/java/com/baeldung/printbinarytree/BinaryTreePrinter.java
public class BinaryTreePrinter {