BCSkill (Block chain skill )
区块链中文技术社区

只讨论区块链底层技术
遵守一切相关法律政策!

Solana SPL 程序编译

代码Clone

git clone https://github.com/solana-program/token.git
cd token
git checkout program@v3.5.0

基础环境

# 安装nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
source ~/.bashrc

# 安装node
nvm install 20
node -v

# 安装pnpm
npm install -g pnpm

安装依赖

pnpm install

编译

cd program/
cargo build-sbf

默认编译可能出现以下错误

[2025-04-25T09:39:35.004769959Z ERROR cargo_build_sbf] Failed to obtain package metadata: `cargo metadata` exited with an error: error: current package believes it's in a workspace when it's not:
    current:   /mnt/d/github/token/program/Cargo.toml
    workspace: /mnt/d/github/token/Cargo.toml

    this may be fixable by adding `program` to the `workspace.members` array of the manifest located at: /mnt/d/github/token/Cargo.toml
    Alternatively, to keep it out of the workspace, add the package to the `workspace.exclude` array, or add an empty `[workspace]` table to the package's manifest.

解决

在 program 目录的 Cargo.toml 文件中添加空的 [workspace] 表

修改 program\Cargo.toml,在第一行增加

[workspace] // 增加此行
[package]
name = "spl-token"
version = "3.5.0"
...

执行成功后,程序编译出现在program\target\deploy\spl_token.so

Solana Secp256k1 ECDSA

no_std与 Secp256k1 曲线兼容的 ECDSA 实现,专为在 Solana 生态系统中使用而设计。

概述

该库使用 Secp256k1 曲线提供了 ECDSA 签名的轻量级实现。它旨在与各种环境兼容no_std,因此适用于嵌入式系统、WebAssembly 模块以及其他缺乏标准库支持的受限环境。

特征

  • no_std 兼容:在没有 Rust 标准库的环境中工作
  • 签名创建:使用各种方法生成 ECDSA 签名:
    • RFC6979 确定性随机数生成
    • 自定义临时密钥 (k) 支持
    • 预散列消息支持
  • 签名验证:根据公钥验证 ECDSA 签名
  • 签名规范化:使用可选的 s 值规范化(低 S)处理签名的可延展性
  • 最小依赖solana_secp256k1:建立在原语之上

https://github.com/deanmlittle/solana-secp256k1-ecdsa

RISC-V 与EVM集成的性能和可行性分析

前置总结

技术目的:以太坊网络扩容面临的几个长期瓶颈,包括稳定的数据可用性采样、确保区块生产保持竞争力,以及零知识EVM证明。在智能合约中实施RISC-V架构将保持区块生产市场的竞争力,并提高执行层零知识功能的效率。转向RISC-V将使 Ethereum 与 Solana 和Sui等更新的区块链更具竞争力

技术可行性:从《RISC-V 与以太坊虚拟机集成的性能和可行性分析》分析和测试结果应该可行

难度和风险:需要执行层的重新设计,社区大概评估整体需要数年的时间,需要大量资源,并可能出现新的漏洞,并且开发人员和项目将如何通过旧的智能控制trac移植到新系统存在问题。当涉及向后兼容性时,这可能会引起很多麻烦。基本等同于个完整的新链

现状:目前消息来看,Vitalik只是计划考虑信标链运行RISC-V,相当于技术调研初期,对于以太坊目前现状,可以主要为了造势,稳币价。对于以太坊是否真正开始投入开发支持,可能等先观望下了

RISC-V 与以太坊虚拟机集成的性能和可行性分析

https://hackmd.io/@0xdeveloperuche/Hk18BWxkxl

RISC-V与EVM相关项目:

evm

https://github.com/developeruche/riscv-evm-experiment/tree/main/crates/research-draft

img

zkevm

https://verified-zkevm.org/

https://argument.xyz/blog/riscv-good-bad/

Solana 节点服务器优化

系统初始化配置

https://docs.solanalabs.com/operations/guides/validator-start#system-tuning

sudo bash -c "cat >/etc/sysctl.d/21-agave-validator.conf <<EOF
# Increase UDP buffer sizes
net.core.rmem_default = 134217728
net.core.rmem_max = 134217728
net.core.wmem_default = 134217728
net.core.wmem_max = 134217728

# Increase memory mapped files limit
vm.max_map_count = 1000000

# Increase number of allowed open file descriptors
fs.nr_open = 1000000
EOF"
sudo sysctl -p /etc/sysctl.d/21-agave-validator.conf
sudo bash -c "cat >/etc/security/limits.d/90-solana-nofiles.conf <<EOF
# Increase process file descriptor count limit
* - nofile 1000000
EOF"
搜索