WengQiang's Blog

where there is a will, there is a way!

segwit相关

segwit bips

see bitcoin bip141 bitcoin bip143 bitcoin bip144 bitcoin bip147 (chain activated on August 24, 2017)

block cost calculation

cost = (stripped_size * 4) + witness_size formula,
using only serialization with and without witness data. As witness_size
is equal to total_size - stripped_size, this formula is identical to:
cost = (stripped_size * 3) + total_size.

conditional probablity

P(A|B) = P(A ∩ B) / P(B)

The conditional probability means "what is the probability of event A given that we know event B occurred"

docker中运行ethereum go节点

  1. 安装ethereum(go version)的docker

docker pull ethereum:client-go

  1. 运行docker

sudo docker run -d --name wens-geth -v /mnt/main/wq/ethereum:/root/.ethereum -p 8588:8545 -p 30308:30303 ethereum/client-go --rpc --rpcaddr 0.0.0.0 --syncmode "fast" --cache=10240 --txpool.pricelimit 1 console

  1. 进入运行着的docker go节点

sudo docker run -it -v /mnt/main/wq/ethereum:/root/.ethereum ethereum/client-go attach

阅读全文 »

contract creation transaction: the target account address is 0. the payload of such transaction is taken to be EVM bytecode and executed.The output of this execution is permanently stored as the code of the contract

each account has its own persistant memory area called storage.

the second memory area is called memory, of which a contract obtains a freshly cleared instance for each message call.

EVM is not a register machine but a stack machine.

Calls are limited to a depth of 1024.

library

use the feature delegatecall: the contract can call the code of target address

fallback function

  1. A contract can have exactly one unnamed function. This function cannot have arguments and cannot return anything. It is executed on a call to the contract if none of the other functions match the given function identifier (or if no data was supplied at all).

  2. Furthermore, this function is executed whenever the contract receives plain Ether (without data). Additionally, in order to receive Ether, the fallback function must be marked payable.

  3. If no such function exists, the contract cannot receive Ether through regular transactions.

  4. Please ensure you test your fallback function thoroughly to ensure the execution cost is less than 2300 gas before deploying a contract.

shadowsocks-libev 版本安装

centos 7(64) 系统

  • 前提准备

    安装一些必要的软件以及依赖

    1
    2
    3
    yum install git vim wget -y
    yum install epel-release -y
    yum install gcc gettext autoconf libtool automake make pcre-devel asciidoc xmlto udns-devel libev-devel mbedtls-devel -y
    阅读全文 »
0%