浅谈NFT链游模式项目DAPP系统开发技术理念成熟方案

简介: 浅谈阐述NFT链游系统开发GameFi搭建教程

  不管是现在还是可遇见的未来,完全在一个单体区块链上运行游戏在经济上是不可行的。这就是为什么过去几年发布的大多数区块链游戏都是混合型的,这些游戏只有少数组件在链上部署运行的,而其核心游戏逻辑则在链下专有服务器上运行。我们将这类区块链游戏称为弱上链游戏(weakly on-chain games)。

NFT游戏并不等同于躺在钱包中的加密货币收藏品。NFT游戏的规则、机制和玩家交互都会用到NFT。例如,The game can display the player's unique character or avatar as NFT. Digital items found during the game may also be NFT. You can exchange or trade NFT with other players to profit from it. The relatively new "earn while playing" mode also allows users to make profits through NFT games. We will discuss this topic in detail later.

parameter_types! {

pub const AlarmInterval: BlockNumber = 1;
pub const SubmissionDeposit: Balance = 100 * DOLLARS;
pub const UndecidingTimeout: BlockNumber = 28 * DAYS;

}

pub struct TracksInfo;
impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {

type Id = u16;
type Origin = <Origin as frame_support::traits::OriginTrait>::PalletsOrigin;
fn tracks() -> &'static [(Self::Id, pallet_referenda::TrackInfo<Balance, BlockNumber>)] {
    static DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 1] = [(
        0u16,
        pallet_referenda::TrackInfo {
            name: "root",
            max_deciding: 1,
            decision_deposit: 10,
            prepare_period: 4,
            decision_period: 4,
            confirm_period: 2,
            min_enactment_period: 4,
            min_approval: pallet_referenda::Curve::LinearDecreasing {
                length: Perbill::from_percent(100),
                floor: Perbill::from_percent(50),
                ceil: Perbill::from_percent(100),
            },
            min_support: pallet_referenda::Curve::LinearDecreasing {
                length: Perbill::from_percent(100),
                floor: Perbill::from_percent(0),
                ceil: Perbill::from_percent(100),
            },
        },
    )];
    &DATA[..]
}
fn track_for(id: &Self::Origin) -> Result<Self::Id, ()> {
    if let Ok(system_origin) = frame_system::RawOrigin::try_from(id.clone()) {
        match system_origin {
            frame_system::RawOrigin::Root => Ok(0),
            _ => Err(()),
        }
    } else {
        Err(())
    }
}

}

impl pallet_referenda::Config for Runtime {

type WeightInfo = pallet_referenda::weights::SubstrateWeight<Self>;
type Call = Call;
type Event = Event;
type Scheduler = Scheduler;
type Currency = pallet_balances::Pallet<Self>;
type SubmitOrigin = EnsureSigned<AccountId>;
type CancelOrigin = EnsureRoot<AccountId>;
type KillOrigin = EnsureRoot<AccountId>;
type Slash = ();
type Votes = pallet_conviction_voting::VotesOf<Runtime>;
type Tally = pallet_conviction_voting::TallyOf<Runtime>;
type SubmissionDeposit = SubmissionDeposit;
type MaxQueued = ConstU32<100>;
type UndecidingTimeout = UndecidingTimeout;
type AlarmInterval = AlarmInterval;
type Tracks = TracksInfo;

}

impl pallet_referenda::Config<pallet_referenda::Instance2> for Runtime {

type WeightInfo = pallet_referenda::weights::SubstrateWeight<Self>;
type Call = Call;
type Event = Event;
type Scheduler = Scheduler;
type Currency = pallet_balances::Pallet<Self>;
type SubmitOrigin = EnsureSigned<AccountId>;
type CancelOrigin = EnsureRoot<AccountId>;
type KillOrigin = EnsureRoot<AccountId>;
type Slash = ();
type Votes = pallet_ranked_collective::Votes;
type Tally = pallet_ranked_collective::TallyOf<Runtime>;
type SubmissionDeposit = SubmissionDeposit;
type MaxQueued = ConstU32<100>;
type UndecidingTimeout = UndecidingTimeout;
type AlarmInterval = AlarmInterval;
type Tracks = TracksInfo;

}

impl pallet_ranked_collective::Config for Runtime {

type WeightInfo = pallet_ranked_collective::weights::SubstrateWeight<Self>;
type Event = Event;
type PromoteOrigin = EnsureRootWithSuccess<AccountId, ConstU16<65535>>;
type DemoteOrigin = EnsureRootWithSuccess<AccountId, ConstU16<65535>>;
type Polls = RankedPolls;
type MinRankOfClass = traits::Identity;
type VoteWeight = pallet_ranked_collective::Geometric;

}

impl pallet_remark::Config for Runtime {

type WeightInfo = pallet_remark::weights::SubstrateWeight<Self>;
type Event = Event;

}

parameter_types! {

pub const LaunchPeriod: BlockNumber = 28 * 24 * 60 * MINUTES;
pub const VotingPeriod: BlockNumber = 28 * 24 * 60 * MINUTES;
pub const FastTrackVotingPeriod: BlockNumber = 3 * 24 * 60 * MINUTES;
pub const MinimumDeposit: Balance = 100 * DOLLARS;
pub const EnactmentPeriod: BlockNumber = 30 * 24 * 60 * MINUTES;
pub const CooloffPeriod: BlockNumber = 28 * 24 * 60 * MINUTES;
pub const MaxProposals: u32 = 100;

}

impl pallet_democracy::Config for Runtime {

type Proposal = Call;
type Event = Event;
type Currency = Balances;
type EnactmentPeriod = EnactmentPeriod;
type LaunchPeriod = LaunchPeriod;
type VotingPeriod = VotingPeriod;
type VoteLockingPeriod = EnactmentPeriod; // Same as EnactmentPeriod
type MinimumDeposit = MinimumDeposit;
/// A straight majority of the council can decide what their next motion is.
type ExternalOrigin =
    pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 1, 2>;
/// A super-majority can have the next scheduled referendum be a straight majority-carries vote.
type ExternalMajorityOrigin =
    pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 3, 4>;
/// A unanimous council can have the next scheduled referendum be a straight default-carries
/// (NTB) vote.
type ExternalDefaultOrigin =
    pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 1, 1>;
/// Two thirds of the technical committee can have an ExternalMajority/ExternalDefault vote
/// be tabled immediately and with a shorter voting/enactment period.
type FastTrackOrigin =
    pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 2, 3>;
type InstantOrigin =
    pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 1, 1>;
type InstantAllowed = frame_support::traits::ConstBool<true>;
type FastTrackVotingPeriod = FastTrackVotingPeriod;
// To cancel a proposal which has been passed, 2/3 of the council must agree to it.
type CancellationOrigin =
    pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 2, 3>;
// To cancel a proposal before it has been passed, the technical committee must be unanimous or
// Root must agree.
type CancelProposalOrigin = EitherOfDiverse<
    EnsureRoot<AccountId>,
    pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 1, 1>,
>;
type BlacklistOrigin = EnsureRoot<AccountId>;
// Any single technical committee member may veto a coming council proposal, however they can
// only do it once and it lasts only for the cool-off period.
type VetoOrigin = pallet_collective::EnsureMember<AccountId, TechnicalCollective>;
type CooloffPeriod = CooloffPeriod;
type PreimageByteDeposit = PreimageByteDeposit;
type OperationalPreimageOrigin = pallet_collective::EnsureMember<AccountId, CouncilCollective>;
type Slash = Treasury;
type Scheduler = Scheduler;
type PalletsOrigin = OriginCaller;
type MaxVotes = ConstU32<100>;
type WeightInfo = pallet_democracy::weights::SubstrateWeight<Runtime>;
type MaxProposals = MaxProposals;

}

相关文章
|
9月前
|
消息中间件 JavaScript 前端开发
详解事件循环与浏览器渲染机制
摘要:浏览器采用多进程架构,渲染主线程通过事件循环机制处理HTML解析、样式计算、布局等任务。异步机制避免主线程阻塞,任务按优先级在微队列、交互队列等不同队列中调度。JS执行会阻碍渲染,因其与渲染任务共享主线程。渲染流程包含解析、样式计算、布局、分层等阶段,最终由合成线程和GPU完成绘制。transform效率高因其仅影响合成阶段,不涉及主线程。reflow是布局重计算,repaint是绘制指令更新,两者均影响性能。
|
5月前
|
人工智能 监控 数据库
贷前尽调AI助手:7步流水线实战
对公客户尽职调查智能化:从7天到7分钟的企业风险扫描 开源Skill:due-diligence | 企业风险画像 | 舆情监控 | 担��链分析 痛点:对公开户的"马拉松" 银行对公客户经理最怕什么?新开户尽调。 传统流程: 1. 收集企业资料(营业执照、财报、征信)→ 1天 2. 工商信息查询 → 1天 3. 舆情风险搜索 → 2天 4. 关联企业排查 → 2天 5. 撰写尽调报告
|
5月前
|
SQL 人工智能 自然语言处理
Prompt 驱动分析 vs Skill 驱动分析:企业 AI 分析如何从会问走向可复用
让业务人员可以用 Prompt 提出开放问题,让 Agent 在执行中识别高频任务,再由分析师、业务专家和数据团队共同将成熟路径沉淀为 Skill。
|
6月前
|
人工智能 JSON 测试技术
Skill 不是脚手架:读懂 SKILL.md 和仓库结构的正确姿势
本文剖析Skill本质:它不是“超级提示词模板”,而是Agent时代的可复用、可组合、可演进的能力单元。SKILL.md实为接口定义文件,需遵循元数据驱动、渐进式披露、目录分层设计。错误做法是堆砌600行“全能脚本”,正确路径是拆解为专注单一职责的轻量Skill——小粒度、高复用、易维护。
|
6月前
|
机器学习/深度学习 人工智能 安全
吴恩达新的免费 AI 课来了,YYDS!我已经学上了
大家好,我是程序员鱼皮。 如果你自学过 AI,那你大概率听过吴恩达老师(Andrew Ng)的名字。他是斯坦福大学的教授,Coursera 联合创始人,全球最知名的 AI 教育者之一。从最早的《Machine Learning》到后来的深度学习系列课程,全世界几百万人通过他的课入了 AI 的门。 最近,吴恩达老师又出新课了,课程名叫《AI Prompting for Everyone》,一共 21
884 0
|
8月前
|
运维 BI API
企业Agent落地真相:多模型不是可选是必然
企业Agent落地关键不在“能否实现”,而在“能否稳定、可控、可持续”。真实业务链路天然需多模型协同:高阶推理、长文档处理、轻量任务各有所需。单模型易致成本高、弹性差、治理难。建议按任务分层选模,并构建统一接入与治理层,方能兼顾性能、成本与可运维性。
480 8
|
9月前
|
网络安全 API 开发者
基于阿里云轻量服务器OpenClaw实现TG接入+GitHub PR/Issue全链路自动化
本方案基于阿里云轻量服务器(Ubuntu 22.04,2核4G)一键部署OpenClaw,实现Telegram全平台消息接入与GitHub PR/Issue全生命周期自动化:支持TG群聊@响应、关键词触发;自动同步、分类、回复Issue,摘要PR,推送状态至TG,并支持TG一键提Issue、实时查PR/Issues。全程Docker化、可复现、高可用。(239字)
1349 4
|
存储 人工智能 自然语言处理
AI 剧本生成与动画创作解决方案体验报告
AI 剧本生成与动画创作解决方案体验报告
879 40
FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
/******************************************************************************** * FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck. * 说明: * 系统更新的时候遇到这个错误,记录一下处理步骤,其原因是我自己把其umount了 * 导致的问题。
7315 0