Re-war EOS contract _eos

Source: Internet
Author: User
Tags mongodb

You're great as master.

You gairen you change, I'll start over.

Because the Master contract command line parameter has been modified again, try again.

2018.4.2 Day Update, compare GitHub document TUTORIAL.MD

Environment configuration skipped, execute the eosio_build.sh under the EOS directory it will configure its own environment, mongodb the pit, here is not filled.

./eosio_build.sh

It will appear after success

[100%] Built target Nodeos ___ _____  _________ _____
	(___  ) (  ____ \\__   __/(  ___  )
	| (    \/| (   ) || (    \/   ) (   | (   ) |
	| (__    | |   | || (_____    | |   | |   | |
	|  __)   | |   | | (_____  )   | |   | |   | |
	| (      | |   | |      ) |   | |   | |   | |
	| (____/\| (___) |/\____) |___) (___| (___) |
	(_______/) \_______) \_______/(___)

	EOS. IO has been successfully built. 0:4:35 to

	verify your installation run following commands:/home/feng/opt/mongodb/bin/mongod-f

	/home/ Feng/opt/mongodb/mongod.conf & Cd/home/feng/eos/build make test for the more

	information:
	EOS. IO Website:https://eos.io
	Eos. IO Telegram Channel @ https://t.me/EOSProject
	EOS. IO resources:https://eos.io/resources/
	Eos. IO Wiki:https://github.com/eosio/eos/wiki

To the Nodes directory

CD build/programs/nodeos/
mkdir data-dir config-dir
CP. /.. /genesis.json config-dir/
CP. /.. /.. /.. /config.ini config-dir/

Here is not a detailed introduction, you can go to see an introduction

A little bit more config.ini.

# Track only transactions whose scopes involve the listed accounts. The Default is to track all transactions. (eosio::account_history_plugin) # filter_on_accounts = # Limits The maximum time (in milliseconds) processing a single G Et_transactions call. (eosio::account_history_plugin) Get-transactions-time-limit = 3 # File to read Genesis state from (Eosio::chain_plugin) G Enesis-json = "Genesis.json" # Override the initial timestamp in the Genesis state file (eosio::chain_plugin) # genesis-t Imestamp = # The location of the "block log" (absolute path or relative to Application Data dir) (Eosio::chain_plugin) Blo Ck-log-dir = "Blocks" # pairs of [block_num,block_id] that should is enforced as checkpoints. (eosio::chain_plugin) # checkpoint = # Limits The maximum time (in milliseconds) that's a reversible the block are allowed to R UN before being considered invalid (eosio::chain_plugin) Max-reversible-block-time =-1 # Limits The maximum time (in mil Liseconds) is allowed a pushed transactiOn ' s code to execute before being considered invalid (eosio::chain_plugin) Max-pending-transaction-time =-1 # time to WA It, in milliseconds, between creating next faucet created account. (eosio::faucet_testnet_plugin) Faucet-create-interval-ms = 1000 # Name to use as creator for faucet created. (eosio::faucet_testnet_plugin) faucet-name = faucet # [public key, WIF private key] for signing for faucet creator T (eosio::faucet_testnet_plugin) Faucet-private-key = ["EOS6MRYAJQQ8UD7HVNYCFNVPJQCVPSCN5SO8BHTHUGYQET5GDW5CV", " 5kqwrpbwdl6phxujxw37fssqz1jiwsst4cqqzdeyxtp79zkvfd3 "] # The local IP and port to listen for incoming HTTP connections. (eosio::http_plugin) http-server-address = 127.0.0.1:8888 # Specify the Access-control-allow-origin to is returned on EAC H request. (eosio::http_plugin) # access-control-allow-origin = # Specify the access-control-allow-headers to is returned on each R Equest. (eosio::http_plugin) # access-control-allow-headers = # Specify if access-control-allow-credentials:true should is returned on the each request. (eosio::http_plugin) Access-control-allow-credentials = False # The actual host:port used to listen for incoming Peer-to-peer conn Ections. (eosio::net_plugin) P2p-listen-endpoint = 0.0.0.0:9876 # A externally accessible host:port for identifying to this node. Defaults to P2p-listen-endpoint. (eosio::net_plugin) # p2p-server-address = # The public endpoint's a peer node to connect to. Use multiple p2p-peer-address the options as needed to compose a network. (eosio::net_plugin) # p2p-peer-address = # The name supplied to identify this node amongst the peers. (eosio::net_plugin) Agent-name = "EOS Test Agent" # Can is ' any ' or ' producers ' or ' specified ' or ' none '. If ' specified ', Peer-key must is specified at least once. If only ' producers ', Peer-key are not required. ' Producers ' and ' specified ' may be combined.  (eosio::net_plugin) allowed-connection = any # Optional public key of peer allowed to connect. May is used multiple TIMEs. (eosio::net_plugin) # Peer-key = # Tuple of [PublicKey, WIF private key] (may specify multiple times) (Eosio::net_plugin # peer-private-key = # Log Level:one of ' All ', ' Debug ', ' info ', ' warn ', ' error ', or ' off ' (eosio::net_plugin) Log-lev El-net-plugin = info # Maximum number of clients from which connections are-accepted, use 0 for No limit (eosio::net_plug IN) max-clients = + # Number of seconds to wait before cleaning up dead connections (Eosio::net_plugin) Connection-clean Up-period = # True to require exact match of peer network version. (eosio::net_plugin) network-version-match = 0 # Number of blocks to retrieve into a chunk from any individual peer during s Ynchronization (eosio::net_plugin) Sync-fetch-span = # Enable block production, even if the chain is stale.  (Eosio::p roducer_plugin) enable-stale-production = true # Percent of producers (0-99) that must is participating in order To produce blocks (Eosio::p roducer_plugin) #required-participation = False # ID of producer controlled by this node (e.g. Inita/May specify multiple times) (Eosio::p roducer_plugin) Producer-name = Eosio # Tuple of [public key, WIF private key] (may specify multiple times) (Eosio::p roducer_plugin) Private-key = ["EOS6 MRYAJQQ8UD7HVNYCFNVPJQCVPSCN5SO8BHTHUGYQET5GDW5CV "," 5kqwrpbwdl6phxujxw37fssqz1jiwsst4cqqzdeyxtp79zkvfd3 "] # Plugin (s) to enable, May is specified multiple times # Load the blocks producer Plugin, so you can produce blocks = Eosio::p roducer_plugin # Wallet Plugin plugin = Eosio::wallet_api_plugin # as as, API and HTTP plugins plugin = EO   Sio::chain_api_plugin plugin = Eosio::http_plugin

Running nodes, the document adds some plug-in parameters

New command line

Cd.. /cleos/

To create a wallet, this private key should be kept well and will not be present in the future, each time you open the wallet. After you close the client, reopen the wallet.

feng@feng-b250-hd3p:~/workspace/eos/build/programs/cleos$./cleos Wallet Create
creating Wallet:default
Save password to with the future to unlock this wallet.
Without password imported keys, won't be retrievable.
Pw5jih9u9ofcxlh62yjhcjy1ibrxfzen6fka1pmqywuxmjqgxmjqq "

Unlock Wallet

feng@feng-b250-hd3p:~/workspace/eos/build/programs/cleos$./cleos Wallet Unlock--password PW5JIH9U9OFCXLH62YJHCJY1IBRXFZEN6FKA1PMQYWUXMJQGXMJQQ
Unlocked:default

Import the private key of the test account, this private key is for Eosio account test contract

./cleos Wallet Import 5kqwrpbwdl6phxujxw37fssqz1jiwsst4cqqzdeyxtp79zkvfd3

The point is, here must be done in the Cleos directory, do not use Cloes.

feng@feng-b250-hd3p:~/workspace/eos/build/programs/cleos$./cleos set contract Eosio. /.. /contracts/eosio.bios-p eosio
Reading wast ...
Assembling WASM
... Publishing Contract
...         Executed transaction:ecc149bfbd77f5fc87791a1b86a6310a4daf169434084fcc3bb289a4cd6c94d1 4068 bytes 10000 cycles
# Eosio <= Eosio::setcode {"Account": "Eosio", "Vmtype": 0, "vmversion": 0, "code": "0061736d0100000001ab011
960037f7e7f0060057f7e7e7e ... # Eosio <= Eosio::setabi {"Account": "Eosio", "Abi": {"Types": [], "structs": [{"Name": "Set_account_li MITs "," Base ":" "," Fields ": [{] n ...
feng@feng-b250-hd3p:~/workspace/eos/build/programs/cleos$./cleos Create key
Private key: 5JO5M9MXS7XZWRCWJDY1QVRMWXITE4MOURX9WAJLJUA8WD1LRJX Public
Key: Eos5a7fk4raq2fzdwy5ttrdhmchpzqxwyolqvczqhhpcgsjofdskk
feng@feng-b250-hd3p:~/workspace/eos/build/programs/cleos$./cleos Wallet Import 5JO5M9MXS7XZWRCWJDY1QVRMWXITE4MOURX9WAJLJUA8WD1LRJX
imported private key for: Eos5a7fk4raq2fzdwy5ttrdhmchpzqxwyolqvczqhhpcgsjofdskk

Now let's test to see if the--plugin eosio::account_history_api_plugin plugin is normal.

Create two accounts based on the public key and then display the account number according to the public key.

feng@feng-b250-hd3p:~/workspace/eos/build/programs/cleos$./cleos Create account Eosio user
EOS5A7FK4RAQ2FZDWY5TTRDHMCHPZQXWYOLQVCZQHHPCGSJOFDSKK EOS5A7FK4RAQ2FZDWY5TTRDHMCHPZQXWYOLQVCZQHHPCGSJOFDSKK Executed transaction:ba059a60a5dfd30372f9ccf345b83954e40ea8a31221b4903570f1c2eae042ef  364 bytes  1000 Cycles #         eosio <= eosio::newaccount            {"creator
": Eosio", "Name": "User", "owner": {"threshold": 1, "Keys": [{"Key": "EOS5A7FK4RAQ2FZDWY5TTRDHMCHP ... feng@feng-b250-hd3p:~/workspace/eos/build/programs/cleos$./cleos Get Accounts EOS5A7FK4RAQ2FZDWY5TTRDHMCHPZQXWYOLQVCZQHHPCGSJOFDSKK {  "account_names": [    "user"  ]} FENG@FE ng-b250-hd3p:~/workspace/eos/build/programs/cleos$./cleos Create account Eosio Tester
EOS5A7FK4RAQ2FZDWY5TTRDHMCHPZQXWYOLQVCZQHHPCGSJOFDSKK EOS5A7FK4RAQ2FZDWY5TTRDHMCHPZQXWYOLQVCZQHHPCGSJOFDSKK Executed Transaction:b9b6f6619993a342dd6dfc2819d7b649ef95e386223b5ea19aa74a80592d1f26  364 bytes  1000 cycles #         eosio <= eosio::newaccount  &nbs P         {"creator": "Eosio", "name": "Tester", "owner": {"threshold": 1, "Keys": [{"Key": " EOS5A7FK4RAQ2FZDWY5TTRDHMC feng@feng-b250-hd3p:~/workspace/eos/build/programs/cleos$./cleos Get Accounts eos5a7fk4raq2fzdwy5ttrdhmchpzqxwyolqvczqhhpcgsjofdskk{  "Account_names": [    "tester",     ' User '  ]}

The following test token contract, first to create a token account (easy to copy behind the code)

feng@feng-b250-hd3p:~/workspace/eos/build/programs/cleos$./cleos Create account Eosio Eosio.token EOS5A7FK4RAQ2FZDWY5TTRDHMCHPZQXWYOLQVCZQHHPCGSJOFDSKK EOS5A7FK4RAQ2FZDWY5TTRDHMCHPZQXWYOLQVCZQHHPCGSJOFDSKK
executed transaction:f5aa4e46d4e82187ea8f892aea9a0a170c1fb3433541e40ffe5e3cefda552710 364 bytes 1000 Cycles
# Eosio <= eosio::newaccount {"creator": "Eosio", "name": "Eosio.token", "owner": {"threshold": 1, "Ke Ys ": [{" Key ":" Eos5a7fk4raq2fzdwy5tt ...

Deployment contract

feng@feng-b250-hd3p:~/workspace/eos/build/programs/cleos$./cleos set contract Eosio.token. /.. /contracts/eosio.token-p eosio.token
Reading wast ...
Assembling WASM
... Publishing Contract
... Executed transaction:79b956d0c8e0a55a7e1e54a092c078dd84fb1267c0ed2630cce3f41b3fd03477  8708 bytes  10000 Cycles
#         Eosio <= eosio::setcode               {"Account": "Eosio.token", "Vmtype": 0, "vmversion": 0, "code": "
0061736d0100000001ce011d60067f7e7f7f7f7f00 ... #         Eosio <= eosio::setabi                {"Account": "Eosio.token", "Abi": {"Types": [], "structs": [{"Name": "Transfer", " Base ': ', ' Fields ': [{' Name ' ...]


Create a currency, here's a shorthand for the last shorthand

feng@feng-b250-hd3p:~/workspace/eos/build/programs/cleos$./cleos Push action Eosio.token create ' [Eosio ', ' 1000000000.0000 EOS ", 0, 0, 0] '-p eosio.token
executed transaction: beab32c6347582d363ce53bebfd973fafd3c7c971741f41499a049b6b599c501 bytes 1000 Cycles
# Eosio.token <=. token::create {"Issuer": "Eosio", "maximum_supply": "1000000000.0000 EOS", "Can_freeze": 0, "Can_recall": 0, "Can_whitel Is .....

Here's the whole.

$./cleos Push Action Eosio.token create ' {"Issuer": "Eosio", "maximum_supply": "1000000000.0000 EOS", "Can_freeze": 0, " Can_recall ": 0," Can_whitelist ": 0} '-P eosio.token
executed transaction: 0e49a421f6e75f4c5e09dd738a02d3f51bd18a0cf31894f68d335cd70d9c0e12  bytes  1000 cycles
#   Eosio.token <= eosio.token::create          {"Issuer": "Eosio", "maximum_supply": "1000000000.0000 EOS", "Can_freeze": 0 , "Can_recall": 0, "Can_whitelis ...

Issue currency to account

feng@feng-b250-hd3p:~/workspace/eos/build/programs/cleos$./cleos Push Action Eosio.token issue ' [user ', ' 100.0000  EOS "," Memo "] '-p eosio
executed transaction:23f79c2ab797ac04dce6cf9c5bc0b150bf3949aafbeb9a199e6a20eed8bd7043 268 bytes 1000 Cycles # Eosio.token <= eosio.token::issue
{"To": "User", "Quantity": "100.0000 EOS", "Memo ': ' Memo '}
>> issue
# Eosio.token <= eosio.token::transfer {' from ': ' Eosio ', ' to ': ' User ', ' quantity ' : "100.0000 EOS", "Memo": "Memo"}
>> transfer
# Eosio <= eosio.token::transfer {"from": "Eosio "," to ":" User "," Quantity ":" 100.0000 Eos "," Memo ":" Memo "}
# User <= Eosio.token::transfer {' from ': ' EOS Io "," to ":" User "," Quantity ":" 100.0000 EOS "," Memo ":" Memo "}

Let's add-d-j and try again and look at transaction's JSON.

feng@feng-b250-hd3p:~/workspace/eos/build/programs/cleos$ ./cleos Push Action Eosio.token issue ' [user ', ' 100.0000 EOS "," Memo "] '-p eosio-d-j{ " expiration ":" 2018-04-02t08:12:50 ",  " region ": 0,  " Ref_block " _num ": 2718,  " Ref_block_prefix ": 2053470162,  " net_usage_words ":",   "Kcpu_usage": 1000,   "delay _sec ": 0,  " context_free_actions ": [],  " actions ": [{     " account ":" Eosio.token ",   &N Bsp   "name": "Issue",       "Authorization": [{ ,         "actor": "Eosio", &nbs P       "permission": "Active"                ,     &NB Sp "Data": "00000000007015d640420f000000000004454f5300000000046d656d6f"    }  ],   "signatures": [& nbsp
  "EOSJVRYS9TQRTNRX1B5RFLJIYUT8HCSRT2KRDDVOCGUKBSMVSTEP3DZZCEQMGQJDWMPFRCKDJLBB7GJSA8KSCVNMDZDUZ2AE1"  ],   "context_free_dATA ": [] 

Transfer

feng@feng-b250-hd3p:~/workspace/eos/build/programs/cleos$./cleos Push Action Eosio.token issue ' [user ', ' 100.0000 EOS "," Memo "] '-p eosio
executed transaction:75bdcd8b3f4eeb0dbdd1135a4d20b249edbed3fda9c5baaaefe7106799ea3a74  268 bytes  1000 cycles # eosio.token <= eosio.token::issue   {"           to": "User", "Quantity": " 100.0000 EOS "," Memo ":" Memo "}
>> issue
#   Eosio.token <= eosio.token::transfer        {" from ":" Eosio "," to ":" User "," Quantity ":" 100.0000 EOS "," Memo ":" Memo "}
>> transfer
# Eosio <=         Eosio.token::transfer        {"from": "Eosio", "to": "User", "Quantity": "100.0000 EOS", "Memo": "Memo"}
#          User <= Eosio.token::transfer        {"from": "Eosio", "to": "User", "Quantity": "100.0000 EOS", "Memo": "Memo"}

Modify the contract, note that all the account created here key, are from the Create./cleos Create key

feng@feng-b250-hd3p:~/workspace/eos/build/programs/cleos$./cleos Create Account Eosio ex
EOS5A7FK4RAQ2FZDWY5TTRDHMCHPZQXWYOLQVCZQHHPCGSJOFDSKK EOS5A7FK4RAQ2FZDWY5TTRDHMCHPZQXWYOLQVCZQHHPCGSJOFDSKK Executed transaction:53d9e24496a4f031bea80a605d3ab1a86ba201f7f3cc2ab6dc56da20bb2f59c9  364 bytes  1000 Cycles #         eosio <= eosio::newaccount            {"creator
":" Eosio "," name ":" Ex "," owner ": {" threshold ": 1," Keys ": [{" Key ":" Eos5a7fk4raq2fzdwy5ttrdhmchpzq ... feng@feng-b250-hd3p:~/workspace/eos/build/programs/cleos$./cleos set contract ex.. /..
/contracts/exchange-p ex Reading Wast ...
Assembling WASM ... Publishing contract ... executed Transaction:dd5b6cbb29400006157df7e0af8eec026a3ddd0ea71a3aea018a5a5f868a0be8   35180 bytes  10000 cycles #         eosio <= eosio::setcode      &N Bsp        {"account": "Ex", "Vmtype": 0, "vmversion": 0, "code": "0061736d0100000001f0023460067f7e7f7f7f7f0060037f7e7 ... #         eosio <= eosio::setabi    & nbsp           {"Account": "Ex", "Abi": {"Types": [{"New_type_name": "Account_name", "type": "Name"}],
 ' Structs ': [{' name ': ' ...

EOS block chain QQ Group, welcome everyone a lot of technical exchanges: 695283188



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.