写点什么

BSC 智能链游戏链系统开发解析

作者:Congge420
  • 2023-05-22
    广东
  • 本文字数:1969 字

    阅读完需:约 6 分钟

一、什么是元宇宙?

  元宇宙指的是通过虚拟增强的物理现实,呈现收敛性和物理持久性特征的,基于未来互联网,本文由小编:Congge420 整理发布,具有链接感知和共享特征的 3D 虚拟空间。

  大概可以从时空性、真实性、独立性、连接性四个方面交叉描述元宇宙:

  (1)从时空性来看,元宇宙是一个空间维度上虚拟而时间维度上真实的数字世界;

  (2)从真实性来看,元宇宙中既有现实世界的数字化复制物,也有虚拟世界的创造物;

  (3)从独立性来看,元宇宙是一个与外部真实世界既紧密相连,又高度独立的平行空间;

  (4)从连接性来看,元宇宙是一个把网络、硬件终端和用户囊括进来的一个永续的、广覆盖的虚拟现实系统;

In the view of traditional Internet people,Web3.0 is a more humanized Internet,which integrates newer technologies,big data,artificial intelligence,etc.computers help you think of many things.In the view of blockchain practitioners,Web3.0 refers to the Internet that users can own,of course,sometimes partially owned.Web 3.0 has roughly four feature Tags:unified identity authentication system,data confirmation and authorization,privacy protection and anti censorship,and decentralized operation.The core feature of Web3.0 is that the user's data is up to the user.Therefore,Web 3.0 is actually a new network form evolved based on blockchain thinking.Mature cases are like Ethereum and some decentralized applications established on Ethereum.Of course,the proportion of Web3.0 in the whole Internet world is still very small,but this mode will be accepted by more and more people,because it will no longer be subject to monopoly oligarchs.This network form is presented in a decentralized way.

<p><strong>命令行</strong></p> <p><strong>指定用于自定义生成步骤的命令行。</strong></p> <p><strong> </strong></p> <p><strong>说明</strong></p> <p><strong>指定自定义生成步骤的说明。</strong></p> <p><strong> </strong></p> <p><strong>输出</strong></p> <p><strong>指定自定义生成步骤生成的输出文件。</strong></p> <p><strong> </strong></p> <p><strong>附加依赖项</strong></p> <p><strong>指定自定义生成步骤的任何附加输出文件。</strong></p> <p><strong> </strong></p> <p><strong>将输出视为内容</strong></p> <p><strong>指定输出文件是否可部署内容。</strong></p> <p><strong> </strong></p> <p><strong>在以下操作之后执行</strong></p> <p><strong>指定自定义生成步骤要在其后面运行的目标。</strong></p> <p><strong> </strong></p> <p><strong>在以下操作之前执行</strong></p> <p><strong>指定自定义下例中仅支持 BSCimport Web3 from 'web3'

const BSC_CHAIN_ID = 56

export const changeToBscNetwork = async (library: any,onError?: () => void) => {try {

await library.provider.request({

  method: 'wallet_switchEthereumChain',

  params: [{ chainId: Web3.utils.toHex(BSC_CHAIN_ID) }]

})

} catch (error: any) {

if (error.code === 4902) {

  try {

    library.provider.request({

      jsonrpc: '2.0',

      method: 'wallet_addEthereumChain',

      params: [

        {

          chainId: '0x38',

          chainName: 'Binance Smart Chain Mainnet',

          rpcUrls: ['https://bsc-dataseed.binance.org/'],

          nativeCurrency: {

            name: 'BNB',

            symbol: 'BNB',

            decimals: 18

          },

          blockExplorerUrls: ['https://bscscan.com']

        }

      ],

      id: 0

    })

  } catch (e) {

    console.error('changeNetwork addEthereumChain error', e)

  }

}onError?.()console.error('changeNetwork error', error)

}}

常见 APIwallet_addEthereumChain 添加网络,切换网络时,错误返回 code 为 4902 时表示该网络未添加,下面以添加 bsc 到钱包网络中为例:library.provider.request({jsonrpc: '2.0',method: 'wallet_addEthereumChain',params: [

{

  chainId: '0x38',

  chainName: 'Binance Smart Chain Mainnet',

  rpcUrls: ['https://bsc-dataseed.binance.org/'],

  nativeCurrency: {

    name: 'BNB',

    symbol: 'BNB',

    decimals: 18

  },

  blockExplorerUrls: ['https://bscscan.com']

}

成步骤在其前面运行的目标

用户头像

Congge420

关注

还未添加个人签名 2023-05-12 加入

还未添加个人简介

评论

发布
暂无评论
BSC智能链游戏链系统开发解析_区块链追溯系统开发_Congge420_InfoQ写作社区