Skip to content

Instantly share code, notes, and snippets.

View brunopgalvao's full-sized avatar
πŸš€

Bruno Galvao brunopgalvao

πŸš€
View GitHub Profile
@brunopgalvao
brunopgalvao / Block.rs
Created June 9, 2025 10:10
ProofOfStakeBlockchain example
use sha2::{Sha256, Digest};
// A single block in our proof-of-stake blockchain
#[derive(Debug, Clone)]
struct Block {
index: u64, // Position in the chain (0, 1, 2, ...)
data: String, // The actual data/transactions
previous_hash: String, // Hash of the previous block
hash: String, // This block's unique identifier
validator: String, // Address of the validator who created this block
@brunopgalvao
brunopgalvao / Blockchain.rs
Last active June 9, 2025 10:11
example PoW blockchain
// The blockchain itself - a collection of blocks
struct Blockchain {
chain: Vec<Block>,
difficulty: usize,
}
impl Blockchain {
// Create a new blockchain with genesis block
fn new() -> Blockchain {
let mut blockchain = Blockchain {
bruno@Brunos-MacBook-Pro zombienet % ./zombienet-macos -p native spawn network.toml
╔════════════════════╀════════════════════════════════════════════════════════════════════════════════════════════════════╗
β•‘ 🧟 Zombienet 🧟 β”‚ Initiation β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ Provider β”‚ native β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ Namespace β”‚ zombie-1720314a23576f83dad2c23dbfb9db12 β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ Temp Dir β”‚ /var/folders/vl/txnq6gdj22s9rn296
./zombienet-macos -p native spawn network.toml
╔════════════════════╀════════════════════════════════════════════════════════════════════════════════════════════════════╗
β•‘ 🧟 Zombienet 🧟 β”‚ Initiation β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ Provider β”‚ native β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ Namespace β”‚ zombie-fab3e0b5d0f9f506fc27a7a02dc7715e β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ Temp Dir β”‚ /var/folders/vl/txnq6gdj22s9rn296z0md27w0000gn/T/zombie-fab3e0b5d0f9f506fc27a7a02dc7715e
@brunopgalvao
brunopgalvao / brunopgalvao.md
Created March 26, 2024 04:18
Bruno Galvao's profile

Bruno Galvao

Bruno is an ex-Parity Technologies engineer (the company that built the Polkadot blockchain) and is now part of R0GUE.io building an L1 smart contract blockchain for Polkadot.

Bruno has over 10 years of software development experience working in large publicly traded companies as well as small software startups. His passion comes at an intersection between software craftsmanship adhering to practices such as pair programming, TDD, code reviews, agile methodology, microservices, and challenging himself on a daily basis to create scalable defect-free software, as well as leading business initiatives between client stakeholder needs and developing their go-to-market solution.

Notably, he is top ten in the Polkadot / Substrate Stack Exchange:

@brunopgalvao
brunopgalvao / second_run_with_concurrent_fetching.txt
Created February 19, 2024 07:57
Concurrent fetching of child keys
bruno@Brunos-MacBook-Pro polkadot-sdk % TEST_WS=wss://rococo-try-runtime-node.parity-chains.parity.io:443 cargo test --features=remote-test -p frame-remote-externalities -- --nocapture
Compiling frame-remote-externalities v0.35.0 (/Users/bruno/src/polkadot-sdk/substrate/utils/frame/remote-externalities)
Finished test [unoptimized + debuginfo] target(s) in 6.91s
Running unittests src/lib.rs (target/debug/deps/frame_remote_externalities-bb8145f00fa019be)
running 13 tests
βœ… Found 9 keys (1.14s)
βœ… Found 1 keys (1.11s)
[00:00:00] βœ… Downloaded key values 29.2672/s [===========================================================================================] 9/9 (0s)
βœ… Inserted keys into DB (0.00s)
@brunopgalvao
brunopgalvao / install.md
Created June 13, 2023 17:16
rust toolchain for trappist

Select default install

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/env
@brunopgalvao
brunopgalvao / rust-toolchain.toml
Created June 8, 2023 15:48
trappist rust-toolchain.toml
[toolchain]
channel = "nightly-2023-01-01"
components = [ "rustfmt" ]
targets = [ "wasm32-unknown-unknown" ]
profile = "minimal"
@brunopgalvao
brunopgalvao / snippet.sh
Created April 4, 2023 09:46
rustup show
$ rustup show
Default host: x86_64-apple-darwin
rustup home: /Users/bruno/.rustup
installed toolchains
--------------------
stable-aarch64-apple-darwin (default)
stable-x86_64-apple-darwin
nightly-2022-02-10-x86_64-apple-darwin
@brunopgalvao
brunopgalvao / 8000
Last active March 20, 2023 06:43
WS_PORT=8000 cargo test --features e2e-tests
WS_PORT=8000 cargo test --features e2e-tests
warning: /Users/bruno/src/substrate-contracts-node/flipper/Cargo.toml: unused manifest key: dev-dependencies.ink_e2e.package_name
Compiling ink_e2e v4.0.1 (https://github.com/paritytech/ink.git?branch=cmichi-use-sc-chopstick-compatible#aa4345d2)
Compiling flipper v4.0.1 (/Users/bruno/src/substrate-contracts-node/flipper)
[1/*] Building cargo project
warning: /private/var/folders/1d/6s8fc3sd60n73mhszqvnks8w0000gn/T/cargo-contract_QcrXYr/Cargo.toml: unused manifest key: dev-dependencies.ink_e2e.package_name
Finished release [optimized] target(s) in 0.18s
[1/*] Building cargo project
warning: /private/var/folders/1d/6s8fc3sd60n73mhszqvnks8w0000gn/T/cargo-contract_ciBtMg/Cargo.toml: unused manifest key: dev-dependencies.ink_e2e.package_name
Finished release [optimized] target(s) in 0.15s