Smart Contract - Hello World
【编写Smart Contract】
1、包含头文件.
#include <eosiolib/eosio.hpp>
#include <eosiolib/print.hpp>
2、使用命名空间
using namespace eosio;
3、实现一个空的合约
class hello : public contract {
public:
using contract::contract;
};
4、合约中添加一个action
class hello : public contract {
public:
using contract::contract;
[[eosio::action]]
void hi( name user ) {
print( "Hello, ", name{user});
}
};
5、添加转发表
EOSIO_DISPATCH( hello, (hi))
6、使用 eosio-cpp -o --abigen 生成 .wasm、.abi
eosio-cpp -o hello.wasm hello.cpp --abigen
7、用set contract 命令发布合约

-p 指明需要 hello的 active权限
cleos set contract hello /home/ubuntu/contracts/hello -p hello@active
8、使用 push action 命令来使用

-p 指明本身的权限
leos push action hello hi '["bob"]' -p bob@active
参考:
1、https://developers.eos.io/eosio-home/docs/your-first-contract
Smart Contract - Hello World的更多相关文章
- ethereum/EIPs-1271 smart contract
https://github.com/PhABC/EIPs/blob/is-valid-signature/EIPS/eip-1271.md Standard Signature Validation ...
- Using APIs in Your Ethereum Smart Contract with Oraclize
Homepage Coinmonks HOMEFILTER ▼BLOCKCHAIN TUTORIALSCRYPTO ECONOMYTOP READSCONTRIBUTEFORUM & JOBS ...
- Truffle Smart Contract Error: Invalid number of parameter
I followed the tutorial of quorum with truffle: https://truffleframework.com/tutorials/building-da ...
- 区块链学习5:智能合约Smart contract原理及发展历程科普知识
☞ ░ 前往老猿Python博文目录 ░ 一.智能合约的定义 通俗来说,智能合约就是一种在计算机系统上,当一定条件满足的情况下可被自动执行的合约,智能合约体现为一段代码及其运行环境.例如银行信用卡的自 ...
- 【翻译】A Next-Generation Smart Contract and Decentralized Application Platform
原文链接:https://github.com/ethereum/wiki/wiki/White-Paper 当中本聪在2009年1月启动比特币区块链时,他同时向世界引入了两种未经测试的革命性的新概念 ...
- smart contract 知识点
知识点 memory vs storage vs stack storage , where all the contract state variables reside. Every contra ...
- 【阿菜Writeup】Security Innovation Smart Contract CTF
赛题地址:https://blockchain-ctf.securityinnovation.com/#/dashboard Donation 源码解析 我们只需要用外部账户调用 withdrawDo ...
- the security of smart contract- 1
https://blog.zeppelin.solutions/the-hitchhikers-guide-to-smart-contracts-in-ethereum-848f08001f05 这个 ...
- Smart Contracts
A smart contract is a computer code running on top of a blockchain containing a set of rules under w ...
随机推荐
- GP card规范学习笔记
9. APDU命令参考 9.1 总的编码规则 A.生命周期状态的编码 可执行的装载文件 b8 b7 b6 b5 b4 b3 b2 b1 含义 16进制命令 0 0 0 0 0 0 0 1 LO ...
- live555 交叉编译移植到海思开发板
本文章参考了.http://blog.csdn.net/lawishere/article/details/8182952,写了hi3518的配置说明.特此感谢 https://blog.csdn.n ...
- Intellij IDEA 为常用代码添加快捷代码,补全代码
- Bootstrap格式转换代码
网址:http://www.w3cschool.cc/bootstrap/bootstrap-responsive-utilities.html <div class="contain ...
- 第一天Python
一.开发语言 高级语言:Python Java.PHP 高级语言--字节码(PHP适用于写网页) 低级语言:C.汇编--机器码(底层开发,根本,效率低) 二.Python种类 三.安装
- Struts1 不能进入Action,页面空白问题解决
http://blog.csdn.net/barry_liao/article/details/35592935 Struts1 不能进入Action,页面空白问题解决 标签: Struts1Acti ...
- 算法实践--最长公共子序列(Longest Common Subsquence)
什么是最长公共子序列 X=ACCG Y=CCAGCA 长度为1的公共子序列: {A} {C} {G} 长度为2的公共子序列:{AC} {CC} {CG} {AG} 长度为3的公共子序列:{ACG} 长 ...
- IIS6.0+win2003部署MVC网站的一些问题
安装iis,framework环境不谈.MVC网站部署 步骤: 1.为程序新建一个应用程序池(将default的那个程序池作为模板就可以了) 2.web服务扩展一些启用一些必要的服务 3.新建网站 描 ...
- c# 多态 虚方法
多态: 为了解决同一种指令,可以有不同行为和结果 在运行时,可以通过调用同一个方法,来实现派生类中不同表现. 虚方法——抽象类——抽象函数——接口 虚方法: 被virtual 关键字修饰的方法 叫做 ...
- minicom 抓取log
使用minicom也有很长时间了,只用minicom抓过uart log,但是从来没有去保存过这个log,也不知道有这个功能.后来在超级终端中发现有这个功能(传送->捕获文字),想想minico ...