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 ...
随机推荐
- 复习-java-001
一.基本数据类型: byte.boolean.char.string.int.short.long.float.double 二.java三大特性: 1.封装 封装是实现面向对象程序设计的第一步,封装 ...
- docker删除镜像文件时,出现image is referenced in multiple repositories如何解决
1.输入查看镜像文件的命令: $ docker image ls 得到如下结果: 2.删除名为lihui/demo的镜像,输入如下命令: $ docker rmi 9fa504a6066a 报错,报错 ...
- python入门第二天
啦啦啦啦啦!!!!我又来啦,几天该正式开始学习python语言啦,好高兴啊!!!今天学习的主要内容是变量和简单的数据类型!! 变量和简单的数据类型 大家回忆一下昨天的Hello Python Worl ...
- 巡风安装配置 -windows
巡风是一款适用于企业内网的漏洞快速应急.巡航扫描系统,通过搜索功能可清晰的了解内部网络资产分布情况,并且可指定漏洞插件对搜索结果进行快速漏洞检测并输出结果报表. 其主体分为两部分:网络资产识别引擎,漏 ...
- Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
To fix it, just kill the apt process. ps -aux | grep -i apt sudo kill -9 "the process ID"
- SSH原理及操作
1:公钥与私钥(public and private key) 公钥:提供给远程主机进行数据加密的行为 私钥:远程主机收到客户端使用公钥加密数据后,在本地端使用私钥来解密 2:公钥与私钥进行数据传输时 ...
- Mysql组复制之单主模式(一)
环境 系统:CentOS release 6.9 (Final) Mysql:5.7 机器: S1 10.0.0.7 lemon S2 10.0.0.8 lemon2 S3 10.0.0.9 lemo ...
- oData 排序字段生成
跟踪SQL 发现生成的SQL中所有的字段都进行了排序,查看OData原代码,发现如果实体有Key,就按照Key asc 加上指定字段进行排序 属性 EnsureStableOrdering可以控制是否 ...
- Windows Azure Virtual Network (13) 跨数据中心之间的虚拟网络点对点连接VNet Peering
<Windows Azure Platform 系列文章目录> 今天是大年初二,首先祝大家新年快乐,万事如意. 在笔者之前的文章中:Windows Azure Virtual Networ ...
- Android开发 :androidstudio device offline
使用设备调试的时候,偶尔的就会遇到androidstudio device offline,尽管尝试开启/关闭 USB调试 .都无济于事. 如果PC安装了360手机助手就好办了(我的360手机助手 ...