區塊鏈技術EOS開發系列之如何開發合約發行代幣

weixin_34321977發表於2017-08-07

我們以currency合約為例:


7637-c2e639614bfb338a.png

釋出合約:

➜  programs git:(master) ✗ ./eosc/eosc contract

ERROR: RequiredError: account

Create or update the contract on an account

Usage: ./eosc/eosc contract [OPTIONS] account wast-file [abi-file]

Positionals:

account TEXT                The account to publish a contract for

wast-file TEXT              The file containing the contract WAST

abi-file TEXT              The ABI for the contract

Options:

-h,--help                  Print this help message and exit

-a,--abi TEXT              The ABI for the contract

➜  programs git:(master) ✗ ./eosc/eosc contract  currency ../../contracts/currency/currency.wast ../../contracts/currency/currency.abi

更多命令:

➜  programs git:(master) ✗ ./eosc/eosc

ERROR: RequiredError: Subcommand required

Command Line Interface to Eos Daemon

Usage: ./eosc/eosc [OPTIONS] SUBCOMMAND

Options:

-h,--help                  Print this help message and exit

Subcommands:

create                      Create various items, on and off the blockchain

get                        Retrieve various items and information from the blockchain

contract                    Create or update the contract on an account

transfer                    Transfer EOS from account to account

benchmark                  Configure and execute benchmarks

push                        Push arbitrary data to the blockchain

➜  programs git:(master) ✗ ./eosc/eosc push

ERROR: RequiredError: Subcommand required

Push arbitrary data to the blockchain

Usage: ./eosc/eosc push SUBCOMMAND

Subcommands:

message                    Push a transaction with a single message

transaction                Push an arbitrary JSON transaction

transactions                Push an array of arbitrary JSON transactions

➜  programs git:(master) ✗ ./eosc/eosc push message

ERROR: RequiredError: contract

Push a transaction with a single message

Usage: ./eosc/eosc push message [OPTIONS] contract action data

Positionals:

contract TEXT              The account providing the contract to execute

action TEXT                The action to execute on the contract

data TEXT                  The arguments to the contract

Options:

-h,--help                  Print this help message and exit

-p,--permission TEXT ...    An account and permission level to authorize, as in 'account@permission'

-s,--scope TEXT=[] ...      An account in scope for this operation

合約轉賬

➜  programs git:(master) ✗ ./eosc/eosc push message currency transfer '{"from":"tester","to":"inita","quantity":50}' -s inita -s tester -p tester@active

更多文件:https://eosio.github.io/eos/group__contractdev.html

https://eosio.github.io/eos/group__eosc.html

大家可以通過一下方式跟蹤關注我:

github:https://github.com/philsong

微博:http://weibo.com/bocaicfa

本文是EOS技術研究系列的第五篇。

第一篇.Mac下的編譯:http://www.jianshu.com/p/f26ee4cf1d4a

第二篇.eosc命令列工具:http://www.jianshu.com/p/b2db966435d0

第三篇.appbase庫:http://www.jianshu.com/p/b7f0bbe89610

第四篇.chainbase庫與database_plugin外掛:http://www.jianshu.com/p/df835b574b52

第五篇.如何開發合約發行代幣:http://www.jianshu.com/p/5228da9c5631

7637-a5fdd9d94e6f99d5.jpg

圖片發自簡書App

7637-a5fdd9d94e6f99d5.jpg
圖片發自簡書App

相關文章