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 ...
随机推荐
- day06python 哈希 字典集合嵌套
1.hash算法 hash算法 :内存中将值进行hash算法得到一个数值存储在内存中,查找也会按照算法进行查找,使用hash算法 执行效率高相对于list的索引查找 (字典,集合):使用的是hash查 ...
- 解决eclipse高版本JDK编译的项目到低版本JDK服务器上不能运行的问题
错误提示信息:Unsupported major.minor version 52.0,意思是说,当前jdk的版本不支持更高版本jdk编译出来的class文件. 我的编译环境,eclipse使用的是j ...
- strstr函数的运用
strstr函数用于搜索一个字符串在另一个字符串中的第一次出现,该函数返回字符串的其余部分(从匹配点).如果未找到所搜索的字符串,则返回 false.
- 2018.4.24 flask_mail使用
#!/flask/bin/python # -*- coding: utf-8 -*- from threading import Thread from flask import Flask fro ...
- js的一些方法
input的值: value.toUpperCase();//value.toUpperCase()把字符窜转换为大写 random方法: Math.floor对数字向下舍入 Math.random( ...
- 列表:remove/del删除方法中的逻辑“误区”
结果: list_1=["A","B","C","D","E","F",&quo ...
- 【HDU5187】contest
真的没有什么会写的东西了QAQ 原题: As one of the most powerful brushes, zhx is required to give his juniors n probl ...
- windows添加永久静态路由
添加路由最好在命令行管理员模式下操作 添加临时路由命令,重启后失效 route add 172.16.1.0 mask 255.255.255.0 10.0.10.19 其中,172.16.1.0 是 ...
- oracle-data-mining
create user datamine identified by 123456 QUOTA UNLIMITED ON users; 然后在sqldeveloper工具界面-data miner中, ...
- 1.1.8 怎样在Word的页眉中插入一级标题
可以通过域来实现,其具体的操作步骤: 1.为章.节标题使用标题样式.例如:章标题使用标题1样式,节标题使用标题2样式.操作方法:选中章(节)标题,然后点击选项卡中“样式”中的). 2.设置文档页眉和页 ...