Skip to content

Instantly share code, notes, and snippets.

View phm87's full-sized avatar

phm87

View GitHub Profile
@phm87
phm87 / crypto_tx_without_Internet.MD
Last active April 22, 2022 01:23
Cryptocurrency transaction without Internet ?

How to exchange cryptocurrencies without Internet ?

We can imagine a LAN with several nodes and one explorer. The blockchain contains confirmed transactions with HTLC and existing payment channels to merchants. External third-party services can exist.

Timeline

If we know that we'll be disconnected from Internet in few minutes:

  • Maybe merchants can still accept non-RBF onchain transactions if they are in mempool of several explorers and small amounts (to avoid any possible collusion with miners).
  • New payment channels can't be established since these transactions require several blocs confirmed
  • Existing payment channels can be used and new channel states can be sent to external entities protecting the channels (watchtower for LN)
@phm87
phm87 / ERC20_to_SC.MD
Created March 19, 2021 02:06
Airdrop to erc20 hodlers

How to perform an airdrop to all hodlers of an ERC20?

Problem is that it is not possible to convert an ethereum address that never spent or signed any message to its pubkey then to the equivalent KMD/BTC address. When the ethereum adress will perform one transaction or sign a message, it will reveil its pubkey.

As discussed with sylti on CryptoFR slack, it is possible to create a webpage using web3 and metamask that will ask to sign a message without broadcasting it. The signed message is retrieved offchain and verified and used to extract pubkey.

par exemple tu fork mainnet en local au block X avec ganache-cli --fork tu extrais l'adresse eth du message signe => tu connectes web3 au fork local => token.balanceOf(adresse).call() => et tu emets le resultat sur l'adresse komodo integree dans le message

@phm87
phm87 / ac_aur_tests.MD
Last active January 9, 2021 01:22
Test : ac_aur

ac_aur is a new experimental ac_param for smartchains/assetchains that allows to have active user reward. TAUR stands for Test Active User Reward, it is the name of the blockchain and the name of the token/coin. TAUR tokens are meant to be testcoins with no monetary value.

Please feel free to review https://github.com/KomodoPlatform/komodo/compare/master...phm87:ac_aur

ac_aur testchain AUR parameters

./komodod -ac_name=TAUR -ac_aur=1,10,2,500000000,10 -ac_supply=0 -ac_reward=800000000 -ac_blocktime=10 -ac_decay=50 -ac_halving=525000 -ac_adaptivepow=1 -addnode=91.121.217.73 -addnode=178.32.41.81 &

-ac_aur=1,10,2,500000000,10 will enable active user rewards activated at block 10, min 2 coins to earn AUR, min locktime identical to Komodo (500000000), Percentage per year of 10%

@phm87
phm87 / btc_on_sc
Last active October 13, 2020 02:01
Tokenize testnet bitcoins on a komodo assetchain/smartchain
**btc_on_ac** is tokenizing testnet bitcoins on a komodo assetchain/smartchain.
An address is a human-readable encoding (with a network prefix) of a pubkey. A private key that controls coins on one address is also controlling coins on all addresses that are built on the same pubkey with any network prefix. In the following explanation, I'll consider that a BTC address is the same as a KMD/smartchain address (because it is the same pubkey).
Multisigs are used as n-of-m such as 7 of 12 signers to have some redundancy.
# How does it work ?
btc_on_ac is based on several public testnet Bitcoin explorer (with API) and a deposit bitcoin/komodo address (pubkey) hardcoded in the code.
For each block mined,
@phm87
phm87 / int2lehex.sh
Created July 4, 2020 12:18 — forked from Janaka-Steph/int2lehex.sh
Integer to Little endian hex Conversion Script for Bitcoin Script
#!/bin/bash
if [ -z $1 ];
then
echo "You must include an integer as an argument.";
exit;
fi
if (( $1 > "2147483647" )) || (( $1 < "-2147483647" ));
then

Some transactions on the bitcoin blockchain are not monetary transfert but notarizations or time-stamping of documents. In these transactions, the amount of the transaction itself usually doesn't matter. Other transactions are pegged/locking of BTC tokens into special scripts on the bitcoin blockchain.

Let's differenciate:

  • asset issuing onchain (such as ICO tokens on Ethereum chain)
  • asset issuing offchain with pegged onchain (such as LN or Elements/Liquid) [with tx/notarization of peg in & peg out but also of some intermediate states]
  • notarization of independant coins (dPoW, dPoS) without peg
  • notarization of documents

Onchain

Onchain asset issuing

@phm87
phm87 / Corona_useful_links.MD
Last active April 21, 2020 22:35
Corona useful links
@phm87
phm87 / anonset.md
Created January 5, 2020 22:44 — forked from leto/anonset.md
Hush Shielded Pool stats as of Jan 5th 2020

Hush Shielded Pool stats as of Jan 5th 2020

With zindex enabled, the getchaintxstats RPC returns an immense amount of information about zaddr usage. This RPC did not exist in Bitcoin when Zcash forked, so I ported it from latest BTC Core to Komodo and Hush. In the Hush version of this RPC, the -zindex functionality was added.

By default, the RPC gives stats for the last month. It can be given an arbitrary "block window" to calculate stats for any time period. Some statistics apply to the entire chain and are not specific to the block window, such as those below.

The "anonymity set" (anonset) or "shielded pool size" of Hush mainnet: