notes

  • cross group discrete logarithm equality proof in zero knowledge for shared secret between two chains with different ec curves. (farcaster)
    • sigma protocols are alternative (COMINT)

chia

  • https://arcade21.games/ for games
  • https://beta.xch.trade/ to view swap prices between dexie and tibetswap
  • https://weso.forgeros.fr/tokenomics for incentive on compaction
  • https://xch.ninja/ for prefarm tracker
  • simpleswap.io swaps xch on kucoin
  • Permuto will allow "eligible holders"" to deposit Microsoft stock (MSFT) and issue "dividend" and "appreciation" certificates on the chia blockchain; to be traded seperately. Allowed 10% of total stock and voting is done based on prices of the 'certificates'.
  • CHIA_ROOT env variable configuration
    • burn if not able to melt
  • check plots with chia plots check -n 30 -l
- mainnet burn xch1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqm6ks6e8mvy
- sends to puzzle hash 0x000000000000000000000000000000000000000000000000000000000000dead
- testnet burn txch1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqm6ksh7qddh
  • coin_type is 8444 in BLS HD key path
  • utxo based (not account based like ethereum)
  • set env var root with export CHIA_ROOT=/usr/local/chia/mainnet/
  • offer files for p2p exchange (atomic swaps)
    • submarine swap cross chain for btc
    • ALL CAT v1 Offers/Coins are INVALID as of 1.5 for vulnerability that allows anyone to claim; replaced by cat v2
      • unable to control amount exploited. puzzle hash, coin amount, parent id are sha256 hashed but not validated. fixed by using shatree to validate.
  • proof of space and time
  • bls aggregatable signatures
  • tail emissions of 0.125 xch per block after 12 years
  • pooling protocol for self block creation
  • asic timelords
  • uses 3 'blockchains' with 1 being a transaction chain of foliage to avoid grinding the canonical trunk chain
  • compression of plots possible with Hellman Attack by using ram/cpu during plotting/harvesting. (tldr: throws first table away and reverses table 2 as needed)
    • 'bit dropping' is actually used approach
  • GPU compressed plot farming for C7(2gb vram) C8(4gb varm) C9(only if free power)
    • GPU plotting from mmx madmax
  • chialisp
    • programmable smart contracts
      • autonomous custody with rate limiting, clawback and configurable settlement periods
  • chain stats dashboard.chia.net
  • xch domains
    • namesdao nft
      • webpages at SevenCharName.xch.cm and SevenCharName.xch.am
  • each CAT v2 is worth 1000 mojos. smallest unit is thus 0.001 CAT or one mojo.
  • tibet swap amm based on uniswap v1
  • https://github.com/dexie-space/splash for decentralized offer broadcasting
chia wallet send -a 0.000000000001 -m 0.000000000001 -t xch1jhye8dmkhree0zr8t09rlzm9cc82mhuqtp5tlmsj4kuqvs69s2wsl90su4 -e "___SevenCharName.xch:xchYOURxchaddress" --override
  • https://pawket.app/ for some online chia tools. debugger coming soon…
    • implemented ecdh for chia addresses
    • ecdh for encrypted messages
  • https://github.com/trepca/chirp for chia messages
  • 1.43 TB of writes per k32
  • data layer added in 1.6
    • store hash in smart coin. updates are tracked on chain along with mirrors
    • http server bundled to download and serve data
      • selectively download layers if inclusion proof is acceptable
    • can store key value pairs of json etc
      • works with offer files
    • ex of video sharing with datalayer https://github.com/jjldv/ChiaTubi
  • mojo node sql for block reorg
  • space farmers pool runs community node
    • light farming alternative since flexpool shutdown
  • xch.events for mempool explorer

monero

  • use block > 2,688,888 restore height for faster sync times with view tag support (resend old funds etc)
  • supports tor with sending tx's and wallets
    • tx-proxy for sending transactions
    • anonymous-inbound allow inbound transactions
  • randomx for POW algorithm
    • ASIC resistance may not be stable long term
      • advertised asic miners contest specific nonces (horizontal lines on graph of block nonces)
        • potential for social cascading for miners to skip those nonces (making the asics better?)
  • tail emissions of 0.6 XMR per block
  • variable block sizes
    • potential difficulty/timestamp grinding but at cost
  • p2pool for distributed block creation
    • needs zmq enabled monerod
    • bundled with gui in 0.18
    • mini side chain for lower hashrate
    • xmrvsbeast raffle bonus
  • ringct
    • bulletproofs
    • ring signatures to obsurce sender, amount, recipient
      • can still trace 'outputs' if you are the sends (alice bob alice attack) or if network is deanonymized (exchanges/users publish view keys, block reward before if enters txo set, transaction fee correlation)
        • churn to avoid and create noise
  • stealth addresses
    • random 1 time addresses for every transaction
  • Dandelion++
    • transaction broadcast and peer sampling to prevent tracing tx origins
  • No light/SPV clients
    • view tags since v0.18
  • lockable spends with locked_transfer
  • churn, fracture and consolidate tools
  • haveno for p2p order book https://blog.nihilism.network/servers/haveno-client-f2f/index.html
    • make haveno-apps && make haveno-desktop-mainnet or ./gradlew --no-daemon :core:compileJava :desktop:build -x test -x checkstyleMain -x checkstyleTest
      • guix package -i monero tor gtk+ mesa libxxf86vm libx11 openjdk:jdk
      • CookieAuthentication 1 and ControlPort 9051 in tor -f .torrc
      • ln -s ~/.guix-profile/monero-wallet-rpc and ~/.guix-profile/bin/monerod to ~/.local/share/Haveno-reto
      • LD_LIBRARY_PATH=~/.guix-profile/lib/ ./haveno-desktop --torControlPort='9051' --torControlCookieFile=$HOME/.tor/control_auth_cookie --torControlUseSafeCookieAuth --useTorForXmr='on' --socks5ProxyXmrAddress='127.0.0.1:9050' --baseCurrencyNetwork=XMR_MAINNET --useLocalhostForP2P=false --useDevPrivilegeKeys=false --nodePort=9999 --appName=Haveno-reto --apiPassword=apitest --apiPort=1201 --useNativeXmrWallet=false --ignoreLocalXmrNode=fals
    • reto simplex https://smp5.simplex.im/g#-_h6fBWisca6RKhteZtVuXol1a49vFH1Jo-n74fnRK0
#!/bin/bash -e

# https://xmrig.com/docs/miner/hugepages#onegb-huge-pages

sysctl -w vm.nr_hugepages=$(nproc)

for i in $(find /sys/devices/system/node/node* -maxdepth 0 -type d);
do
    echo 3 > "$i/hugepages/hugepages-1048576kB/nr_hugepages";
done

echo "1GB pages successfully enabled"

#guix pack -S /bin=bin -f docker --with-commit=p2pool=6cf1b13500795260fd9b98de393ecd19f5aabd5d p2pool

# forward TCP for monerod
#upnpc -e monero -r 18080 TCP

# p2pool mini chain
#upnpc -e p2pool -r 37889 TCP

# p2pool chain
#upnpc -e p2pool -r 37888 TCP

sudo xmrig --randomx-1gb-pages --huge-pages-jit -t 12 -o 127.0.0.1:3333  -B

bitcoin

  • reuse of ECDSA signatures can lead to key compromise (polynonce attack). use deterministic dsa instead (eddsa or RFC 6979)
  • double sha256
  • fixed block size
  • fixed supply ~21m
  • lightning
    • hash time locked contacts
      • moving to point time locked contracts
    • rebalance incoming/outgoing channels for sending/receiving/routing
    • preimage based
    • watchtowers
      • monitor channel transactions and punish bad actors incase of attack on your node (publishing false state to chain) by publishing new state and penalizing
    • taro for colored coins/assets
  • bip 351 payment codes for private transactions
  • fedimint - protocol for multisig group m:n (federation) that issues 'ecash' that is backed by sats. Tradable with other federation members (half-online). No/lower fees are not written to chain unless ecash is turned into sats by federation.

btcpayserver

  • crypto payment server that supports invoices (multiple payments, refunds, tolerances etc)
  • xmr config requires the view only wallet.keys, wallet and password file be available before sync can complete
  • sync MUST be completed before the FIRST store can be created
apiVersion: apps/v1
kind: Deployment
metadata:
  name: btcpay-deployment
  labels:
    app: btcpay
spec:
  replicas: 1
  selector:
    matchLabels:
      app: btcpay
  template:
    metadata:
      labels:
        app: btcpay
    spec:
      volumes:
      - name: btcpay-data
        hostPath:
          path: /storage/btcpay/btcpay-data
      - name: btcpay-plugins
        hostPath:
          path: /storage/btcpay/btcpay-plugins
      - name: postgres-data
        hostPath:
          path: /storage/btcpay/btcpay-postgres
      - name: monero-config
        hostPath:
          path: /storage/btcpay/btcpay-bitmonero
      - name: monero-wallet
        hostPath:
          path: /storage/btcpay/btcpay-xmr-wallet
      containers:
      - name: btcpay
        image: btcpayserver/btcpayserver:1.7.1-altcoins
        volumeMounts:
        - name: btcpay-data
          mountPath: /datadir
        - name: btcpay-plugins
          mountPath: /root/.btcpayserver/Plugins
        - name: monero-wallet
          mountPath: /root/xmr_wallet
        env:
        - name: BTCPAY_POSTGRES
          value: "User ID=postgres;Host=127.0.0.1;Port=5432;Application Name=btcpayserver;Database=btcpayserver"
        - name: BTCPAY_NETWORK
          value: regtest
        - name: BTCPAY_BIND
          value: 0.0.0.0:49392
        - name: BTCPAY_ROOTPATH
          value: /
        - name: BTCPAY_SSHCONNECTION
          value: "root@host.docker.internal"
        - name: BTCPAY_SSHTRUSTEDFINGERPRINTS
          value: ""
        - name: BTCPAY_SSHKEYFILE
          value: ""
        - name: BTCPAY_SSHAUTHORIZEDKEYS
          value: ""
        - name: BTCPAY_DEBUGLOG
          value: btcpay.log
        - name: BTCPAY_UPDATEURL
          value: https://api.github.com/repos/btcpayserver/btcpayserver/releases/latest
        - name: BTCPAY_DOCKERDEPLOYMENT
          value: "true"
        - name: BTCPAY_CHAINS
          value: "xmr"
        - name: BTCPAY_XMR_DAEMON_URI
          value: http://127.0.0.1:18081
        - name: BTCPAY_XMR_WALLET_DAEMON_URI
          value: http://127.0.0.1:18082
        - name: BTCPAY_XMR_WALLET_DAEMON_WALLETDIR
          value: /root/xmr_wallet
        ports:
        - name: btcpay-port
          containerPort: 49392
          hostPort: 49392
      - name: monerod
        image: btcpayserver/monero:0.18.1.0-amd64 # needs Containerfile with EXPOSE 18084 for p2pool zmq
        volumeMounts:
        - name: monero-config
          mountPath: /home/monero/.bitmonero
        args: ["--no-zmq", "--rpc-bind-ip=0.0.0.0", "--confirm-external-bind", "--rpc-bind-port=18081", "--non-interactive", "--hide-my-port", "--prune-blockchain", "--disable-dns-checkpoints", "--enable-dns-blocklist", "--block-notify", "/bin/sh ./scripts/notifier.sh -X GET http://127.0.0.1:49392/monerolikedaemoncallback/block?cryptoCode=xmr&hash=%s"] # "--zmq-pub", "tcp://127.0.0.1:18084", "--limit-rate-up", "800", "--out-peers", "30",
        command: ["monerod"]
        ports:
        - name: monero-rpc
          containerPort: 18081
          hostPort: 18081
      - name: monerod-wallet
        image: btcpayserver/monero:0.18.1.0-amd64
        volumeMounts:
        - name: monero-wallet
          mountPath: /wallet
        args: ["--rpc-bind-ip=0.0.0.0", "--disable-rpc-login", "--confirm-external-bind", "--rpc-bind-port=18082", "--non-interactive", "--trusted-daemon", "--daemon-address=127.0.0.1:18081", "--wallet-file=/wallet/wallet", "--password-file=/wallet/password", "--tx-notify", "/bin/sh ./scripts/notifier.sh  -X GET http://127.0.0.1:49392/monerolikedaemoncallback/tx?cryptoCode=xmr&hash=%s"]
        command: ["monero-wallet-rpc"]
        ports:
        - name: monero-daemon-rpc
          containerPort: 18082
          hostPort: 18082
      - name: postgres
        image: btcpayserver/postgres:13.7
        volumeMounts:
        - name: postgres-data
          mountPath: /var/lib/postgresql/data
        args: ["-c", "random_page_cost=1.0", "-c", "shared_preload_libraries=pg_stat_statements"]
        env:
        - name: POSTGRES_HOST_AUTH_METHOD
          value: trust
        ports:
        - name: postgres-port
          containerPort: 5432
          hostPort: 5432
  • Sage: Logout of your wallet, click the (…) on your wallet, then Details to get the public key
  • publish chia plugin with dotnet build -c Release
    • https://plugin-builder.btcpayserver.org/public/plugins has monero and chia plugin at conflicting minimum/max versions for btcpay so use my fork to change the compat for .net10 on chia or use older
    • run without userns-id
    • changes
      • updated btcpayserver submodule to latest
      • change dotnet from 8 to 10 and lang to 14 in .csproj
      • vendored Nethermind.Crypto.Bls for newer dotnet 10 version
      • updated chia-dotnet for dotnet10
    • BTCPayServer.PluginPacker with dotnet run ../../BTCPayServer.Plugins.Chia/bin/Release/net10.0/ BTCPayServer.Plugins.Chia . from btcpayserver-chia-plugin/btcpayserver/BTCPayServer.PluginPacker
      • manual .btcpay for web ui cd ./BTCPayServer.Plugins.Chia/bin/Release/net10.0/ && zip -r ../BTCPayServer.Plugins.Chia.btcpay ./
      • alternatively copy libs and deps json cp -r /gnu/git/btcpayserver-chia-plugin/BTCPayServer.Plugins.Chia/bin/Release/net10.0/* /gnu/git/btcpay/btcpay-plugins/BTCPayServer.Plugins.Chia
        • check deps.json for native lib in path
"Nethermind.Crypto.Bls/1.0.5": {
  "runtime": {
    "Nethermind.Crypto.Bls.dll": {
      "assemblyVersion": "1.0.5.0",
      "fileVersion": "1.0.5.0"
    }
  },
  "runtimeTargets": {
    "runtimes/linux-x64/native/libblst.so": {
      "rid": "linux-x64",
      "assetType": "native"
    }
  }
}
  • Nethermind.Crypto.Bls vendors a precompiled native library that does not support cpu feature(ADX but it has BMI) unless https://github.com/supranational/blst/ is rebuilt for the native lib with ./build.sh -D__BLST_PORTABLE__ -shared
    • copy cp libblst.so /gnu/git/btcpay/btcpay-plugins/BTCPayServer.Plugins.Chia/runtimes/linux-x64/native/libblst.so or into the vendored (the project does this within the github pipeline)
    • if you vendor with a project reference in .csproj you must edit the deps.json for native lib as the unpublished project (for .net10 unpublish commit) doesn't add the native entry without nuget package(long standing issues dotnet/sdk#765 dotnet/sdk#1088 dotnet/sdk#24708)
    • 1.5.0 is built with portable flags
  • restart btcpayserver and view logs podman logs btcpay-deployment-pod-btcpay
  • create plugin json
{
  "Identifier": "BTCPayServer.Plugins.Chia",
  "Name": "Chia",
  "Version": "1.0.4",
  "Description": "Chia integration",
  "SystemPlugin": false,
  "Dependencies": [
    {
      "Identifier": "BTCPayServer",
      "Condition": ">=2.3.7"
    }
  ],
  "Documentation": null,
  "Source": null,
  "Author": null,
  "AuthorLink": null
}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: btcpay-deployment
  labels:
    app: btcpay
spec:
  replicas: 1
  selector:
    matchLabels:
      app: btcpay
  template:
    metadata:
      labels:
        app: btcpay
    spec:
      volumes:
      - name: btcpay-data
        hostPath:
          path: /gnu/git/btcpay/btcpay-data
      - name: btcpay-plugins
        hostPath:
          path: /gnu/git/btcpay/btcpay-plugins
      - name: postgres-data
        hostPath:
          path: /gnu/git/btcpay/btcpay-postgres
      containers:
      - name: btcpay
        image: btcpayserver/btcpayserver:2.3.9
        volumeMounts:
        - name: btcpay-data
          mountPath: /datadir
        - name: btcpay-plugins
          mountPath: /root/.btcpayserver/Plugins
        env:
        - name: BTCPAY_POSTGRES
          value: "User ID=postgres;Host=127.0.0.1;Port=5432;Application Name=btcpayserver;Database=btcpayserver"
        - name: BTCPAY_NETWORK
          value: mainnet
        - name: BTCPAY_BIND
          value: 0.0.0.0:49392
        - name: BTCPAY_ROOTPATH
          value: /
        - name: BTCPAY_SSHCONNECTION
          value: "root@host.docker.internal"
        - name: BTCPAY_SSHTRUSTEDFINGERPRINTS
          value: ""
        - name: BTCPAY_SSHKEYFILE
          value: ""
        - name: BTCPAY_SSHAUTHORIZEDKEYS
          value: ""
        - name: BTCPAY_DEBUGLOG
          value: btcpay.log
        - name: BTCPAY_UPDATEURL
          value: https://api.github.com/repos/btcpayserver/btcpayserver/releases/latest
        - name: BTCPAY_DOCKERDEPLOYMENT
          value: "true"
        - name: "BTCPAY_NODEFAULTCHAIN"
          value: "true"
        - name: "COREHOST_TRACE"
          value: "1"
#        - name: BTCPAY_XMR_DAEMON_URI
#          value: http://127.0.0.1:18081
#        - name: BTCPAY_XMR_WALLET_DAEMON_URI
#          value: http://127.0.0.1:18082
#        - name: BTCPAY_XMR_WALLET_DAEMON_WALLETDIR
#          value: /root/xmr_wallet
        ports:
        - name: btcpay-port
          containerPort: 49392
          hostPort: 49392
      - name: postgres
        image: btcpayserver/postgres:18.1-1
        volumeMounts:
        - name: postgres-data
          mountPath: /var/lib/postgresql
        args: ["-c", "random_page_cost=1.0", "-c", "shared_preload_libraries=pg_stat_statements"]
        env:
        - name: POSTGRES_HOST_AUTH_METHOD
          value: trust
        ports:
        - name: postgres-port
          containerPort: 5432
          hostPort: 5432
  • Debug
    • set master key hex from greenfield api
      • create unrestricted api access token from account -> settings -> api keys
      • curl post the key. add optional , "addresses": ["xchADDR"] to the config object to create an initial invoice (generation seems broken with tested random pubkey?)
        • reset bad config with podman exec -it CONTAINER_ID psql -U postgres -d btcpayserver then UPDATE "Stores" SET "DerivationStrategies" = "DerivationStrategies" - 'XCH-CHIA' WHERE "Id" = 'STORE_ID'; replacing STOREID and CONTAINERID
curl -X PUT "http://127.0.0.1:49392/api/v1/stores/STORE_ID/payment-methods/XCH-CHIA"   -H "Authorization: token API_KEY"   -H "Content-Type: application/json"   -d '{
    "enabled": true,
    "config": { "masterPublicKey": "96ce91d974daa0990e6681ac2de3e3f49142f6b655a081817832265c143e658a6e60a5dec856f292f45fe2d04c7856f6" }
  }'
  • check results with curl -H "Authorization: token API_KEY" "http://127.0.0.1:49392/api/v1/stores/STORE_ID/payment-methods?includeConfig=true"