努力赚钱
将来的你一定会感谢现在努力的自己!

XEN怎么挖?消耗SOL挖XEN的操作方法和教程

Spacemesh-浏览器

安装RUST:

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

安装SOL:

1
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"

设置环境变量:(看上一步屏幕上出现什么就写什么)

1
export PATH="/root/.local/share/solana/install/active_release/bin:$PATH"

查询SOL:

1
solana --version

创建新钱包:

1
solana-keygen new

默认地址:

/root/.config/solana/id.json

设置SOL测试网:

1
solana config set --url https://api.testnet.solana.com

获取测试币:

1
solana airdrop 1

查询余额(测试币):

1
solana balance

这里可能获取不到,建议去水龙头网站https://faucet.solana.com/获取。

备用水龙头:https://www.testnetfaucet.org/

浏览器查询余额:

https://explorer.solana.com/address/8u3pJcoHCW1FkLZ2sNoPsowV5d6MTSVVGrfTdhWgqbKH?cluster=testnet

重命名钱包:

1
mv -f /root/.config/solana/id.json /root/.config/solana/id1.json

继续创建钱包,获取测试币,重命名为id2

1
2
3
4
solana-keygen new
solana airdrop 1
solana balance
mv -f /root/.config/solana/id.json /root/.config/solana/id2.json

配置其他环境:

1
2
3
4
source ~/.bashrc
cargo new my_project
cd my_project
nano Cargo.toml

添加内容:(ctrl X 保存Y)

1
2
solana-client = "1.10"
solana-sdk = "1.10"

编辑配置文件:

1
nano src/main.rs

修改后的配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
use solana_client::rpc_client::RpcClient;
use solana_sdk::{
    compute_budget::ComputeBudgetInstruction,
    instruction::{AccountMeta, Instruction},
    pubkey::Pubkey,
    signature::{Keypair, Signer},
    transaction::Transaction,
    system_instruction,
};
use solana_sdk::signer::keypair::read_keypair_file;
use std::{str::FromStr, sync::Arc, thread};
use std::path::PathBuf;

fn main() {
    let rpc_url = String::from("https://api.testnet.solana.com");
    //let rpc_url = String::from("http://127.0.0.1:8899");
    let client = RpcClient::new(&rpc_url);
    let client = Arc::new(client);

    // Load keypairs for two payer accounts
    let keypair_path1 = PathBuf::from("/root/.config/solana/id1.json");
    let keypair_path2 = PathBuf::from("/root/.config/solana/id2.json");
    let payer1 = read_keypair_file(&keypair_path1).expect("Failed to read keypair from file 1");
    let payer2 = read_keypair_file(&keypair_path2).expect("Failed to read keypair from file 2");

    let key_bytes1 = payer1.to_bytes();
    let key_bytes2 = payer2.to_bytes();

    // Use two different sets of threads for each payer
    let handles1: Vec<_> = (0..10).map(|_| {
        let client = Arc::clone(&client);
        let key_bytes = key_bytes1.clone();

        thread::spawn(move || {
            let payer = Keypair::from_bytes(&key_bytes).expect("Failed to deserialize keypair");
            send_transaction(&client, &payer);
        })
    }).collect();

    let handles2: Vec<_> = (0..10).map(|_| {
        let client = Arc::clone(&client);
        let key_bytes = key_bytes2.clone();

        thread::spawn(move || {
            let payer = Keypair::from_bytes(&key_bytes).expect("Failed to deserialize keypair");
            send_transaction(&client, &payer);
        })
    }).collect();

    // Wait for all threads to complete
    handles1.into_iter().chain(handles2).for_each(|handle| {
        handle.join().unwrap();
    });
}

fn send_transaction(client: &RpcClient, payer: &Keypair) {
//    let program_id = Pubkey::from_str("E3cXtz25rC1SeBVCkudZyWtzDfyDRcHvVUVuiReW2hiG").unwrap();
    let program_id = Pubkey::from_str("7R2KMCUW1GimTEiS8tp8jJrde2N66yQiJ1MEUTbaPgfq").unwrap();
    //let program_id = Pubkey::from_str("7R2KMCUW1GimTEiS8tp8jJrde2N66yQiJ1MEUTbaPgfq").unwrap();
    let result_account = Keypair::new();
    let space = 5;
    let rent_exemption = client.get_minimum_balance_for_rent_exemption(space).unwrap();

    let create_account_instruction = system_instruction::create_account(
        &payer.pubkey(),
        &result_account.pubkey(),
        rent_exemption,
        space as u64,
        &program_id,
    );

    let process_instruction_accounts = vec![
        AccountMeta::new(result_account.pubkey(), false),
    ];

    let process_instruction = Instruction::new_with_bincode(
        program_id,
        &[0],
        process_instruction_accounts,
    );

    let max_units = 1_200_000;
    let compute_budget_instruction = ComputeBudgetInstruction::set_compute_unit_limit(max_units);

    let mut transaction = Transaction::new_with_payer(
        &[compute_budget_instruction, create_account_instruction, process_instruction],
        Some(&payer.pubkey()),
    );

    let recent_blockhash = client.get_latest_blockhash().unwrap();
    transaction.sign(&[payer, &result_account], recent_blockhash);

    match client.send_and_confirm_transaction(&transaction) {
        Ok(_) => println!("Transaction sent successfully."),
        Err(e) => eprintln!("Failed to send transaction: {}", e),
    }
}

安装GCC:

1
sudo apt install gcc

构建:

1
cargo build

运行:

1
cargo run

据说可能会停止运行,所以还是老办法。

编写脚本:

1
vim offline_script.sh
  1. 按下 i 键进入插入模式,这样你就可以输入文本了。
  2. 输入你想要编辑的文本。
  3. 按下 Esc 键退出插入模式。
  4. 如果想要保存并退出 Vim,可以输入 :wq 并按下 Enter 键。:w 用于保存,:q 用于退出,两者结合成 :wq 则表示保存并退出。
  5. 如果只想退出而不保存,可以输入 :q! 并按下 Enter 键。

脚本内容:

1
2
3
4
5
6
while true
do
  echo "Running"
  cargo run
  echo "Exited"
done

授权脚本:

1
chmod +x offline_script.sh

后台运行:

1
nohup ./offline_script.sh  >log.txt&

查看日志:

1
cat log.txt

本指南将在solana测试网上安装rust、solana、创建和资助钱包,然后运行420miner查找420个哈希。

官方教程:SolXEN_420_miner_v1.1_instructions.pdf

赞(0) 打赏
未经允许不得转载:我爱收益 » XEN怎么挖?消耗SOL挖XEN的操作方法和教程

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏