openssl

tags: Tools

July 15, 2022 · 1 min · Gray King

openssl unknown ca

tags: openssl This problem is caused about the ca certs are different between client and server.

July 15, 2022 · 1 min · Gray King

Move Resources Permissions

tags: Move,Starcoin Web3 StarTrek Bedrock – Object-capability model In my words, Move is kind of a Resource-Oriented Programming language. The resource is represented by struct in Move, aka object in other programming language. By the way, the resource in Move is the struct which cannot be copied and cannot be dropped1. Distinct from other programming language, objects are stored in memory, resource in Move can store to the chain’s global storage. ...

July 5, 2022 · 2 min · Gray King

Brevity 500: 500 mini-games to help you learn powerful writing skills

tags: How to Write,Online Tools source: https://brevity500.com/

June 30, 2022 · 1 min · Gray King

GitHub: hackclub/some-assembly-required

tags: Assembly source: https://github.com/hackclub/some-assembly-required What do we mean by an abstraction? Well, an abstraction is a layer above something else that makes that thing easier to do.

June 29, 2022 · 1 min · Gray King

How is a Block Executed

tags: Starcoin Web3 StarTrek,Move When I start learning Move and looking at the stdlib starcoin-framework and starcoin-framework-commons. Then I realized there are must some magic during the block execution in runtime. To roll the world, the runtime should provide some built in types and call some function in the stdlib. How does StarcoinVM Validate Transactions? As a miner, it’s responsible for executing block, it follows: Received some transactions from P2P network: EventHandler of PeerTransactionsMessage. ...

June 24, 2022 · 5 min · Gray King

Starcoin Node Debug

tags: Starcoin Web3 StarTrek Start node with console: $ ./target/debug/starcoin -d ~/.starcoin -n dev console In console type: starcoin% dev log level debug Note: starcoin% is the prompt. Then we can see debug log in ~/.starcoin/dev/starcoin.log.

June 21, 2022 · 1 min · Gray King

Move: A Language With Programmable Resources

tags: Move,Starcoin Web3 StarTrek source: Blackshear, Sam, Evan Cheng, David L Dill, Victor Gao, Ben Maurer, Todd Nowacki, Alistair Pott, et al. “Move: A Language With Programmable Resources,” n.d., 26.

June 18, 2022 · 1 min · Gray King

Move

tags: Starcoin Web3 StarTrek,Blockchain,Smart contracts

June 18, 2022 · 1 min · Gray King

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

P2P

tags: Starcoin Web3 StarTrek,Blockchain

June 15, 2022 · 1 min · Gray King

starcoin#3450

tags: Starcoin Web3 StarTrek,starcoin issue solving Today I saw this issue: starcoin#3450 at GitHub, I decide to give it a try. The corresponding type VMStatus is defined out of starcoin’s reposiotry, here. The work need to be done seems are: convert function from u16 to a readable string. convert status_code from StatusCode to a readable string. Let’s take a look at StatusCode first, StatusCode is a enum that contains lot of variants, WOW! My intuition is that can we just get the name of the variant by it’s value. Or I’ll write an ugly match that contains tons of arms. Maybe there already existed some similar code, Let me do a search. ...

June 11, 2022 · 2 min · Gray King

starcoin issue solving

tags: Starcoin Web3 StarTrek

June 11, 2022 · 1 min · Gray King

Addressable Merkle Tree(AMT)

tags: Merkle tree,Blockchain,Starcoin Web3 StarTrek source: Gao, Zhenhuan, Yuxuan Hu, and Qinfan Wu. “Jellyfish Merkle Tree,” n.d., 12. What is Addressable mean? It means the leaf node in the tree can be found by an address. The address encoded the path to the leaf node, for example, a leaf node in a binary tree, which has 3 level. Its address may be encoded to 010, the corresponding path is: left->right->left: 0 1 0 + + + v v v left right left root / \ H1 H2 /\ /\ D1 D2 D3 D4 As we can see, the address 010 leads us to the leaf node D2. ...

June 7, 2022 · 2 min · Gray King

UTXO VS. ACCOUNT MODEL

tags: Starcoin Web3 StarTrek,Account-Model Blockchain Systems source: https://academy.horizen.io/technology/expert/utxo-vs-account-model/

June 7, 2022 · 1 min · Gray King

Account-Model Blockchain Systems

tags: Starcoin Web3 StarTrek,Ethereum,Merkle tree

June 7, 2022 · 1 min · Gray King

Patricia Merkle Tree

tags: Starcoin Web3 StarTrek,Merkle tree,Ethereum Powers the widely known Ethereum network.

June 7, 2022 · 1 min · Gray King

Seal is a verifiable timestamp mechanism for cryptographically proving that a note is created before a specific time.

tags: Let’s Encrypt,Merkle tree source: https://docs.planet.ink/data/seal/ This idea is genius, it use a merkle tree to combine serval notes. And use the root hash of merkel tree to obtain a certificate from Let’s Encrypt.

June 6, 2022 · 1 min · Gray King

Binary Search : Median of two sorted arrays of different sizes.

tags: Binary Search,LeetCodeNJ YouTube: https://www.youtube.com/watch?v=LPFhl65R7ww The most difficult thing is doing binary search among two sorted arrays, in this video Tushar Roy given us a straightforward method of how to do binary search among tow sorted arrays. Assume we have two sorted arrays, X and Y, and cut them between at x2,x3 and y3,y4: If we meet the conditions: x2 <= y3 y2 <= x3 then we find the median postion, as the merged arrays of the four elements may be order by: ...

June 6, 2022 · 1 min · Gray King

LeetCodeNJ

tags: Algorithm,Data Structures Make my best effort to move to Nanjing for my son. This is a successor of LeetCode101.

June 6, 2022 · 1 min · Gray King

Starcoin Blockchain from Scartch

tags: Starcoin Web3 StarTrek,Blockchain Overview Block is the basic element in a blockchain system, as we known blockchain system is just a ledger, which means a bookkeeping1 that recording of financial transactions. In the blockchain system, those transactions are stored in the blocks. In each block, the data stored in may look like: TXN FROM TO VALUE #0 God Cale 100 #1 Cale Alice 10 #2 Alice Bob 1 #3 Bob Mike 0.5 Then what’s a blockchain? Just simply chain the blocks together, usually add a field to point to its parent: ...

June 2, 2022 · 1 min · Gray King

Sparse Merkle Tree

tags: Merkle tree,Starcoin Web3 StarTrek

June 2, 2022 · 1 min · Gray King

Jellyfish Merkle Tree

tags: Starcoin Web3 StarTrek,Sparse Merkle Tree,Merkle tree,LSM-Tree,Account-Model Blockchain Systems source: Gao, Zhenhuan, Yuxuan Hu, and Qinfan Wu. “Jellyfish Merkle Tree,” n.d., 12. JMT(Jellyfish Merkle Tree) a LSM-tree based Implementation of Sparse Merkle Tree Inspired by Patricia Merkle Tree and has been implemented in Rust, but it is language-independent. Merkel tree fits pretty well as an authenticated key-value store holding a huge amount of data in a tamper-proof way. Two major concerns where people have been trying to achieve some enhnacements: ...

June 2, 2022 · 1 min · Gray King

Starcoin PoW

tags: Starcoin Web3 StarTrek, Proof-of-work Generate nonce (random data) as salt to join to the data of block to be hash. The goal is to find a hash value that less than target. The target is influenced by difficulty. As the difficulty gets bigger and the target will be smaller, which means more difficult to find. pub fn difficult_to_target(difficulty: U256) -> U256 { U256::max_value() / difficulty }

June 1, 2022 · 1 min · Gray King

Merkle tree

tags: Starcoin Web3 StarTrek,Blockchain source: Wikipedia: Merkle tree Starcoin Cookbook What is a Merkle tree. Merkle tree is a hash tree, named after Ralph Merkle, who patented in 1979. Most implementations of them are binary, which means two child nodes under each node. Why the merkle tree is important to the peer-to-peer network? The main purpose of a merkle tree is to ensure the data we received from a peer-to-peer network are undamaged and unaltered, it’s important as the data were splitted into many blocks and stored in multiple nodes in the network. ...

June 1, 2022 · 2 min · Gray King

Starcoin Learn Resource

tags: Starcoin Web3 StarTrek The documentation of Starcoin are written in multiple places: The Developers Documentation on the main site English Version Chinese Version The Starcoin Cookbook English Version Chinese Version

June 1, 2022 · 1 min · Gray King

Compile Starcoin from Source And Setup a Dev Node

tags: Starcoin Web3 StarTrek Why compile starcoin from source? Why not download a released binary? Because I want to contribute code to it, maybe in the future. But the toolchain is awesome, the progress is very simple. Just two steps: Clone the code from GitHub git clone git@github.com:starcoinorg/starcoin.git Run scripts/dev_setup.sh: cd starcoin ./scripts/dev_setup.sh Then we are ready to compile: cargo build Wait? You haven’t install Rust yet? Please refer to Getting started. ...

May 31, 2022 · 1 min · Gray King

Starcoin Web3 StarTrek

tags: Web3 Learn journal of Starcoin Web3 StarTrek Program, check the follow “Links to this note”.

May 31, 2022 · 1 min · Gray King

Blogchain

tags: ipfs source: https://blogchain.app/home

May 31, 2022 · 1 min · Gray King

ipfs

source: https://github.com/ipfs/ipfs site: https://ipfs.io/

May 31, 2022 · 1 min · Gray King

IPFS

May 31, 2022 · 0 min · Gray King

Words that I always forgot

Some words that I always forget util I wrote it down: discipline collapse phantom

May 14, 2022 · 1 min · Gray King

Fast bitset decoding using Intel AVX-512

tags: High Performance,SIMD source: Lemire, Author Daniel. “Fast Bitset Decoding Using Intel AVX-512.” Daniel Lemire’s Blog (blog). Accessed May 12, 2022. https://lemire.me/blog/2022/05/06/fast-bitset-decoding-using-intel-avx-512/.

May 12, 2022 · 1 min · Gray King

Master’s Degree in Computer Science

May 6, 2022 · 0 min · Gray King

Master’s Degree in Computer Science

tags: Degree source: evanprodromou. “Master’s Degree in Computer Science.” Evan Prodromou’s Blog (blog), May 4, 2022. https://evanp.me/2022/05/04/masters-degree-in-computer-science/.

May 6, 2022 · 1 min · Gray King

【01B0801】 计算机及应用(独立本科段)

tags: Degree source: “【01B0801】 计算机及应用(独立本科段).” Accessed May 6, 2022. http://zkxcx.bjeea.cn/portal/kszylb.jsp?zydm=01B0801&amp;tab=2. Required Courses Code Name Credit Type Level1 Status2 Free Online Courses 03708 中国近现代史纲要 2 Political 5 pending 03708 马克思主义基本原理概论 4 Political 5 pending 00015 英语(二) 14 Basic 1 passed 00023 高等数学(工本) 10 Basic 7 pending 02197 概率论与数理统计(二) 3 Basic 7 pending 02324 离散数学 4 CS 7 pending 腾讯课堂 04737 C++程序设计 3 CS 1 pending 04738 C++程序设计(实践) 2 CS - pending 02326 操作系统 4 CS 2 pending 02327 操作系统(实践) 1 CS - pending 02331 数据结构 3 CS 2 pending 04734 数据结构(实践) 2 CS - pending 02325 计算机系统结构 4 CS 3 pending 04735 数据库系统原理 4 CS 1 pending 04736 数据库系统原理(实践) 2 CS - pending 02333 软件工程 3 CS 3 pending 02334 软件工程(实践) 1 CS - pending 04741 计算机网络原理 4 CS 2 pending 04747 Java语言程序设计(一) 3 CS 1 pending 04748 Java语言程序设计(一)(实践) 1 CS 1 pending 10027 计算机及应用专业毕业设计 0 CS 1 wait Summary: ...

May 6, 2022 · 2 min · Gray King

Carr

May 6, 2022 · 0 min · Gray King

Why I Decide to Get A Computer Science Degree in 2022

tags: Degree, Career I haven’t got a CS degree, it wasn’t a big deal when I was yonger, as I was cheap and many employers could affort, and didn’t care too much about it. But now days, when I’m 30+ years old, and not cheap anymore. The employers who can affort me are much less. And most of them are required a CS degree, so the degree is important to me now. ...

May 6, 2022 · 2 min · Gray King

My experience getting a tech job with no degree or relevant work experience

tags: Degree source: Engineer, Lowly Midwestern. “My Experience Getting a Tech Job with No Degree or Relevant Work Experience.” Substack newsletter. Lowly Midwestern Engineers’ Newsletter (blog), May 2, 2022. https://lowlyswe.substack.com/p/my-experience-getting-a-tech-job.

May 6, 2022 · 1 min · Gray King

How I Got a Computer Science Degree in 3 Months for Less Than $5000 | Miguel Rochefort

tags: Degree source: “How I Got a Computer Science Degree in 3 Months for Less Than $5000 | Miguel Rochefort.” Accessed April 28, 2022. https://miguelrochefort.com/blog/cs-degree/.

May 6, 2022 · 1 min · Gray King

Degree

tags: Career

May 6, 2022 · 1 min · Gray King

Luhn algorithm using SWAR and SIMD

tags: SIMD,High Performance source: “Luhn Algorithm Using SWAR and SIMD.” Accessed May 5, 2022. https://nullprogram.com/blog/2022/04/30/. 3x increase after used SIMD.

May 5, 2022 · 1 min · Gray King

Removing characters from strings faster with AVX-512

tags: SSE/AVX/AVX2/AVX512,High Performance source: Lemire, Author Daniel. “Removing Characters from Strings Faster with AVX-512.” Daniel Lemire’s Blog (blog). Accessed May 5, 2022. https://lemire.me/blog/2022/04/28/removing-characters-from-strings-faster-with-avx-512/. It’s 21.25 times faster with AVX-152: 0.4 GB/s to 8.5 GB/s.

May 5, 2022 · 1 min · Gray King

GnuPG Can not Sign Commit with Magit in Terminal Text Mode

tags: Emacs,GnuPG Pinentry,GnuPG,GnuPG Agent There is a little bit more background here: I’m using Windows Subsystem Linux(WSL) now, which means I was running Emacs in a virtual machine with Debian Linux distro. And also I ran Emacs in GUI mode with WSL, the pinentry for GnuPG Agent is: /usr/bin/pinentry-gtk2, everything was prefect. This morning I couldn’t commit with Magit in Emacs, when I was running my Emacs in Terminal Text Mode. The first thing I had done is change the pinentry: ...

May 1, 2022 · 1 min · Gray King

GnuPG

tags: Unix,Tools

May 1, 2022 · 1 min · Gray King

GnuPG Agent

tags: GnuPG

May 1, 2022 · 1 min · Gray King