• My Solutions for The Little Typer (Chapter 3)

    #lang pie (claim + (-> Nat Nat Nat)) (define + (lambda (a b) (iter-Nat a b (lambda (res) (add1 res)) ) ) ) (claim gauss (-> Nat Nat)) (define gauss (lambda (a) (rec-Nat a 0 (lambda (aminus1) (+ (add1 aminus1))) ) ) ) (claim * (-> Nat Nat Nat) )...


  • Simple example of homomorphic encryption

    This post is inspired by “Why and How zk-SNARK Works: Definitive Explanation” by Maksym Petkus. Homomorphic encryption Pick two natural numbers $g, n$. For any value $x$, encrypt it by taking $g^x \pmod n$. In other words, this is a straightforward application of the discrete logarithm problem. It might make...


  • How to start a standalone node with load generation

    Start a standalone node Create stellar-core/stellar-core.cfg and copy and paste the following: HTTP_PORT=8080 PUBLIC_HTTP_PORT=false RUN_STANDALONE=true NETWORK_PASSPHRASE="My local test network" NODE_SEED="SDQVDISRYN2JXBS7ICL7QJAEKB3HWBJFP2QECXG7GZICAHBK4UNJCWK2 self" NODE_IS_VALIDATOR=true ARTIFICIALLY_GENERATE_LOAD_FOR_TESTING=true DATABASE="sqlite3://stellar.db" COMMANDS=["ll?level=info"] FAILURE_SAFETY=0 UNSAFE_QUORUM=true [QUORUM_SET] THRESHOLD_PERCENT=100 VALIDATORS=["$self"] [HISTORY.vs] get="cp /tmp/stellar-core/history/vs/{0} {1}" put="cp {0} /tmp/stellar-core/history/vs/{1}" mkdir="mkdir -p /tmp/stellar-core/history/vs/{0}" Run make install -j3; stellar-core new-db; stellar-core force-scp; stellar-core run...


  • How to run two nodes locally

    See the administration guide Create two copies of stellar-core. In other words, you should have something like ~/stellar-core and ~/stellar-core-2 such that each of them is a copy of Stellar Core. In the following, we will assume that you have one copy in ~/stellar-core and another in ~/stellar-core-2. Install each...


  • How to install clang-format 5.0.0 on Mac

    Download Clang Version 5.0.0 for macOS (.sig). (Scroll down a bit, and you’ll see 5.0.0.) Unzip it by clicking it. cd ~/Downloads/clang+llvm-5.0.0-x86_64-apple-darwin. Run ls and confirm that you see bin, include, lib, libexec and share. Run sudo cp -R * /usr/local/. NOTE: In retrospect, I think it’s better to do...