以太坊的remix下运行环境的三种选项

参考自 Remix has 3 different environment options that can be used to deploy/test Solidity contracts: JavaScript VM, Injected Web3, and Web3 Provider. This option can be changed under the Environment dro...
摘要由CSDN通过智能技术生成

参考自
Remix has 3 different environment options that can be used to deploy/test Solidity contracts: JavaScript VM, Injected Web3, and Web3 Provider. This option can be changed under the Environment drop down under the Run tab.
这里写图片描述

JavaScript VM:

This is Remix’s own internal sandbox. It does not connect to MainNet, TestNet, or any private network. It’s an in-memory blockchain that can be used for simple testing and quick mining.

Injected Web3:

This is the option to use for the browser plugin (MetaMask). Here, you are telling Remix to defer all control of the blockchain integration to the MetaMask plugin. At this point, MetaMask con

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以太坊智能合约是基于以太坊区块链技术的智能合约,可以实现自动化的合同执行和全球范围内的去中心化应用程序开发。在以太坊上编写智能合约需要使用Solidity语言。 以下是以太坊智能合约编程的菜鸟教程: 1. 安装Solidity编译器 Solidity是以太坊上最常用的智能合约编程语言,需要安装Solidity编译器才能编写和部署Solidity智能合约。可以从官方网站或GitHub上下载Solidity编译器。 2. 编写智能合约 使用Solidity编写智能合约需要掌握Solidity语言的语法和关键字。可以在Remix集成开发环境中编写Solidity智能合约,也可以在本地使用Solidity编译器进行编写。 以下是一个简单的Solidity智能合约示例: ``` pragma solidity ^0.8.0; contract MyContract { uint256 public myNumber; function setNumber(uint256 _number) public { myNumber = _number; } } ``` 这个智能合约定义了一个名为MyContract的合约,包含一个名为myNumber的公共变量和一个名为setNumber的公共函数。setNumber函数将传入的参数设置为myNumber的值。 3. 编译和部署智能合约 编写完智能合约后,需要使用Solidity编译器将其编译成字节码。可以使用Remix集成开发环境或本地Solidity编译器进行编译。 部署智能合约需要连接以太坊网络,并使用以太坊钱包或其他工具进行部署。部署智能合约时需要支付以太币作为燃料费。 4. 调用智能合约方法 部署智能合约后,可以使用以太坊钱包或其他工具调用智能合约中的方法。使用Solidity编写的智能合约方法可以通过Web3.js或其他以太坊API进行调用。 以上是以太坊智能合约编程的基本流程,希望能对初学者有所帮助。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值