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 ...
随机推荐
- Redis配置文件 redis.conf 解读(一)
# Redis configuration file example# redis配置文件模板# Note on units: when memory size is needed, it is po ...
- SQLI DUMB SERIES-12
(1)检测闭合方式:在username上输入" admin" " 说明输入的username后还有双引号和括号 方法一: (2)通过其他途径知道用户名即可.如 输入&qu ...
- python入门第二天
啦啦啦啦啦!!!!我又来啦,几天该正式开始学习python语言啦,好高兴啊!!!今天学习的主要内容是变量和简单的数据类型!! 变量和简单的数据类型 大家回忆一下昨天的Hello Python Worl ...
- 成功的拆开了SELECT里JOIN个SELECT是啥
SELECT * FROM table JOIN table ON a=b ----------------------- JOIN (SELECT* FROM table JOIN table ON ...
- sql server 作业收缩数据库
USE[master] GO ALTER DATABASE PayFlow2 SET RECOVERY SIMPLE WITH NO_WAIT GO ALTER DATABASE PayFlow2 S ...
- 用git,clone依赖的库
git clone https://github.com/influxdata/influxdb-java.git cd crfasrnn git submodule update --init -- ...
- 虚拟机网络连接NAT模式,本地用Xshell连接
当虚拟机centos6网络连接使用NAT模式时,因为共用宿主机ip所以当使用Xshell时直接填写虚拟机的ip地址和22端口是无法连接虚拟机的. 这样就需要配置端口映射关系! 1. 打开虚拟网络编辑器 ...
- springboot中添加热部署
<dependency> <!--Spring 官方提供的热部署插件 --> <groupId>org.springframework.boot</group ...
- UEFI和GPT下硬盘克隆后的BCD引导修复
UEFI和GPT下硬盘克隆后的BCD引导修复-Storm_Center http://www.stormcn.cn/post/1901.html 当硬盘引导换成GPT,系统启动也变成UEFI后,如果直 ...
- 【剑指offer】求树中满足和为给定数字的路径
题目: 输入一颗二叉树的跟节点和一个整数,打印出二叉树中结点值的和为输入整数的所有路径.路径定义为从树的根结点开始往下一直到叶结点所经过的结点形成一条路径.(注意: 在返回值的list中,数组长度大的 ...