Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View luchenqun's full-sized avatar

Luke luchenqun

View GitHub Profile
import { DirectSecp256k1HdWallet, DirectSecp256k1Wallet } from '@cosmjs/proto-signing';
import { SigningStargateClient } from '@cosmjs/stargate';
import { fromHex } from '@cosmjs/encoding';
// 大概操作
// 1、请在至少在解质押结束前30秒启动脚本。没必要启动太早,启动太早如果节点做了请求限制则节点会不在接受访问请求
// 2、根据你的需求修改下面的 mnemonic 以及 recipient
// 3、安装好node.js程序之后,执行 node axl.js脚本
// 策略:每隔100ms检查到账户是否有可转移资金,一旦检测到立即发送转账交易。
import { ApiPromise, WsProvider } from '@polkadot/api';
async function subscribeTemplatePallet() {
// 连接到 Polkadot 节点
const provider = new WsProvider('ws://localhost:9944');
const api = await ApiPromise.create({ provider });
// 订阅 template pallet 中的值更新
api.query.templateModule.something((result) => {
console.log('Something updated:', result.toHuman());
@luchenqun
luchenqun / genesis.json
Last active December 30, 2023 10:16
evmos genesis.json
{
"app_hash": "",
"app_state": {
"auth": {
"accounts": [
{
"@type": "/ethermint.types.v1.EthAccount",
"base_account": {
"account_number": "1820993",
"address": "evmos1qqqqqqqqqqyyayt5xyj2nqs8d3vlzqyy46yd62",
@luchenqun
luchenqun / tx.json
Created September 21, 2023 14:24
A transaction contains multiple evm messages
{
"tx":{
"body":{
"messages":[
{
"@type":"/ethermint.evm.v1.MsgEthereumTx",
"data":{
"@type":"/ethermint.evm.v1.LegacyTx",
"nonce":"0",
"gas_price":"50000000000",
@luchenqun
luchenqun / old_genesis.json
Created July 14, 2023 08:12
genesis 文件比较
{
"genesis_time": "2023-07-14T08:09:45.35884Z",
"chain_id": "quarix_8888888-1",
"initial_height": "1",
"consensus_params": {
"block": {
"max_bytes": "22020096",
"max_gas": "210000000000",
"time_iota_ms": "1000"
},
@luchenqun
luchenqun / ERC1967Proxy.json
Last active April 13, 2024 03:38
etherum tool datas
{"_format":"hh-sol-artifact-1","contractName":"ERC1967Proxy","sourceName":"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol","abi":[{"inputs":[{"internalType":"address","name":"_logic","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"}],"stateMutability":"payable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"stateMutability":"payable","type":"fallback"},{"stateMutability":"payable","type":"receive"}],"bytecode":"0x60806040526040516107353803806107358339810160408190526100229161031e565b61002e82
import util from "util";
import path from "path";
import { exec } from "child_process";
import Web3 from "web3";
const execPromis = util.promisify(exec);
const sleep = (time) => {
return new Promise((resolve) => setTimeout(resolve, time));
};
@luchenqun
luchenqun / ProjectManager.sol
Created November 8, 2022 03:38
ProjectManager
contract ProjectManager {
// 算力资源
struct ComputeRes {
int256 id;
int256 tid; // 领取的任务id
address owner;
int256 status;
int256 ctype; // 算力类型:处理视频,处理音频,图像识别.....
int256[] pows;
}
@luchenqun
luchenqun / genesis.json
Last active October 26, 2022 09:07
genesis
{
"genesis_time": "2022-10-26T09:07:14.75812Z",
"chain_id": "evmos_20191205-1",
"initial_height": "1",
"consensus_params": {
"block": {
"max_bytes": "22020096",
"max_gas": "-1",
"time_iota_ms": "1000"
},
if (Array.isArray(genesisCfg)) {
const convert = (value) => {
if (value == "true" || value == "false") {
return value == "true";
} else if (value.startsWith("'")) {
return value.replace(/'/g, "");
} else return parseInt(value);
};
for (const cfg of genesisCfg) {
console.log("genesis." + cfg);