编写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的更多相关文章

  1. ethereum/EIPs-1271 smart contract

    https://github.com/PhABC/EIPs/blob/is-valid-signature/EIPS/eip-1271.md Standard Signature Validation ...

  2. Using APIs in Your Ethereum Smart Contract with Oraclize

    Homepage Coinmonks HOMEFILTER ▼BLOCKCHAIN TUTORIALSCRYPTO ECONOMYTOP READSCONTRIBUTEFORUM & JOBS ...

  3. Truffle Smart Contract Error: Invalid number of parameter

      I followed the tutorial of quorum with truffle: https://truffleframework.com/tutorials/building-da ...

  4. 区块链学习5:智能合约Smart contract原理及发展历程科普知识

    ☞ ░ 前往老猿Python博文目录 ░ 一.智能合约的定义 通俗来说,智能合约就是一种在计算机系统上,当一定条件满足的情况下可被自动执行的合约,智能合约体现为一段代码及其运行环境.例如银行信用卡的自 ...

  5. 【翻译】A Next-Generation Smart Contract and Decentralized Application Platform

    原文链接:https://github.com/ethereum/wiki/wiki/White-Paper 当中本聪在2009年1月启动比特币区块链时,他同时向世界引入了两种未经测试的革命性的新概念 ...

  6. smart contract 知识点

    知识点 memory vs storage vs stack storage , where all the contract state variables reside. Every contra ...

  7. 【阿菜Writeup】Security Innovation Smart Contract CTF

    赛题地址:https://blockchain-ctf.securityinnovation.com/#/dashboard Donation 源码解析 我们只需要用外部账户调用 withdrawDo ...

  8. the security of smart contract- 1

    https://blog.zeppelin.solutions/the-hitchhikers-guide-to-smart-contracts-in-ethereum-848f08001f05 这个 ...

  9. Smart Contracts

    A smart contract is a computer code running on top of a blockchain containing a set of rules under w ...

随机推荐

  1. Java多线程入门中几个常用的方法

    一.currentThread()方法 currentThread方法就是返回当前被调用的线程. 该方法为一个本地方法,原码如下: /** * Returns a reference to the c ...

  2. 转载 单例(Singleton)模式)的误区

    在创建型模式中,单例(Singleton)模式和原型(Prototype)模式相对来说其用意更为简单明了.单例(Singleton)模式确保某类只有一个实例,且自行实例化并向整个系统提供这个实例:原型 ...

  3. APPlication,Session和Cookie的区别

    方法 信息量大小 保存时间 应用范围 保存位置 Application 任意大小 整个应用程序的生命期 所有用户 服务器端 Session 小量,简单的数据 用户活动时间+一段延迟时间(一般为20分钟 ...

  4. Codeforces1062B. Math(合数分解)

    题目链接:传送门 题目: B. Math time limit per test second memory limit per test megabytes input standard input ...

  5. some working learning总结学习(二)

    2. 读取excel上的测试用例和结果,成json格式,最终存到access数据库 结果如下: { : { 'Req_ID': 'Fqqqqq/qqqqq', 'Case_ID': 'ATC_LvPw ...

  6. 阿里java开发规范 强制约束

    http://news.51cto.com/art/201901/591018.htm  :阿里开发强制要求的11条索引创建规范,提高性能 https://blog.csdn.net/Lujunwei ...

  7. UEFI+GPT双硬盘安装Win10+Ubuntu16.04双系统

    转载请注明出处:http://www.cnblogs.com/willnote/p/6725594.html 安装环境 SSD+HDD双盘,Win10安装在SSD里,HDD分出来60G安装Ubuntu ...

  8. 【转载】Win10系统桌面右键新建没有Word、Excel、PPT怎么恢复?

    Win10系统桌面右键新建没有Word.Excel.PPT怎么恢复? 以下正文转载至: 网址:http://www.xitongzhijia.net/xtjc/20170307/93471.html ...

  9. windows server 修改远程桌面连接端口号

    1. [运行]输入 regedit 2.  在注册表编辑器中找到以下PortNamber键,改为要使用的远程端口,如10000. HKEY_LOCAL_MACHINE\SYSTEM\CurrentCo ...

  10. 通过 JDK 自带的 javap 命令查看 SynchronizedDemo 类的相关字节码信息

    首先切换到类的对应目录执行 javac SynchronizedDemo.java 命令生成编译后的 .class 文件 然后执行 javap -c -s -v -l SynchronizedDemo ...