Decoration

参考 https://github.com/RobbieXie/2020DecorationNote Ideas 在马桶旁边要留一个插座,用于智能马桶垫; 厨房油烟机机一个光滑斜面可以在餐厅坐着看锅里的情况; 全屋六类线预留 AP 和插座,最好能扩大弱电箱能放进去个 NAS; 面向扫地机器人装修;

December 24, 2022 · 1 min · Gray King

Ethereum Layer 2

tags: Ethereum Knowning Layer 2 Chain Rollup(or bundle) transactions off-chain to reduce fee and scale capacity, such as Bitcoin Lightning. Two layer 2 rollups Optimistic Rollups Zero-Knowledge Rollups Record on-chain state by writing calldata to L1(Ethereum), which more cheaper than change state on L1 chain. Fees Some layer 2 chain like Optimism should plus l1 fee when executing transaction on layer 1.1 Many Ethereum applications display estimated fees to users by multiplying the gas price by the gas limit. However, as discussed earlier, users on Optimism are charged both an L2 execution fee and an L1 data fee. As a result, you should display the sum of both of these fees to give users the most accurate estimate of the total cost of a transaction. ...

December 23, 2022 · 1 min · Gray King

Go Reflect

tags: Go Elem() Returns Value type T struct { } t := &T{} v := reflect.New(reflect.TypeOf(t)).Elem() // type of v is `T` Interface() Returns Pointer type T struct { } t := &T{} v := reflect.New(reflect.TypeOf(t)).Interface() // type of v is `&T`

November 23, 2022 · 1 min · Gray King

Solana 101: 5. Escrow dApp

tags: Solana 101: Create an Escrow dApp

November 22, 2022 · 1 min · Gray King

Solana 101: 3. SPL Token

tags: Solana 101: Create an Escrow dApp 连接钱包 安装 Phantom 钱包; 使用 @solana/wallet-adapter 连接钱包。官方提供了 React 相关的实现,Vue 可以通过社区提供的库:https://github.com/lorisleiva/solana-wallets-vue。 npm install solana-wallets-vue @solana/wallet-adapter-wallets 创建 SPL Token 安装依赖 npm install --save @solana/spl-token 创建代币 通过 Token Program 创建 Token,Solana 通过其特有的账号机制,通过创建一个账号并将 Owner 设置为一个统一的 Token Program 即可发行一种代币。1 发行代币 要持有代币必须创建一个对应的 Associated Token Account(ATA),也就是要接收一个代币首先要检查有没有对应代币的 ATA,没有则创建,然后给对应的 ATA 转移代币。 代币转帐 燃烧代币 SPL Token 交互:授权 Program 转帐 Libraries: spl_associated_token_account Steps: Delegate token to Program – in frontend. Create a Associated Token Account for Program to hold token. Q: How to avoid duplicated initialization? A: data size of account. Program: Transfer token from wallet to Program USDT ↩︎ ...

November 22, 2022 · 1 min · Gray King