From 5f765317c0bca7faee3532f971639d97e8b35dbd Mon Sep 17 00:00:00 2001
From: Peter Cheng <teed7334@gmail.com>
Date: Sat, 8 Jun 2019 11:38:50 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AA=AA=E6=98=8E=E6=96=87?=
 =?UTF-8?q?=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 README.md | 174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 174 insertions(+)
 create mode 100644 README.md

diff --git a/README.md b/README.md
new file mode 100644
index 0000000..c2f126a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,174 @@
+# eosio-ipfs
+EOSIO + IPFS 蝘����翰�毺���𣂼膥
+
+## 鞈��坔冗蝯鞉��
+
+## 敹�����𦯀辣
+�𧋦蝟餌絞�誯�𥟠ocker��䕸ocker-Compose����鞟兛憓�嚗諹�见��身蝵桀末EOSIO + IPFS
+
+## EOSIO 蝘����沲閮剜�蝔�
+1. �脣�亙捆�膥
+```
+docker exec -it nodeos bash
+```
+
+2. �鰵憓鮋椙��
+```
+cleos wallet create --file ~/wallet.passwd
+```
+
+3. ��见�罸椙��
+```
+cleos wallet open
+```
+
+4. �䰻��讠𤌍��滚楛��见�罸椙��
+```
+cleos wallet list
+```
+
+5. 閫��㚚椙��嚗��蝣澆銁~/wallet.passwd瑼娍��葉
+```
+cleos wallet unlock
+```
+
+6. �𥲤�亥身摰𡁏�𥪯葉蝘��麯嚗𣬚��麯�銁/mnt/dev/config/config.ini銝哨�諹ㄐ�𢒰��signature-provider嚗䔶�见���煾�䠷�羓��麯�糓5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
+```
+cleos wallet import --private-key 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
+```
+
+7. �鰵憓硺�峕�𠰴鉄隞乩�羓��祇麯嚗𣬚�厩�㗇鰵憓墧��摱��閬��鍂��
+```
+cleos wallet create_key
+```
+
+8. �䰻��见虾�鍂���祉��麯
+```
+cleos wallet private_keys
+```
+
+9. �鰵憓墧��摱撣唾��
+```
+cleos create account eosio [���摱撣唾�篏 [���摱�祇麯]
+```
+
+10. �䰻��𧢲��摱�虾�鍂鞈���
+```
+cleos get account [���摱撣唾�篏
+```
+
+## �兛撖� Hello World �惣�賢���
+1. Hello World
+```
+#include <eosio/eosio.hpp>
+
+using namespace eosio;
+
+class [[eosio::contract]] helloworld : public contract {
+    public:
+        using contract::contract;
+
+    [[eosio::action]]
+    void hi(name user) {
+        print("Hi! ", user, " Hello World!!!");
+    }
+};
+```
+
+2. 蝺刻陌�惣�賢���
+```
+eosio-cpp -abigen -o [�惣�賢������銁鞈��坔冗]/helloworld.wasm [�惣�賢������銁鞈��坔冗]/helloworld.cpp
+```
+
+3. �䰻��见虾�鍂�祇麯
+```
+cleos wallet keys
+```
+
+4. �鰵憓𧼮董��毺䔄撣��惣�賢���嚗袏OS�訜銝哨�䔶��见董��笔蘨�賜䔄雿��隞賣惣�賢���
+```
+cleos create account eosio [���摱撣唾�篏 [���摱�祇麯] -p eosio@active
+```
+
+5. �䔄雿�惣�賢���
+```
+cleos set contract [�惣�賢�����滨迂] [�惣�賢����銁撅祈���坔冗] -p [���摱撣唾�篏@active
+```
+
+6. 隤輻鍂�惣�賢���嚗諹矽�鍂�惣�賢�������𠰴�����銝滩�賢�䔶�鈭�
+```
+cleos push action [�惣�賢�����滨迂] [隤輻鍂�� Action] '[[隞��亙��彍]]' -p [���摱撣唾�篏@active
+```
+
+## �兛撖怨���䠷𩑈��笔�脣�䀹惣�賢���
+1. 銝𠰴�單�枏㨃��䁅����
+```
+#include <eosio/eosio.hpp>
+
+using namespace eosio;
+
+class [[eosio::contract("punchclock")]] punchclock : public eosio::contract {
+	public:
+		punchclock(name receiver, name code,  datastream<const char*> ds): contract(receiver, code, ds) {}
+
+		[[eosio::action]] //�鰵憓噼����
+		void add(std::string punchTime, std::string doorNo, std::string cardNo, std::string identify, name user) {
+			require_auth(user);
+			punchListIndex lists(get_self(), get_first_receiver().value);
+			lists.emplace(user, [&](auto& row) {
+				row.id = lists.available_primary_key();
+				row.creater = user.value;
+				row.punchtime = punchTime;
+				row.doorno = doorNo;
+				row.cardno = cardNo;
+				row.identify = identify;
+			});
+		}
+
+		[[eosio::action]] //�⏛�膄鞈���
+		void remove(uint64_t id, name user) {
+			require_auth(user);
+			punchListIndex lists(get_self(), get_first_receiver().value);
+			auto iterator = lists.find(id);
+			check(iterator != lists.end(), "Record does not exist");
+			lists.erase(iterator);
+		}
+		
+		[[eosio::action]]
+		void get(std::string identify, name user) {
+		    require_auth(user);
+		    punchListIndex lists(get_self(), get_first_receiver().value);
+		    auto iterator = lists.begin();
+		    while(iterator != lists.end()) {
+		        if (identify == iterator->identify) {
+		            print(iterator->identify);
+		        }
+		    }
+		}
+
+	private:
+		struct [[eosio::table]] punchList { //punchList鞈��躰”
+			uint64_t id;
+			uint64_t creater;
+			std::string punchtime;
+			std::string doorno;
+			std::string cardno;
+			std::string identify;
+			uint64_t primary_key() const { return id; }
+			uint64_t get_secondary_1() const { return creater; }
+		};
+		typedef eosio::multi_index<"punchclock"_n, punchList,
+		    indexed_by<"bycreater"_n, const_mem_fun<punchList, uint64_t, &punchList::get_secondary_1>>
+		> punchListIndex;
+};
+```
+
+2. 隤輻鍂�惣�賢���
+```
+cleos push action punchclock add '["2019-06-08 11:28:00", "A01", "ABCDEFG", "00001", "bob"]' -p bob@active
+```
+
+3. �䰻��讠�帋�𡃏���坔澈
+```
+root@a9e45804cee8:~/contracts# cleos get table [���摱撣唾�篏 [銝𢠃������摱撣唾�篏 [鞈��躰”��䓞
+```
-- 
2.18.1