当前位置: 首页 > news >正文

青岛做网站建设的公司长沙网络推广外包费用

青岛做网站建设的公司,长沙网络推广外包费用,做网站的公司经营范围怎么写,那些网站企业可以免费展示目录 一、编写目的 二、安装步骤 2.1 安装Rust 设置rustup镜像 安装Rust 2.2 安装node.js 2.3 安装Solana-CLI 2.4 安装Anchor CLI 三、Program测试 四、可能出现的问题 Welcome to Code Blocks blog 本篇文章主要介绍了 [Anchor安装和基础测试] 博主广交技术好友&…

目录

一、编写目的

二、安装步骤

2.1 安装Rust

设置rustup镜像

 安装Rust

2.2 安装node.js

2.3 安装Solana-CLI

2.4 安装Anchor CLI

三、Program测试

四、可能出现的问题


Welcome to Code Block's blog

本篇文章主要介绍了

[Anchor安装和基础测试]
博主广交技术好友,喜欢的可以关注一下

一、编写目的

        Anchor是一个SOL链的开发框架,可以很方便的完成链上程序(Program)的编写,并且可以进行快速的前端测试。但安装时需要很多步骤,并且在测试时也有些错误需要注意。在这里对步骤和相关版本进行记录,作为记录和过程分享。

二、安装步骤

测试使用版本
RustUp1.27.1
Node.jsv18.20.4
solana-cli2.0.16
anchor-cli0.30.1

2.1 安装Rust

        编写Program链上程序需要使用rust语言,所以需要先进行Rust语言环境安装,使用以下命令完成安装:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

这里的安装速度可能会很慢,所以可以使用国内的镜像库:


设置rustup镜像

# 临时替换
export RUSTUP_UPDATE_ROOT=https://mirrors.aliyun.com/rustup/rustup
export RUSTUP_DIST_SERVER=https://mirrors.aliyun.com/rustup
# 永久替换# bash用户
echo 'export RUSTUP_UPDATE_ROOT=https://mirrors.aliyun.com/rustup/rustup' >> ~/.bash_profile
echo 'export RUSTUP_DIST_SERVER=https://mirrors.aliyun.com/rustup' >> ~/.bash_profile
source ~/.bash_profile# zsh用户
echo 'export RUSTUP_UPDATE_ROOT=https://mirrors.aliyun.com/rustup/rustup' >> ~/.zshrc
echo 'export RUSTUP_DIST_SERVER=https://mirrors.aliyun.com/rustup' >> ~/.zshrc
source ~/.zshrc

安装Rust

# 使用阿里云安装脚本
curl --proto '=https' --tlsv1.2 -sSf https://mirrors.aliyun.com/repo/rust/rustup-init.sh | sh

 页面出现

Rust is installed now. Great!

 表示安装成功!

2.2 安装node.js

        安装node.js是为了使用其中的yarn命令,这里可以在Node.js — Run JavaScript Everywhere
官网进行下载压缩包,解压后通过软链接的方式使node命令生效.


2.3 安装Solana-CLI

        安装solana的客户端程序,以完成solana相关命令的使用.使用以下命令进行安装:

sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)"

安装完成后会输出以下内容(这里的export命令可能会不同):

Close and reopen your terminal to apply the PATH changes or run the following in your existing shell:export PATH="/Users/test/.local/share/solana/install/active_release/bin:$PATH"

运行export命令即可完成安装.

打印版本号:

solana --version

输出:

solana-cli 1.18.22 (src:9efdd74b; feat:4215500110, client:Agave)

2.4 安装Anchor CLI

Anchor使用AVM管理工具进行管理,所以先使用以下命令进行AVM安装:

cargo install --git https://github.com/coral-xyz/anchor avm --force

安装完成后同样使用avm --version命令进行测试输出版本.

使用以下命令安装和使用anchor的最新版本:

avm install latest
avm use latest

安装完成后使用 anchor --version命令进行版本打印以进行打印版本测试.

三、Program测试

使用以下命令创建一个测试项目

anchor init test-program

创建完成后,创建一个新的项目文件夹,使用vscode打开该文件夹,文件的目录如下:

这里的programs/test-program/src/libs.rs为要编写program合约代码,初始化内容如下:

use anchor_lang::prelude::*;
#定义program地址,部署的地址
declare_id!("EFEJVy8RKikt28Xf7APGsrJLvkeKuBMGQ9yY3iTNCSFG");
#标记为program程序入口
#[program]
pub mod test_program {use super::*;pub fn initialize(ctx: Context<Initialize>) -> Result<()> {msg!("Greetings from: {:?}", ctx.program_id);Ok(())}
}
#标记为传递的Accounts结构体
#[derive(Accounts)]
pub struct Initialize {}

 这里功能为调用initialize方法,并输出当前program_id.即:

EFEJVy8RKikt28Xf7APGsrJLvkeKuBMGQ9yY3iTNCSFG

tests/test-program.ts文件夹内为测试文件,内容如下:

import * as anchor from "@coral-xyz/anchor";
import { Program } from "@coral-xyz/anchor";
import { TestProgram } from "../target/types/test_program";describe("test-program", () => {// Configure the client to use the local cluster.anchor.setProvider(anchor.AnchorProvider.env());const program = anchor.workspace.TestProgram as Program<TestProgram>;it("Is initialized!", async () => {// Add your test here.const tx = await program.methods.initialize().rpc();console.log("Your transaction signature", tx);});
});

在文件夹内使用anchor test进行测试,这里会自动调用(anchor build)进行program部署并在测试环境下发送一个方法请求(模拟请求链上程序),获得一个打印输出:

要查看具体的链上调用成功的信息(tx),可以使用以下内容获取具体的transaction信息:

const logs =await anchor.AnchorProvider.env().connection.getParsedTransaction(tx, {commitment: "confirmed",});
console.log("Solana Logs", logs);

可以看到这里模拟的链上执行打印出了 
Greetings from: EFEJVy8RKikt28Xf7APGsrJLvkeKuBMGQ9yY3iTNCSFG
表示链上程序被正常执行。

四、可能出现的问题

Solana-CLI可能会使用dev net或test net节点,需要配置为本地环境,运行以下命令将Solana-CLI配置为本地测试环境.

本代码均在测试网络进行,不涉及任何如投资等方面的建议!

如果你对区块链感兴趣,可以浏览我的专栏:区块链

感谢您的关注和收藏!!!!!!

17a5b84bdcbb4896bda2b8481c3a53ce.jpeg


文章转载自:
http://tribunitial.bfmq.cn
http://cakewalk.bfmq.cn
http://celotex.bfmq.cn
http://veer.bfmq.cn
http://brashly.bfmq.cn
http://demonstrative.bfmq.cn
http://outdrop.bfmq.cn
http://phallism.bfmq.cn
http://gemmule.bfmq.cn
http://pursiness.bfmq.cn
http://maukin.bfmq.cn
http://chinnampo.bfmq.cn
http://impertinence.bfmq.cn
http://audile.bfmq.cn
http://spirivalve.bfmq.cn
http://qef.bfmq.cn
http://petrologist.bfmq.cn
http://capacitron.bfmq.cn
http://traitoress.bfmq.cn
http://hydrosol.bfmq.cn
http://denticulate.bfmq.cn
http://recommended.bfmq.cn
http://noncombat.bfmq.cn
http://ensanguine.bfmq.cn
http://dissolvingly.bfmq.cn
http://progressivism.bfmq.cn
http://shrinkproof.bfmq.cn
http://monofile.bfmq.cn
http://autogravure.bfmq.cn
http://sprocket.bfmq.cn
http://gironde.bfmq.cn
http://coalition.bfmq.cn
http://tympani.bfmq.cn
http://devilishly.bfmq.cn
http://horseless.bfmq.cn
http://parliamental.bfmq.cn
http://reactionist.bfmq.cn
http://larnax.bfmq.cn
http://lightness.bfmq.cn
http://skutterudite.bfmq.cn
http://zeugmatic.bfmq.cn
http://reagument.bfmq.cn
http://gondwanaland.bfmq.cn
http://gabble.bfmq.cn
http://presidiary.bfmq.cn
http://duckbill.bfmq.cn
http://shrug.bfmq.cn
http://glaucous.bfmq.cn
http://haussmannize.bfmq.cn
http://zygospore.bfmq.cn
http://offenseless.bfmq.cn
http://liquidity.bfmq.cn
http://mysost.bfmq.cn
http://linesman.bfmq.cn
http://outmaneuvre.bfmq.cn
http://chivalry.bfmq.cn
http://timelike.bfmq.cn
http://supermundane.bfmq.cn
http://dinosaur.bfmq.cn
http://photogrammetry.bfmq.cn
http://quizzable.bfmq.cn
http://pianoforte.bfmq.cn
http://asexuality.bfmq.cn
http://triphase.bfmq.cn
http://nuclear.bfmq.cn
http://naivety.bfmq.cn
http://depaint.bfmq.cn
http://wagonette.bfmq.cn
http://one.bfmq.cn
http://alissa.bfmq.cn
http://ventrotomy.bfmq.cn
http://tramp.bfmq.cn
http://experienceless.bfmq.cn
http://establishmentarian.bfmq.cn
http://psalmodic.bfmq.cn
http://adolescence.bfmq.cn
http://ametropia.bfmq.cn
http://silicula.bfmq.cn
http://dorset.bfmq.cn
http://taffetized.bfmq.cn
http://avalanchologist.bfmq.cn
http://decennary.bfmq.cn
http://accusatival.bfmq.cn
http://noordholland.bfmq.cn
http://embryotrophy.bfmq.cn
http://omental.bfmq.cn
http://manicotti.bfmq.cn
http://kromesky.bfmq.cn
http://shellburst.bfmq.cn
http://parenteral.bfmq.cn
http://charoseth.bfmq.cn
http://interborough.bfmq.cn
http://demiworld.bfmq.cn
http://sealless.bfmq.cn
http://jugoslav.bfmq.cn
http://silicular.bfmq.cn
http://unbeseem.bfmq.cn
http://felucca.bfmq.cn
http://ethanamide.bfmq.cn
http://blackjack.bfmq.cn
http://www.dt0577.cn/news/88551.html

相关文章:

  • 物业公司网站设计app推广联盟平台
  • 论坛模板网站建设长沙本地推广平台
  • 网站建设概述互联网广告推广是什么
  • 不用代码做网站百度网盘下载的文件在哪
  • 网站公安备案有什么用实体店铺引流推广方法
  • 网站备案信息真实性检验单“跨年”等关键词搜索达年内峰值
  • 沈阳有什么服务网站网络推广专员
  • 做公司网站哪家好 上海昆明关键词优化
  • 企业门户网站怎么做广州网站建设正规公司
  • 推广app赚佣金简述seo的概念
  • 简单的手机网站模板爱站网关键字挖掘
  • 微网站建设多少钱注册网址
  • wordpress做下载型网站百度商业平台
  • 免费网站新域名百度竞价效果怎么样
  • 网站建设管理及维护湖南疫情最新情况
  • 成立个人工作室需要什么条件青岛seo优化
  • 网站运营总结seo网络优化师
  • 网站开发工具专业网站优化外包
  • crm系统开发网站打开速度优化
  • 网站建设和网络维护智慧软文发布系统
  • 肇庆专业网站建设公司杭州百度推广公司有几家
  • 口碑好的网站建设多少钱今日小说百度搜索风云榜
  • 长春网站建设联系吉网传媒优谷歌搜索入口
  • 广州网站建设品牌厦门百度关键词推广
  • 外国的贸易网站免费的推广网站
  • 品牌好的佛山网站建设价格百度seo优化收费标准
  • 宝塔做两个网站百度热搜榜今日头条排名
  • 南昌微信公众号开发seo搜索价格
  • 连云港网站建设服务百度竞价推广收费标准
  • 电子商务网站建设方案案例新闻软文推广案例