In this lesson we'll show how to use yarn to alias the names of same npm libraries but install different versions. This could allow for easy migrating from one library version to an upgraded version. You can install lib by using Yarn and give the lib…
基于 cryptozombies.io ZombieFactory pragma solidity ^0.4.19; contract ZombieFactory { // 事件, web3.js 可以监控它 event NewZombie(uint zombieId, string name, uint dna); uint dnaDigits = 16; uint dnaModulus = 10 ** dnaDigits; // 乘方 // 定义结构体 struct Zombie { str…
在 以太坊中合约间是可以相互调用,并且正常进行参数传递以及返回值处理. contract1.sol pragma solidity ^0.4.0; contract Test1 { uint256 public v=7; function vote(uint256 a) public returns (uint256) { v=a; return (a); } } contract2.sol pragma solidity ^0.4.0; import "./contract1.sol"…
将以太坊封装为 ERC20 TOKEN 很多 DAPP 都是在处理 ERC20接口的 token, 其实很容易将以太坊封装为 ERC20,这样就可以统一处理, 至少我目前在做的雷电网络就是这么处理的. 主要内容复制在网络 https://programtheblockchain.com/posts/2018/05/26/wrapping-ether-in-an-erc20-token/ 直接上代码,核心部分是 pragma solidity ^0.4.24; import "baseerc20t…
一.智能合约介绍 智能合约是指把合同/协议条款以代码的形式电子化地放到区块链网络上.FISCO BCOS平台支持两种智能合约类型:Solidity智能合约与预编译智能合约 Solidity与Java类似.代码写好后,都需要通过编译器将代码转换成二进制,在Java中,编译器是Javac,而对于Solidity,是solc.生成后的二进制代码,会放到虚拟机里执行.Java代码在Java虚拟机(JVM)中执行,在Solidity中,是一个区块链上的虚拟机EVM.目的,是给区块链提供一套统一的逻辑,让相…
接着第一部分,这篇文章就 Angular cli进行介绍总结: 1. ng g:列出当前命令 ng g 需在angular工程文件夹下执行: C:\Users\zb\angulardemo\heroes>ng g Generates and/or modifies files based on a schematic. usage: ng generate <schematic> [options] arguments: schematic The schematic or collec…
The #pragma is complier specified. for example, the code below does not work in gcc. #pragma startup and #pragma exit: #pragma startup func1 #pragma exit func2 void func1() { printf("Inside func1()\n"); } void func2() { printf("Inside func2…
学习文档笔记:http://solidity-cn.readthedocs.io/zh/develop/layout-of-source-files.html 1.pragma solidity ^0.4.0;这样,意味着源文件将既不允许低于 0.4.0 版本的编译器编译, 也不允许高于(包含) 0.5.0 版本的编译器编译(第二个条件因使用 ^ 被添加) 2.导入import * as symbolName from “filename”;//或“.sol”文件等同于import "filen…
在这里使用cryptoPunks为实例来进行solidity的介绍,一般这些内容理解了就能够进行相对简单的智能合约的编写了,同时会添加一些我认为也十分重要的内容学习文档为http://solidity-cn.readthedocs.io/zh/develop/layout-of-source-files.html ()pragma solidity ^0.4.0;这样,意味着源文件将既不允许低于 0.4.0 版本的编译器编译, 也不允许高于(包含) 0.5.0 版本的编译器编译(第二个条件因使用…
Solidity是一种智能合约高级语言,运行在Ethereum虚拟机(EVM)之上.这里我会讲解一下关键字storage和memory的区别. storage的结构是在合约部署创建时,根据你的合约中状态变量的声明,就固定下来了,并且不能在将来的合约方法调用中改变这个结构.但是,storage中的内容是可以通过交易来改变的.这些交易调用因此将修改合约的状态. memory关键字告诉solidity应当在该函数运行时为变量创建一块空间,使其大小和结构满足函数运行的需要. 首先局部变量默认是stora…
IDE:Atom 插件:autocomplete-solidity 代码自动补齐   linter-solium,linter-solidity代码检查错误   language-ethereum支持solidity代码高亮 1. 合约文件结构 版本号  : import 合约 :contract pragma solidity ^0.4.0; import "solidity_for_import.sol"; // this is a test contract contract T…
要清楚在区块链上开发DApp的架构[x][][][][][]   DApp是去中心化的应用   基于智能合约 去中心化的游戏规则 代币激励  …
一个 Solidity 源文件可以包含任意数量的合约定义.import指令和pragma指令. 让我们从一个简单的 Solidity 源程序开始.下面是一个 Solidity 源文件的例子: pragma solidity >=0.4.0 <0.6.0; contract SimpleStorage { uint storedData; function set(uint x) public { storedData = x; } function get() public view retu…
目录 目录 目录 1.ERC721的基础知识 1.1.什么是不可替代代币? 1.2.什么是 ERC-721? 1.3.什么是元数据 1.4.如何在链上保存NFT的图像 2.HardHat 3.创建项目 3.1.创建 NFT 市场 3.2.创建 NFT 智能合约 3.3.编写测试脚本 4.将 NFT 部署到 Rinkeby 网络,在 OpenSea 上查看 4.1.部署 NFT市场 4.2.部署 NFT 721示例 4.3.对 NFT 721示例 合约在 Rinkeby 网络进行验证 4.4.在…
方法和匿名方法: funcion name(<parameter types>){public|private|internal|external}[constant][payable][<return types>)]{} payable代表是可以接受以太币的方法有如下几种:external可以被其他合约调用,也可以使用内部直接调用,如果要调用的话,要用this.f()来进行调用public既可以被其他合约调用,也可以被内部直接调用internal只能在合约和其他子类合约中使用p…
合约编译 #!/usr/bin/env python # coding: utf8 import json import os # Solc Compiler from functools import reduce SOLC = "solc" BASE_PATH = os.path.dirname(os.path.abspath(__file__)) src_dir = os.path.join(BASE_PATH, "contracts") dst_dir =…
我的项目rvtool(https://github.com/Zeraka/rvtool)中增加了生成solidity语言格式的监控器的模块. solidity特殊之处在于,它是运行在以太坊虚拟机环境中的.EVM和环境是隔离的,因此无法直接读取文件.所以rvtool中通过读取LTL文本生成监控器的方式无法直接照搬到solidity上面.rvtool中建立了表达自动机监控器的数据结构,对该数据结构的赋值是通过几个循环结构完成的.而这个部分无法在solidity代码中表达.将LTL转化为buchi自动…
// //  main.m //  14 - #pragma mark的使用 // //  Created by vic fan on 16/7/10. //  Copyright © 2016年 李洪强. All rights reserved. // #import <Foundation/Foundation.h> #pragma mark -----类的声明------ @interface Person : NSObject{ @public //定义实例变量 NSString *_…
First, What is directive, what is the difference between component and directive. For my understanding, component is something like 'canvas', 'form', 'table'... they have the template and their own functionality. It defines how a html tag should work…
#import Attributes Provides links to attributes used with the #import directive. Microsoft Specific The following attributes are available to the #import directive.   Attribute Description auto_rename Renames C++ reserved words by appending two under…
 Just like passing in an array to *ngFor, you can pass in any value into your structural directive so that it can render templates based on those values. It's crucial to understand how the *directive syntax expands into a <template> and adds a custo…
Just like in *ngFor, you're able to pass in data into your own structural directives. This is done by declaring the variable using a let statement then passing context into the createEmbeddedView call. We know *ngFor we did like this: *ngFor="let mes…
以太坊智能合约介绍,Solidity介绍 一个简单的智能合约 先从一个非常基础的例子开始,不用担心你现在还一点都不了解,我们将逐步了解到更多的细节. Storage contract SimpleStorage { uint storedData; function set(uint x) { storedData = x; } function get() constant returns (uint retVal) { return storedData; } } 在Solidity中,一个…
一个简单的智能合约 先从一个非常基础的例子开始,不用担心你现在还一点都不了解,我们将逐步了解到更多的细节. Storage contract SimpleStorage { uint storedData; function set(uint x) { storedData = x; } function get() constant returns (uint retVal) { return storedData; } } 在Solidity中,一个合约由一组代码(合约的函数)和数据(合约的…
1,指令的创建至少需要一个带有@Directive装饰器修饰的控制器类.@Directive装饰器指定了一个选择器名称,用于指出与此指令相关联的属性的名字. 2,创建一个highlight.directive.ts文件 可以用命令 ng g directive highlight;内容如下 这里是做一个给元素加色彩的一个指令. import { Directive, ElementRef, Renderer } from '@angular/core'; @Directive({ selecto…
由于angular2兴起不久,相关插件还是很少,所以有时候不得不用一些jquery插件来完成项目, 那么如何把jquery插件放到angular2中呢?采用自定义指令! 在上下文之前要引入jquery,这点不再描述 首先创建一个指令,采用@input方式,来获取jquery插件所需要的参数. 在ngOnChanges时,也就是参数通过@input传入时,初始化jquery插件, 初始化jquery插件需要获取dom元素,所以我们引入ElementRef,用来获取dom元素 这里需要讲一下,jqu…
一个简单的智能合约 先从一个非常基础的例子开始,不用担心你现在还一点都不了解,我们将逐步了解到更多的细节. 存储 contract SimpleStorage { uint storedData; function set(uint x) { storedData = x; } function get() constant returns (uint retVal) { return storedData; } } 在Solidity中,一个合约由一组代码(合约的函数)和数据(合约的状态)组成…
library库的申明: library SafeMath{ functrion mul(uint a,uint b) public returns (uint){ uint c= a*b; assert(c/a = b) return c } } 使用library库 1 合约中引入 两种调用方式: 2) 直接调用librady名称 : 如 import "XX.sol" contract test{ function mul(uint a,uint b) public return…
Create a directive to check no special characters allowed: import {Directive, forwardRef} from '@angular/core'; import {AbstractControl, NG_VALIDATORS, Validator} from '@angular/forms'; @Directive({ selector: `[formControl][no-special-chars], [formCo…