Ethereum Execution Layer
tags: Ethereum Networking Layer
tags: Ethereum Networking Layer
tags: Ethereum Networking, Ethereum Execution Layer
tags: Ethereum Sub-protocols, Ethereum Simulator Node Started when a RLPx session had initiated. Three main tasks before switch to PoS: Chain synchronization Block propagation Transaction exchange: exchange pending transaction between nodes. Only transaction exchange remit after switch to PoS.
tags: Ethereum Networking, Ethereum Execution Layer Basic stack for p2p networking. Initiating RLPx Session. RLPX Session Communicate messages that encoded in RLP between peers.
tags: Ethereum source: https://ethereum.org/en/developers/docs/networking-layer/
tags: Ethereum Networking, Ethereum Simulator Node Boot nodes Using a small set that hardcoded bootnodes to bootstrap. Protocol Kademlia a modified form of Distributed Hash Table. Steps to join the network start client –> connect to bootnode –> bond to bootnode –> find neighbours –> bond to neighbours
tags: Ethereum Simulator Node, Ethereum Execution Layer Node Side: Receive pending transactions If we want to broadcast our transactions to the network in Ethereum, two RPC calls are involved: https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction So let’s follow those two calls to track how a transaction is broadcasted. Those two corresponding implementations are defined at internal/ethapi/api.go: SendTransaction SendRawTransaction And both of them are pointing to SubmitTransaction, which calls SendTx to put transaction into the txpool by calling: func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error { return b.eth.txPool.AddLocal(signedTx) } Miner Side: Execute pending transactions Miner start here at cmd/geth/main.go, which is calling: ...
tags: Ethereum Simulator Only use the data of the mainnet to simulate transaction, and DONOT commit the final transaction to the mainnet. Relay To identify our transactions that need to simulate, if it’s failed then drop that tx, otherwise commit the final transaction to the mainnet. Things need to consider: How to limit or identify transactions that need to simulate? Only execute the transactions from local txpool. Where to execute the transction previously? ...
tags: Essay Writing Guide List outlines Explore the resources and documentation to understand Taking notes during the exploring Use the method of How to Take Smart Notes
tags: Learning English, Journal
tags: English Words Adjective (of an argument , theory, or policy) logical and consistent: they failed to develop a coherent economic strategy. united as or forming a whole: divided into a number of geographically coherent kingdoms. Physics (of waves) having a constant phase relationship.
source: https://jordanbpeterson.com/wp-content/uploads/2018/02/Essay_Writing_Guide.docx tags: How to Write PART I: INTRODUCTION Why are we need to learn how to write an essay? Writing an essay is to think by writing, formulate and organize ideas. Writing an essay is also to learn or explore a new topic. How to get things done? If you don’t have a big chunk of time in your daily life, then don’t relay your success on it, take 15 minutes every day is still powerful: 「日拱一卒,功不唐捐」. ...
tags: PostgresQL Recently, I met a problem in PostgresQL: the index mismatched after batch rows inserted. Run ANALYZE on the table solved this problem after batch rows inerted. Turns out autovacuum has been disabled on the PostgresQL instance: show autovacuum_analyze_scale_factor; show autovacuum_analyze_threshold ; SELECT * FROM pg_settings WHERE name LIKE '%autovacuum%';
tags: On The Road https://www.google.com/maps/dir/New+York/Joliet/Rock+Island,+IL/Rapids+City,+IL/Des+Moines,+IA/Adel,+Iowa/Stuart,+Iowa/Council+Bluffs,+Iowa/Omaha,+NE/Grand+Island,+NE/@40.7489186,-96.7492412,5z/data=!3m1!4b1!4m62!4m61!1m5!1m1!1s0x89c24fa5d33f083b:0xc80b8f06e177fe62!2m2!1d-74.0059728!2d40.7127753!1m5!1m1!1s0x880e456bec363d7d:0x9f9e66f7a36bc042!2m2!1d-88.0817251!2d41.525031!1m5!1m1!1s0x87e232c357044b77:0xecc19371d71475f1!2m2!1d-90.5787476!2d41.5094771!1m5!1m1!1s0x87e23f0ad2e7aeb3:0x43aab678fe9e328d!2m2!1d-90.3434615!2d41.5817!1m5!1m1!1s0x87ee99a4c1611ee7:0x710028512691e4b2!2m2!1d-93.6249593!2d41.5868353!1m5!1m1!1s0x87ec39285c3540b9:0x84581d5d4142c1ec!2m2!1d-94.017453!2d41.6144325!1m5!1m1!1s0x87ec60c99a9a7d0f:0xb0c00a66d8103978!2m2!1d-94.3183715!2d41.5034243!1m5!1m1!1s0x879381cfa109322f:0xbe4e81fa5222799e!2m2!1d-95.8608333!2d41.2619444!1m5!1m1!1s0x87938dc8b50cfced:0x46424d4fae37b604!2m2!1d-95.9345034!2d41.2565369!1m5!1m1!1s0x87998644ec7765f7:0xa12d5b784951b17b!2m2!1d-98.3420118!2d40.9263957!3e0
tags: Emacs, macOS source: Simon, Ben. “Gotcha: Emacs on Mac OS: Too Many Files Open.” Accessed April 18, 2023. https://www.blogbyben.com/2022/05/gotcha-emacs-on-mac-os-too-many-files.html. Add below code snippet to your init.el: (defun file-notify-rm-all-watches () "Remove all existing file notification watches from Emacs." (interactive) (maphash (lambda (key _value) (file-notify-rm-watch key)) file-notify-descriptors)) Then just execute M-x file-notify-rm-all-watches when you meet this problem next time.
tags: AI Clone nltk_data git clone https://github.com/nltk/nltk_data.git ~/.local/nltk_data Link nltk_data ln -sf ~/.local/nltk_data/packages ~/nltk_data Unzip cd ~/nltk_data/path unzip xx.zip
tags: Linux
tags: Cheatsheet, Bash source: Devhints.io cheatsheets. “Bash Scripting Cheatsheet.” Accessed April 17, 2023. https://devhints.io/bash.
tags: Cheatsheet, Linux source: “Searchable Linux Syscall Table for X86 and X86_64 | PyTux.” Accessed April 17, 2023. https://filippo.io/linux-syscall-table/.
tags: Starcoin Web3 StarTrek, Sign Message Invocation Path Dapp request personal_sign1 const msg = `0x${Buffer.from(exampleMessage, 'utf8').toString('hex')}` console.log({ msg }) const networkId = networkDiv.innerHTML const extraParams = { networkId } const sign = await window.starcoin.request({ method: 'personal_sign', // params: [msg, from, 'Example password'], // extraParams = params[2] || {}; means it should be an object: // params: [msg, from, { pwd: 'Example password' }], params: [msg, from, extraParams], }) Starmask handling request signPersonalMessage keyringController.signPersonalMessage(cleanMsgParams) 2 , 3 3 types of keyring:4 SimpleKeyring.signPersonalMessage HdKeyring.signPersonalMessage HdKeyringAptos.signPersonalMessage utils.signedMessage.generateSignedMessage5 ...
tags: Python
tags: Python, pyenv export PYTHON_BUILD_MIRROR_URL_SKIP_CHECKSUM=1 export PYTHON_BUILD_MIRROR_URL="https://mirrors.huaweicloud.com/python/"
tags: Sign Message The starmask has implemented about signing message of APTOS.
tags: Python, LSP source: https://emacs-lsp.github.io/lsp-pyright/#usage-notes Download Default Type Stubs git clone https://github.com/microsoft/python-type-stubs $HOME/.local/src/python-type-stubs Use it in Emacs (setq lsp-pyright-stub-path (concat (getenv "HOME") "/.local//src/python-type-stubs")) ;; example Add Django Type Stubs git clone git@github.com:typeddjango/django-stubs.git ~/.local/src/django-stubs ln -sf ~/.local/src/django-stubs/django-stubs ~/.local/src/python-type-stubs/django Add Celery Type Stubs git clone https://github.com/sbdchd/celery-types ~/.local/src/celery-types ln -sf ~/.local/src/celery-types/amqp-stubs ~/.local/src/python-type-stubs/amqp ln -sf ~/.local/src/celery-types/billiard-stubs ~/.local/src/python-type-stubs/billiard ln -sf ~/.local/src/celery-types/celery-stubs ~/.local/src/python-type-stubs/celery ln -sf ~/.local/src/celery-types/django_celery_results-stubs ~/.local/src/python-type-stubs/django_celery_results ln -sf ~/.local/src/celery-types/ephem-stubs ~/.local/src/python-type-stubs/ephem ln -sf ~/.local/src/celery-types/kombu-stubs ~/.local/src/python-type-stubs/kombu ln -sf ~/.local/src/celery-types/vine-stubs ~/.local/src/python-type-stubs/vine
tags: Memory Management, Heap Fragmentation
tags: Memory Model
tags: Memory Management
tags: Heap Fragmentation, jemalloc source:Svix Blog. “Spotting and Avoiding Heap Fragmentation in Rust Applications,” April 4, 2023. https://www.svix.com/blog/heap-fragmentation-in-rust-applications/. Heap fragmentation cause stair-step memeory usage, use jemalloc to solve heap fragmentation.
tags: Blockchain
tags: Tron, Sign Message Three methods tronweb.trx.signMessageV11 tronweb.trx.signMessageV22 tronweb.trx._signtypeddata3, 4 https://github.com/tronprotocol/tronweb/blob/859253856c79d3aff26ec6c89afefc73840d648d/src/lib/trx.js#L727-L739 ↩︎ https://github.com/tronprotocol/tronweb/blob/859253856c79d3aff26ec6c89afefc73840d648d/src/utils/message.js#L8-L18 ↩︎ https://github.com/tronprotocol/tronweb/blob/859253856c79d3aff26ec6c89afefc73840d648d/src/utils/crypto.js#L89 ↩︎ TIP 104 ↩︎
tags: Ethereum, Sign Message source: “Signing Data | MetaMask Docs.” Accessed April 6, 2023. https://docs.metamask.io/guide/signing-data.html#signtypeddata-v4. Five Methods1 eth_sign allow to sign arbitrary hash.2 personal_sign add prefix to data and human readable text that encoded UFT-8.3 signTypedData or signTypedData_v1 first release that lacked some later security improvements. signTypedData_v3 signTypedData_v4 compatible with V3. Differences Between V3 and V44 Some input types that V3 doesn’t support but V4 does: Custom type array Custom type with null input Some input types that V4 doesn’t support but V3 does: ...
tags: Go, GDB Enable Core Dumps ulimit -S -c unlimited Confirm or Change The Location of Core Dumps sysctl -w kernel.core_pattern=/tmp/core.%e.%p # Or echo '/tmp/core.%e.%p' | tee /proc/sys/kernel/core_pattern Set GOTRACEBACK Environment Variable to Let Go Program Core Dumps when Panic export GOTRACEBACK=crash Run Go Program and Wait Segmentation Fault Use GDB to Debug gdb /path/to/goprogram /tmp/core-xx-xx Then use thread apply all bt to see all backtraces, include compiled C code. Note: -g option should be applied to the compiled C code to generate debug symbols.
tags: Ethereum Layer 2 Background You may meet the below error when you’re trying to transfer all your ETH from one address to another address: invalid transaction: insufficient funds for l1fee + gas * price + value The reason is that the Layer 1 fee are included in Scroll’s gas fee system, but the wallet only exclude the Layer 2 gas fee to do so when you transfer all your ETH. 1 ...
tags: Yubikey source: “How to Yubikey: A Configuration Cheatsheet,” March 1, 2023. https://debugging.works/blog/yubikey-cheatsheet/.
tags: Python, High Performance source: Textual Documentation. “Textual - Overhead of Python Asyncio Tasks,” March 8, 2023. https://textual.textualize.io/blog/2023/03/08/overhead-of-python-asyncio-tasks/. Tasks of asyncio from create to run, then shutdown is about: 260K tasks per second.
tags: Yubikey source: BHIS. “How to Weaponize the Yubikey.” Black Hills Information Security (blog), May 2, 2019. https://www.blackhillsinfosec.com/how-to-weaponize-the-yubikey/.
tags: Online Tools,Microstartup source: https://twitter.com/vikingmute/status/1597417185470992384 HTTPS: Let’s Encrypt(acme.sh) 企业邮箱: ym.163.coom(3G 容量) zoho.com.cn/mail/ landing page 搭建 https://tailblocks.cc/ https://landing.ant.design/ 图标素材 fontawesome.com iconfinder.com 音乐素材 https://uppbeat.io 插画 https://undraw.co/illustrations https://www.manypixels.co/gallery storyset.com CDN cloudflare.com jsdelivr.com 静态托管 pages.cloudflare.com(无限请求和无线带宽) vercel.com(1G 带宽限制) 免费域名 freenom.com 免费 PS photopea.com 非关系数据库 AWS DynamoDB 25GB 存储 + 1G 传输,https://aws.amazon.com/cn/dynamodb/ Azure CosmosDB 25GB 存储,兼容 MongoDB 以及 PostgresQL 关系型数据库 https://planetscale.com 5GB 存储,每月 10亿行读,1000万行写。 监控工具 https://uptimerobot.com/ 对象存储 网易云 nos https://163yun.com/nos/free 50GB 存储,20GB下行流量/月 又拍云联盟 https://upyun.com/league 10GB 存储,25GB流量/月 https://cloudinary.com/(国外),易用、强大、25GB存储,每月 25,000 次图片转换,25GB 流量。 客户信息 ...
tags: Ethereum Before EIP 1559 The miner receive both fees and block reward. After EIP 1559 The fee divide to 2 parts: Base Fee Priority Fee The miner receive priority fee and block reward, the base fee will be burned.
source: https://github.com/papers-we-love/papers-we-love tags: Papers
source: The Refreshingly Rewarding Realm of Research Papers, 2015. https://www.youtube.com/watch?v=8eRx5Wo3xYA. tags: Papers Finding Something to Read Sources: Colleagues Papers We Love the morning paper With some topics/categories, to search on ACM Classification System(Require membership) Librarian Reading & Comprehending 3 Passes: Go though: title/sections/concclusions/references. (10min) Read more closely (1-2 hours) Mark unread References Step though closely Summarize in 1-2 sentences; outline major contributes; note strengths/weaknesses (couple hours) Implementing Use familar tools, except the paper used specific tool. Be aware to pseudo code. Prepare to work and results Test early. Test often. Interacting with the authors.
tags: Database, PostgresQL source: Crunchy Data. “Five Tips For a Healthier Postgres Database in the New Year.” Accessed February 13, 2023. https://crunchydata.com/blog/five-tips-for-a-healthier-postgres-database-in-the-new-year.
tags: Ethereum,Blockchain,Tron source: https://ethereum.stackexchange.com/a/110498 const data = '0x7ff36ab50000000000000000000000000000000000000000000000bc18ba4144048bbab00000000000000000000000000000000000000000000000000000000000000080000000000000000000000000c0c5eb43e2df059e3be6e4fb0284c283caa5991900000000000000000000000000000000000000000000000000000000614d87a80000000000000000000000000000000000000000000000000000000000000002000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c00000000000000000000000008ba0619b1e7a582e0bce5bbe9843322c954c340'; ethers.utils.defaultAbiCoder.decode( ['uint256', 'address[]', 'address', 'uint256'], ethers.utils.hexDataSlice(data, 4) ) // gives: [e, ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", "0x08ba0619b1e7A582E0BCe5BBE9843322C954C340"], "0xC0C5eb43E2dF059e3Be6E4fb0284C283CAa59919", e] (4) Online tools: Playground.
tags: Blockchain
tags: Emacs source: http://bjornwestergard.com/log/2022-04-19-hypertext-emacs.gmi C-x C-f M-n to find-file-at-point.
tags: Solana, Solana 101: 2. Anchor What is Program Derived Address(PDA)?1 A Program Derived Address is simply an account owned by the program, but has no private key. Instead it’s signature is obtained by a set of seeds and a bump (a nonce which makes sure it’s off curve). “Generating” a Program Address is different from “creating” it. Generating One can generate a PDA using Pubkey::find_program_address in Rust or PublicKey.findProgramAddressSync in JavaScript; Creating a PDA essentially means to initialize the address with space and set the state to it. #+end_quote ...
tags: Nginx One Endpoint for Both WebSocket and Normal Requests,Solana,Solana 101: Create an Escrow dApp I met a lot network issues about connecting to RPC node of Solana, so I’m using a nginx server as a reverse proxy to bypass this problem: location / { # https://serverfault.com/a/923254 try_files /nonexistent @$http_upgrade; } location @ { proxy_pass https://api.testnet.solana.com; proxy_read_timeout 300s; proxy_send_timeout 300s; proxy_set_header Host "api.testnet.solana.com"; } location @websocket { proxy_redirect off; proxy_pass https://api.testnet.solana.com; proxy_http_version 1.1; proxy_read_timeout 300s; proxy_send_timeout 300s; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; }