Solidity contract智能合约概览

solidity智能合约 在这种情况下,攻击方的胜利次数和等级都会增加,被攻击方的失败次数会增加,并调用feedAndMultiply函数,以将攻击方的DNA和被攻击方的DNA混合在一起,创建一个新的僵尸。feedOnKitty 函数接收Zombie ID 和猫的 ID 作为参数,调用 KittyContract 的 getKitty 函数以获取猫的 DNA,然后调用 feedAndMultiply 函数以将给定 Zombie 的 DNA 和猫的 DNA 相加取平均数以生成新的 DNA,并创建一个新的 Zombie。 阅读详情

Contracts in Solidity are similar to classes in object-oriented languages. They contain persistent data in state variables, and functions that can modify these variables. Calling a function on a different contract (instance) will perform an EVM function call and thus switch the context such that state variables in the calling contract are inaccessible. A contract and its functions need to be called for anything to happen. There is no “cron” concept in Ethereum to call a function at a particular event automatically. 在solidity中Contract类似于在面向对象语言中的classes概念. 合约包含状态变量,用于存储数据, 和函数,用于修改这些变量。  不同的合约实例调用一个函数,会执行一个EVM的函数调用, 如此,切换上下文环境后,状态变量在调用合约的过程中不能互相访问.合约和合约的函数需要被调用,才能运行。在以太坊中,存在cron的概念, 定时任务自动调用的方式.

Visibility and Getters 

State Variable Visibility

public

internal

private

Function Visibility

external

External functions are part of the contract interface, which means they can be called from other contracts and via transactions. An external function f cannot be called internally (i.e. f() does not work, but this.f() works).

public 

Public functions are part of the contract interface and can be either called internally or via message calls.

internal

private

Function Modifiers

Modifiers can be used to change the behavior of functions in a declarative way. For example, you can use a modifier to automatically check a condition prior to executing the function.

Constant and Immutable State Variables

State variables can be declared as constant or immutable. In both cases, the variables cannot be modified after the contract has been constructed. For constant variables, the value has to be fixed at compile-time, while for immutable, it can still be assigned at construction time.

constant在编译的时候,已经固化了变量值不可改变。 immutable是合约创建之后才固化下来,在合约的构造函数里面仍然可以修改.

Functions

Functions can be declared view in which case they promise not to modify the state.

Functions can be declared pure in which case they promise not to read from or modify the state.

Fallback Function

A contract can have at most one fallback function, declared using either fallback () external [payable] or fallback (bytes calldata input) external [payable] returns (bytes memory output) (both without the function keyword). This function must have external visibility. A fallback function can be virtual, can override and can have modifiers.

一个只能合约最多有一个fallback函数,声明fallback () external [payable] 或者fallback (bytes calldata input) external [payable] returns (bytes memory output) , 二者都没有function关键字. 回调函数必须是external 可视属性. 一个回调函数可以是虚拟的, 可被重写, 可以有修饰符modifiers去修饰。

contract TestPayable {
    uint x;
    uint y;
    // This function is called for all messages sent to
    // this contract, except plain Ether transfers
    // (there is no other function except the receive function).
    // Any call with non-empty calldata to this contract will execute
    // the fallback function (even if Ether is sent along with the call).
    // 任意非空calldata的call调用,都会触发这个回调函数.
    // call内部有参数,则调用fallback, 没有参数, 则调用receive.
    fallback() external payable { x = 1; y = msg.value; }

    // This function is called for plain Ether transfers, i.e.
    // for every call with empty calldata.
    // 每一个空的calldata的调用,会调用这个receive方法.
    receive() external payable { x = 2; y = msg.value; }
}

 function callTestPayable(TestPayable test) public returns (bool) {
        (bool success,) = address(test).call(abi.encodeWithSignature("nonExistingFunction()"));
        require(success);
        // results in test.x becoming == 1 and test.y becoming 0.
        (success,) = address(test).call{value: 1}(abi.encodeWithSignature("nonExistingFunction()"));
        require(success);
        // results in test.x becoming == 1 and test.y becoming 1.

        // If someone sends Ether to that contract, the receive function in TestPayable will be called.
        // Since that function writes to storage, it takes more gas than is available with a
        // simple ``send`` or ``transfer``. Because of that, we have to use a low-level call.
        (success,) = address(test).call{value: 2 ether}("");
        require(success);
        // results in test.x becoming == 2 and test.y becoming 2 ether.

        return true;
    }

Inheritance

Solidity supports multiple inheritance including polymorphism. solidity 支持多继承和多模态.

Polymorphism means that a function call (internal and external) always executes the function of the same name (and parameter types) in the most derived contract in the inheritance hierarchy. This has to be explicitly enabled on each function in the hierarchy using the virtual and override keywords. See Function Overriding for more details.

多态性意味着函数调用(内部和外部)总是在继承层次结构中派生最多的契约中执行相同名称(和参数类型)的函数。必须使用virtual和override关键字在层次结构中的每个函数上显式启用此功能。有关更多详细信息,请参阅函数重写。

When a contract inherits from other contracts, only a single contract is created on the blockchain, and the code from all the base contracts is compiled into the created contract. This means that all internal calls to functions of base contracts also just use internal function calls (super.f(..) will use JUMP and not a message call).  当一个合约从其他多个合约继承的时候, 只有一个合约会在链上创建,所有的基类合约代码会被编译为新建的合约中。意味着所有对基类合约的函数的内部调用将使用内部函数调用。(super.f(..) 将使用JUMP, 而不是消息调用).

多继承例子:

contract PriceFeed is Owned, Destructible, Named("GoldFeed") {
    function updateInfo(uint newInfo) public {
        if (msg.sender == owner) info = newInfo;
    }

    // Here, we only specify `override` and not `virtual`.
    // This means that contracts deriving from `PriceFeed`
    // cannot change the behavior of `destroy` anymore.
    function destroy() public override(Destructible, Named) { Named.destroy(); }
    function get() public view returns(uint r) { return info; }

    uint info;
}

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;

contract owned {
    constructor() { owner = payable(msg.sender); }
    address payable owner;
}

contract Destructible is owned {
    function destroy() virtual public {
        if (msg.sender == owner) selfdestruct(owner);
    }
}

contract Base1 is Destructible {
    function destroy() public virtual override { /* do cleanup 1 */ super.destroy(); }
}


contract Base2 is Destructible {
    function destroy() public virtual override { /* do cleanup 2 */ super.destroy(); }
}

contract Final is Base1, Base2 {
    function destroy() public override(Base1, Base2) { super.destroy(); }
}

If Base2 calls a function of super, it does not simply call this function on one of its base contracts. Rather, it calls this function on the next base contract in the final inheritance graph, so it will call Base1.destroy() (note that the final inheritance sequence is – starting with the most derived contract: Final, Base2, Base1, Destructible, owned). 

Base2 调用super,不是简单的调用基类中的某一个函数. 而是调用最终继承树旁边的基类的方法,因此就是调用Base1.destory().  注意: 最终继承序列是:Final ->Base2 -> Base1 -> Destructible->owned.

Function Overriding 函数重写

The overriding function may only change the visibility of the overridden function from external to public.  复写函数可能只可以改变被复写函数的可视性. 比如从external到public.

The mutability may be changed to a more strict one following the order: nonpayable can be overridden by view and pure. view can be overridden by pure. payable is an exception and cannot be changed to any other mutability.

可变性可以按照以下顺序更改为更严格的可变性:nonpayable可以被view,pure重写, view可以被pure重写. payable是一个列外, 不可能被任何可变性重写.

Arguments for Base Constructors

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;

contract Base {
    uint x;
    constructor(uint _x) { x = _x; }
}

// Either directly specify in the inheritance list...
contract Derived1 is Base(7) {
    constructor() {}
}

// or through a "modifier" of the derived constructor.
contract Derived2 is Base {
    constructor(uint _y) Base(_y * _y) {}
}

Multiple Inheritance and Linearization (多继承和线性化,从右向左, python是从左向右.)

Another simplifying way to explain this is that when a function is called that is defined multiple times in different contracts, the given bases are searched from right to left (left to right in Python) in a depth-first manner, stopping at the first match. If a base contract has already been searched, it is skipped. 另一个简单的方法去解释这个是: 多继承中,当调用一个定义在多个不同合约中相同的函数时,对基类函数的搜索顺序是以深度优先方式 从右向左,(在python中是从左向右)。 如果一个合约已经被搜索到, 搜索会中断跳出.

注意构造函数调用顺序:

// SP
DX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;

contract Base1 {
    constructor() {}
}

contract Base2 {
    constructor() {}
}

// Constructors are executed in the following order:
//  1 - Base1
//  2 - Base2
//  3 - Derived1
contract Derived1 is Base1, Base2 {
    constructor() Base1() Base2() {}
}

// Constructors are executed in the following order:
//  1 - Base2
//  2 - Base1
//  3 - Derived2
contract Derived2 is Base2, Base1 {
    constructor() Base2() Base1() {}
}

// Constructors are still executed in the following order:
//  1 - Base2
//  2 - Base1
//  3 - Derived3
contract Derived3 is Base2, Base1 {
    constructor() Base1() Base2() {}
}

Abstract Contracts 抽象合约

Contracts need to be marked as abstract when at least one of their functions is not implemented.

合约必须被标注为abstract,  当至少一个函数没有被实现.

Contracts may be marked as abstract even though all functions are implemented.

合约可能会被标注为abstract,及时所有的函数都已经实现了.

Such abstract contracts can not be instantiated directly. This is also true, if an abstract contract itself does implement all defined functions.  抽象合约不能被实例化. 即使是抽象合约实现了所有的定义函数,也不能被直接实例化.

If a contract inherits from an abstract contract and does not implement all non-implemented functions by overriding, it needs to be marked as abstract as well.

如果一个合约继承一个抽象合约,并且没有实现全部抽象函数,则这个合约也得被标注为abstract.

抽象合约不能用一个抽象函数去重写一个已经实现了的函数.

Interfaces (接口)

  • They cannot inherit from other contracts, but they can inherit from other interfaces. 不能继承其他合约,只能继承接口.

  • All declared functions must be external. 所有的函数声明,必须外部可视.

  • They cannot declare a constructor.  不能声明构造函数.

  • They cannot declare state variables. 不能声明状态变量.                                                                       

    All functions declared in interfaces are implicitly virtual, which means that they can be overridden. This does not automatically mean that an overriding function can be overridden again - this is only possible if the overriding function is marked virtual.       

    所有在接口中定义的函数隐式的被virtual修饰, 意味着它们都可以被重写。这并不是意味自动的, 重写函数可以被自动的被重写,必须要有virtual去修饰。                   

Libraries

Libraries are similar to contracts, but their purpose is that they are deployed only once at a specific address and their code is reused using the DELEGATECALL (CALLCODE until Homestead) feature of the EVM.  Libraries 和contracts 非常相似, 它们被部署在一个特殊的地址上,它们的代码通过EVM的特性delegatecall 或callcode来调用重用。 liberies的执行环境是调用合约的执行环境。

 Library functions can only be called directly  只有在libereries函数是view或pure的时候,才能直接调用。 不允许修改状态的lib函数,直接被调用, 必须通过delegatecall调用。

Libraries can be seen as implicit base contracts of the contracts that use them. They will not be explicitly visible in the inheritance hierarchy, but calls to library functions look just like calls to functions of explicit base contracts (using qualified access like L.f()). Of course, calls to internal functions use the internal calling convention, which means that all internal types can be passed and types stored in memory will be passed by reference and not copied. To realize this in the EVM, code of internal library functions and all functions called from therein will at compile time be included in the calling contract, and a regular JUMP call will be used instead of a DELEGATECALL.

Libraries可以被看成是隐式的基类继承合约,但lib不会出现在继承层级中, 但调用lib的函数,跟调用基类合约的函数是一样的(正确的访问应该是 L.f()). 当然,调用内部函数,使用调用内部函数的惯例。convention 惯例.  意味所有被传递的内部类型都是存储在memory中, 可以被引用传递,而不是值拷贝。 EVM为了实现这个功能,lib的内部函数代码和在那里被调用的参数将会在编译期间被包含在调用合约里面(calling contract),  一个常规的JUMP 会取代DELEGATECALL.

As the compiler does not know the address where the library will be deployed, the compiled hex code will contain placeholders of the form __$30bbc0abd4d6364515865950d3e0d10953$__. 

因为编译器不知道library将会部署到那个地址上,所有编译16进制代码会包含一个占位符号:__$30bbc0abd4d6364515865950d3e0d10953$__  (是libraries/bigint.sol:BigInt的hash格式.)

Such bytecode is incomplete and should not be deployed. Placeholders need to be replaced with actual addresses. You can do that by either passing them to the compiler when the library is being compiled or by using the linker to update an already compiled binary. See Library Linking for information on how to use the commandline compiler for linking. 如此字节代码是不完整的,不应该被部署。 占位符需要用真实的地址替换掉。 你可以把真实地址传递给编译器当library正在被编译的过程中, 或者使用linker更新一个已经编译好的字节码和真实地址建立联系.

In comparison to contracts, libraries are restricted in the following ways:

  • they cannot have state variables  不能拥有状态变量.

  • they cannot inherit nor be inherited 不能继承或被继承。

  • they cannot receive Ether  不能接受ETH

  • they cannot be destroyed 不能被销毁.

(These might be lifted at a later point.)  这些限制在未来中可能会被lifted.

Function Signatures and Selectors in Libraries

Similarly to the contract ABI, the selector consists of the first four bytes of the Keccak256-hash of the signature.  和contract ABI相似, selector 由 函数签名后的Keccak256-hash的前4个字节组成.

Call Protection For Libraries

As mentioned in the introduction, if a library’s code is executed using a CALL instead of a DELEGATECALL or CALLCODE, it will revert unless a view or pure function is called.

只有view和pure库函数,可以用call调用,其他的都不可以,否则会被revert.

DelegateCall和callcode, 可以调用所有的库函数.

The EVM does not provide a direct way for a contract to detect whether it was called using CALL or not, but a contract can use the ADDRESS opcode to find out “where” it is currently running. The generated code compares this address to the address used at construction time to determine the mode of calling.

EVM没有为合约提供一个直接的方法去识别合约是被用call调用,还是不是. 但是合约可以用ADDRESS 操作码去识别它当前在哪里运行。生成的代码会去比较this.address和构造函数里面的地址去识别合约运行模式。

More specifically, the runtime code of a library always starts with a push instruction, which is a zero of 20 bytes at compilation time. When the deploy code runs, this constant is replaced in memory by the current address and this modified code is stored in the contract. At runtime, this causes the deploy time address to be the first constant to be pushed onto the stack and the dispatcher code compares the current address against this constant for any non-view and non-pure function.

This means that the actual code stored on chain for a library is different from the code reported by the compiler as deployedBytecode.

更具体的说,库运行代码总是带着一个推送结构(20个字节结构,在编译期间,都为0)一起启动,  当开始部署时候, 这个20字节常量constant 会被当前地址所替换 并且 这个修改后的代码被存储在合约里面。在运行期间,部署期间的地址成为优先常量会被push到stack里面, 调度员代码会比较当前地址和常量constant地址为每一个非view和非pure的方法.

这意味着存储在库链上的实际代码与编译器报告为deployedBytecode的代码不同。

Using For

The directive using A for B; can be used to attach library functions (from the library A) to any type (B) in the context of a contract. These functions will receive the object they are called on as their first parameter (like the self variable in Python).

直接使用using A for B, 可以把库A的函数全部赋到B合约上. 这些库函数将会把B作为他们的第一个参数.

The effect of using A for *; is that the functions from the library A are attached to any type.

using A for *,  把库A的函数依附到所有类型上.

The using A for B; directive is active only within the current contract, including within all of its functions, and has no effect outside of the contract in which it is used. The directive may only be used inside a contract, not inside any of its functions.

using A for B 指令只会在合约内有效,包括合约内的所有函数有效, 对合约外部没有影响。这个指令只能写在合约里面,不能写在函数里面。

Note that all external library calls are actual EVM function calls. This means that if you pass memory or value types, a copy will be performed, even of the self variable. The only situation where no copy will be performed is when storage reference variables are used or when internal library functions are called.

请注意,所有外部库调用都是实际的EVM函数调用。这意味着,如果传递内存或值类型,将执行复制,甚至是自变量的复制。唯一不执行复制的情况是使用存储引用变量或调用内部库函数时。

调用库外部函数,除了storage类型,都是值复制。  调用库内部函数都是值引用。

Inline Assembly

Inline assembly is a way to access the Ethereum Virtual Machine at a low level.  内联汇编是一种以底层的方式去访问Etherum Virtual Machine的方式.This bypasses several important safety features and checks of Solidity. 这回绕过很重要的solidity的安全特性和安全检查。You should only use it for tasks that need it, and only if you are confident with using it. 你只能在任务真实需要的时候使用它,并且你有把握去使用它。

An inline assembly block is marked by assembly { ... }

001.Solidity 智能合约概述 Solidity 智能合约概述 阅读详情

相关推荐

智能合约(Smart contract)

一、简介 概念:是指一份能自动执行本需要手动才能完成任务的协议。智能合约就是任何能自动执行部分功能的协议。例如,一份能自动计算合同当事人待付金额,并安排支付这笔金额的合约。智能合约将减少协议执行过程中的人工干预。 目的:提供优于传统合约的安全方法,并减少与合约相关的其他交易成本交易成本。 智能合约概念于1995年由Nick Szabo首次提出。他的定义如下:“一个智能合约是一套以数字形式定义的承诺(promises),包括合约参与方可以在上面执行这些承诺的协议。” 承诺:一套承诺指的是合约参与方

hanbing1307的博客 4374

solidity -- 合约

在不同的合约(实例)上调用函数将执行 EVM 函数调用,从而切换上下文,使得调用合约中的状态变量不可访问。编译器生成的合约创建代码将在合约返回之前修改合约的运行时代码,方法是将所有对不可变对象的引用替换为分配给它们的值。内部可见性函数访问可以在当前合约或派生的合约访问,不可以外部访问。的变量受到的限制要少一些:可以在合约的构造函数中或在声明时为不可变变量分配任意值。只能使用在当前合约或在基类合约中定义的 修改器modifier , 修改器modifier 也可以定义在库里面,但是他们被限定在库函数使用。

一只路过的小码农cxy 1469

怎样使用 Hardhat 开发 Solidity 智能合约

创建一个简单的智能合约并对其进行测试,然后使用 Hardhat 将其部署在测试网上.

Lance 3698

solidity语言学习(9)—— 合约(Contract)

在solidity中合约类似于面对对象的语言中的类。他包括了状态变量中那些长期的数据以及能够修改这些状态的函数。在一个合约中调用另一个合约(实例)的函数会执行一个EVM函数调用,它将转换上下文内容是得状态变量不可触及。 创造合约 合约是通过以太坊交易或者来自solidity合约内部,“从外部”产生的。 一些典型的IDE,比如说Remix,能够使用UI元素创造无缝的进程。 在以太坊中程式...

weixin_42595515的博客 4557

如何用 Solidity 创建一个“Hello World”智能合约

Solidity 编程语言的 “Hello world”

ChainlinkO的博客 1767

【0基础】学习solidity开发智能合约-初识solidity

solidity入门课程,初识solidity

外柏叁布道者 6872

智能合约开发-Metamask、Solidity

为了构建开发智能合约或者dApp,我们需要安装以下模块:Node 与 NPM,Truffle 框架,Ganache,Metamask,VScode 与 Solidity插件。

charles0902的专栏 1822

微众银行《Solidity智能合约库》区块链工程师的随身工具箱之初体验相当的nice

文章目录一、智能合约库简介二、痛点及解决方式痛点一:计算可能溢出痛点二:转换不够便捷痛点三:数组操作不够丰富痛点四:不提供字符串内置操作痛点五:高级数据结构不完备总结 一、智能合约库简介 作为一门实现了图灵完备的智能合约编程语言,Solidity编程语言的开发、设计、迭代、演化的逻辑完全基于区块链,并在区块链领域具有广泛的影响力和详尽的文档,被众多区块链底层平台所支持,其中就包括FISCO BCOS。 但是,Solidity编程语言也存在若干挑战。首先,受区块链昂贵的资源限制,Solidity舍去了诸多在

向彪-区块链技术研究 8701

Solidity Contract

在Solidity中,Contract对象是一个合约的蓝图或模板。它规定了合约的状态变量、函数、事件和修饰符等元素。每当您在以太坊区块链上部署一个智能合约时,实际上是基于该合约的Contract对象创建了一个新的实例。Contract对象是Solidity智能合约的核心组成部分,定义了合约的结构和行为。它包括状态变量、函数、事件和修饰符等元素,用于实现合约的逻辑和交互。通过编写、部署和与Contract对象交互,开发者可以创建强大的分散式应用程序,利用以太坊区块链的功能。

qq_41586330的博客 197

基于FISCO BCOS 部署可升级的 Solidity存证智能合约

本文介绍了基于FISCOBCOS平台的可升级Solidity存证智能合约实现方案。采用透明代理模式,包含逻辑合约、代理合约和管理合约三部分,支持业务逻辑升级而不影响存储数据。详细阐述了合约架构设计、Solidity代码实现、Go SDK交互流程以及完整的部署升级步骤。方案具有数据持久性、版本兼容性和生产就绪等特点,提供了权限控制、输入验证等安全机制,并包含监控管理工具。该实现为企业级区块链存证应用提供了可靠的基础架构,支持后续功能扩展和定制化开发。

分享AI、区块链技术及应用,未来已来 1514

差分音频转单端音频单电源方案

其中,芯片设计中的轨到轨输出(Rail-to-Rail Output) 是指通过特定的电路设计,使芯片(如运算放大器、驱动电路等)的输出电压能够达到或接近电源电压的上下极限(即“电源轨”),从而最大化信号的动态范围。最终,Vout=R2/R1*(Vin2−Vin1),即输出电压为输入电压差(Vin2−Vin1)乘以电阻比R2/R1。2、电阻:R1、R2、R3、R4是电路中的电阻,其中R1 = R3,R2 = R4。因R1=R3,R2=R4,且Vn=Vp,设R1=R3=R,R2=R4=kR。

电子绿洲的博客 4957

solidity:智能合约结构介绍

第 1 行就是合约的版权声明。其中(SPDX 许可标示) 是标注当前的智能合约采用什么样的对外开放标准,该标准规定了别人是否拥有商业开发,学习使用等权利。代码中使用的MIT规定了其他人随便用该代码,但出问题不负责。MIT 详细解释;SPDX 许可标示的注释在文件的任何位置都可以被编译器识别到的,按照规范建议把它放在文件的顶部第一行。如果一个项目开源了智能合约的源代码,可以更好地建立社区信任。但是由于提供源代码就不可避免的涉及到版权或者法律问题。所以 solidity 鼓励开源,但是开源并不等于放弃版权。

目前专注区块链相关技术的学习与分享 3669

逆向分析踩坑记:当Frida在x86模拟器上‘看不见’ARM的so文件时,我们该如何手动定位与验证?

本文探讨了在x86模拟器上使用Frida进行逆向分析时,无法检测到ARM架构so文件的解决方案。通过分析内存映射、Frida的视觉盲区及手动定位技术,提供了兼容层、混合调试和原生ARM环境三种实用方案,帮助逆向工程师突破工具限制,实现精准定位与验证。

weixin_27697385的博客 222

基于truffle-contract库之solidity事件与合约调用完整案例!

/** * 一个基于truffle-contract库实现的以太坊solidity智能合约调用案例! * 注意:truffle-contract库和web3.js使用nodej或import同时导入转码的时候会打架冲突! * 为此如果使用truffle-contract库来实现solidity调用,必须使用truffle-contract原生链的Web3对象! * ...

weixin_43343144的博客 1171

OpenCV2.4.9+vs2012配置

下载OpenCV2.4.9。 下载地址:http://opencv.org/downloads.html2.下载后,解压。 请记住解压路径,后面根据自己的解压路径进行配置。我的路径是E:\ 3.配置环境变量 win7系统:(计算机-属性-高级系统设置-高级-环境变量) 1)编辑系统变量Path:添加E:\opencv\build\x86\vc11\bin; 2)添加/编辑用户变量P

sybil_w的博客 970

STM32H743IIT6上LVGL移植实战:从零到触摸屏驱动的完整配置流程

本文详细记录了在STM32H743IIT6高性能MCU上,从零开始移植LVGL图形库到7寸RGB触摸屏的完整实战流程。内容涵盖工程搭建、显示与触摸驱动配置、LVGL核心优化及常见问题排查,重点讲解了如何利用STM32H743的硬件特性(如DMA2D、LTDC)提升GUI性能,为嵌入式GUI开发提供了一份详实的配置指南。

spark7igniter的博客 549

Solidity入门-开发众筹智能合约

前言本文要求你对Solidity开发有一点基础的了解。我会使用Solidity开发一个简单的众筹智能合约,合约的主要功能就是向希望给我捐赠的人收钱,然后我再将钱从合约账户里取出来。因为程序...

weixin_30230009的博客 6875

macOS Jdk1.8安装(目前主流版本的jdk)

添加环境环境变量,类似于windows的高级设置中path配置的环境变量。查看 JAVA_HOME 目录。查看 JDK 版本信息。一直下一步安装就好了。在终端的根目录下运行。

m0_50207524的博客 9353

Solidity【简介】

Solidity概述、Solidity语言核心特性、Solidity开发工具Remix、智能合约学习游戏、什么是以太坊、以太坊虚拟机EVM

尽欢的博客 1715

从BIOS到路由器:深入拆解SPI NOR Flash的硬件连接与‘芯片内执行’(XIP)奥秘

本文深入解析SPI NOR Flash的硬件连接与‘芯片内执行’(XIP)技术,从BIOS到路由器的应用场景出发,详细介绍了其架构精髓、典型连接方案、时序设计及性能优化方法。通过实际案例和参数对比,帮助开发者掌握NOR Flash在嵌入式系统中的关键作用与设计技巧,提升电路设计效率与可靠性。

weixin_30522183的博客 492

基于 YOLOv26 的 PCB 板缺陷检测:工业级视觉实战

本文提出了一种基于YOLOv26的PCB板缺陷检测系统,通过深度学习技术实现对PCB板缺陷的自动化检测。系统能够识别短路、开路、焊点不良等8种常见缺陷,具有高精度、多类别分类和实时推理等优势。文章详细介绍了系统架构,包括数据采集、预处理、YOLOv26模型检测和后处理模块。在代码实现部分,给出了环境配置、数据预处理与增强的具体方法,使用Albumentations库进行图像增强处理。该系统为电子制造业提供了高效、准确的PCB质量检测解决方案,显著提升了检测效率和准确性。

一键难忘的博客 339

【重磅推荐】基于truffle-contract库实现的以太坊solidity合约调用案例(注:web3.js切勿和truffle-contract库同时使用,否则报错,无法修复!)

1、一个基于truffle-contract库实现的以太坊solidity智能合约调用案例! 2、 注意:truffle-contract库和web3.js使用nodej或import同时导入转码的时候会打架冲突! 为此如果使用truffle-contract库来实现solidity调用,必须使用truffle-contract原生链的Web3对象! truffle-...

weixin_43343144的博客 1008

【图像超分】论文精读:Enhanced Deep Residual Networks for Single Image Super-Resolution(EDSR和MDSR)

最近对超分辨率的研究随着深度卷积神经网络 (DCNN) 的发展取得了进展。特别是,残差学习技术表现出更好的性能。在本文中,我们开发了一个增强的深度超分辨率网络(EDSR),其性能超过了当前最先进的 SR 方法。我们模型的显着性能改进是由于通过删除传统残差网络中不必要的模块进行优化。当我们稳定训练过程时,通过扩展模型大小可以进一步提高性能。我们还提出了一种新的多尺度深度超分辨率系统(MDSR)和训练方法,该方法可以在单个模型中重建不同缩放因子的高分辨率图像。所提出的方法在基准数据集上比最先进的方法表现出更好的

主要更新底层视觉(去噪、超分等)相关的科研内容,形式为【论文精读】+【论文复现】 7925

区块链(七)智能合约(Smart Contract)

1. 智能合约(Smart Contract) 智能合约(Smart Contract),是一种旨在以信息化方式传播、验证或执行合同的计算机协议。智能合约允许在没有第三方的情况下进行可信交易,这些交易可追踪且不可逆转。智能合约部署在区块链节点,当智能合约中设定的事件被触发时,智能合约就会自动执行,此过程无需第三方参与。 2. solidity 在编写智能合约的语言当中最火的就是solidit...

橘红色の火焰的博客 4155

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

solidity之library 用法(二)库的核心用法总结(一个特殊的contract合约)

solidity之library的一个核心原则就是:哪个合约调用library,那么library中的this就指向那个合约! pragma solidity &gt;=0.4.0 &lt;0.6.0; library Test_lib { // 这里的参数存储位置必须和contract合约调用传参位置一致! // 官方文档强调:library的内存类型都是通过引用来传递的...

weixin_43343144的博客 2400

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

智能合约编写之Solidity的基础特性

来源 |FISCO BCOS 作者 |储雨知 责编 | Carol 出品 |区块链大本营(blockchain_camp) 目前大部分的联盟链平台,包括FISCO BCOS,都采用Solidity作为智能合约开发语言,因此熟悉并上手Solidity十分必要。 作为一门面向区块链平台设计的图灵完备的编程语言,Solidity支持函数调用、修饰符、重载、事件、继承等多种...

akjw008的专栏 2940

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

上一篇: solidity中error,panic,require,revert,assert之间的关系.
下一篇: Inline Assembly 内联汇编总结
gridlayout
博客等级 码龄19年 12粉丝 26原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值