How is an Account Created

tags: Starcoin Web3 StarTrek,Account-Model Blockchain Systems We can create an account by wallet like MetaMask or StarMask, but I’m curious about how an account is created on the blockchain system. As a wallet has been embedded in the starcoin node, we can use it to create an account as follow: $ ./target/debug/starcoin -d ~/.starcoin -n dev account create -p my-pass { "ok": { "address": "0x2f1aeb63bd30d8eb841d6a941c5d6df3", "is_default": false, "is_readonly": false, "public_key": "0x91f79bdd9ced49332bf85b751d02339e05aff047c386d0c14b380d8519d2fb4b", "receipt_identifier": "stc1p9udwkcaaxrvwhpqad22pchtd7vy2276p" } } As above we can see our account has been created, and the address is: 0x2f1aeb63bd30d8eb841d6a941c5d6df3. We’ll find some files are created, if we check our local directory at ~/.starcoin/dev: ...

June 16, 2022 · 4 min · Gray King

Luck Surface Area: How to Get Lucky In Life(a Note of "How to Get Rich")

tags: Career,How To Get Rich (without getting lucky) source: Frontera. “Luck Surface Area: How to Get Lucky In Life,” May 31, 2022. https://fronterablog.com/luck-surface-area/. 5 ways to expand your luck surface area: Do & Tell, don’t miss the “telling” part. Follow your curiosity Talk to new peopli Build a personal brand Take luck as a skill

June 15, 2022 · 1 min · Gray King

Rust libp2p

tags: libp2p,Starcoin Web3 StarTrek source: https://docs.rs/libp2p/0.45.1/libp2p/tutorials/index.html Ping: Four necessary traits Identity: PeerId and corresponding Keypair Transport: send and receive bytes on the network. NetworkBehaviour: decode or encode the bytes from the Transport. Swarm: drives both a Transport and a NetworkBehaviour forward. use futures::StreamExt; use libp2p::ping::{Ping, PingConfig}; use libp2p::{identity, Multiaddr, PeerId, Swarm}; use std::error::Error; #[async_std::main] async fn main() -> Result<(), Box<dyn Error>> { // First we need to create a network identity. let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); println!("Local peer id: {:?}", local_peer_id); // Then construct a transport: defines how to send bytes on the network. let transport = libp2p::development_transport(local_key).await?; // NetworkBehaviour defines what bytes to send on the network. let behaviour = Ping::new(PingConfig::new().with_keep_alive(true)); // Swarm connects transport and behaviour together: // // 1. Passing commands from NetworkBehaviour to the Transport. // 2. As well ass events from the Transport to the NetworkBehaviour. let mut swarm = Swarm::new(transport, behaviour, local_peer_id); swarm.listen_on("/ip4/0.0.0.0/tcp/0".parse()?)?; if let Some(addr) = std::env::args().nth(1) { let remote: Multiaddr = addr.parse()?; swarm.dial(remote)?; println!("Dialed {}", addr); } loop { match swarm.select_next_some().await { libp2p::swarm::SwarmEvent::NewListenAddr { listener_id: _, address, } => println!("Listening on {:?}", address), libp2p::swarm::SwarmEvent::Behaviour(event) => println!("{:?}", event), _ => {} } } Ok(()) }

June 15, 2022 · 1 min · Gray King

Distributed Hash Table

tags: P2P,libp2p,Starcoin Web3 StarTrek

June 15, 2022 · 1 min · Gray King

libp2p

tags: P2P,Starcoin Web3 StarTrek,Network source: https://docs.libp2p.io/ A set of protocols for peer identity, discover, routing, transport and more. Peer-to-peer network Peers or nodes communicate with oen another directly, it’s different from the client-server architecture. libp2p Solved Transport abstract data transmission and receipt to adapte many protocols, include the future protocols. Identity use public key cryptography as the basis of peer identity, with this: It gives each peer a globally unique “name”, in the form of a PeerId. PeerId allows anyone to retreve the public key for the identified peer, which enables secure communication between peers. Security libp2p supports “upgrading” a connection provided by a transport into a securely encrypted channel. Currently support; ...

June 15, 2022 · 1 min · Gray King