澳门威利斯人_威利斯人娱乐「手机版」

来自 威利斯人娱乐 2020-02-03 07:32 的文章
当前位置: 澳门威利斯人 > 威利斯人娱乐 > 正文

以太坊生态系统中的工具和技术

介绍三个EOS Chain/Wallet RPC API的PHP开采包。

用作我们Block Producer对社区利润的许诺的豆蔻梢头局地,大家愿意专心于构建有利于增加EOS平台采纳率的工具/应用程序。与多数重型应用程序相符,当你唯有微量或过时的文书档案何况缺少工具来援助你实行入门学习时,恐怕就能够设有超级高的进去门槛。

万豆蔻年华你是以太坊区块链的新手,那么您可能会惊惶,并意欲询问以太坊生态系统中的全数工具和技艺。由此,作者说了算在起先攻读以太坊时差不离描述下你平日遇上的各样零件。希望那将推动你到家了然以太坊生态系统以致全数片段怎样构成在同步。

开始

你可以查阅EOS的RPC API参考,但要注意贫乏一些较新的不二诀要。Wallet RPC API完结EOS v1.1.0 of RPC API reference。别的,那一个文书档案中的一些演示也应用了不适此时候宜的语法。

安装

composer require manamine/php-eos-rpc-sdk

配置

选择你最怜爱的RPC API主机和KEOSD在类型根目录中开创叁个dotenv.env文本。你能够选择env.example用作模板:

cp .env.example .env

有贰个完美的工厂方法来自动化实例全数注重项:

$api = (new ChainFactory)->api();$walapi = (new WalletFactory)->api();$eos = (new EosRpc($api, $walapi));

示例

为了帮扶您入门,运维二个简短的示范,它富含了全体API命令。

只需通过cli运转此命令就可以查看全体命令的亲自过问输出:

cd examplesphp chain.phpphp wallet.phpphp eosrpc.php

为了节省刚入门的EOS开荒职员一些时刻,大家收拾了二个PHP SDK,它饱含了绝大多数EOS的API方法。在文书档案中,每一个调用都有点示范,个中储存API的实在出口。

1.以太坊

以太坊是两个智能合约区块链,你可以在其上创设去核心化的应用程序。假设您是技能行家,本蓝皮书值得风度翩翩读:

假诺你从前已经塑造了Web应用程序,小编写了生机勃勃篇作品,相比较以太坊区块链和Web应用程序布局,那也许有利于在越来越高档次上驾驭以太坊。

API方法

包涵了大约全部区块链和卡包API方法。

Get Info

赢得与节点相关的流行音信

echo $api->getInfo();

Get Block

收获与区块相关的音信

echo $api->getBlock;

Get Block Header State

获得与身形状态相关的音讯

echo $api->getBlockHeaderState("0016e48707b181d93117b07451d9837526eba34a9a37125689fb5a73a5d28a38");

Get Account

获取与帐户相关的音讯

$api->getAccount("blockmatrix1");

Get Code

得到智能合约代码

echo $api->getCode("eosio.token");

Get Table Rows

从帐户中得到智能合约数量

echo $api->getTableRows("eosio", "eosio", "producers", ["limit" => 10]);

Get Currency Balance

收获帐户的钱币余额

echo $api->getCurrencyBalance("eosio.token", "eosdacserver");

Get Currency Stats

拿到货币状态

echo $api->getCurrencyStats("eosio.token", "EOS");

Get ABI

获得账户ABI

echo $api->getAbi("eosio.token");

Get Raw Code and ABI

获取原生代码和ABI

echo $api->getRawCodeAndAbi("eosio.token");

Get Producers

列出坐褥者

echo $api->getProducers;

ABI JSON To Bin

将json体系化为二进制十八进制

echo $api->abiJsonToBin("eosio.token", "transfer", ["blockmatrix1", "blockmatrix1", "7.0000 EOS", "Testy McTest"]);

ABI Bin To JSON

将二进制十八进制系列化为json

echo $api->abiBinToJson("eosio.token", "transfer", "10babbd94888683c10babbd94888683c701101000000000004454f53000000000c5465737479204d6354657374");

Get Required Keys

得到签定交易所需的密钥

echo $api->getRequiredKeys( [ "expiration" => "2018-08-23T05.00.00", "ref_block_num" => 15078, "ref_block_prefix" => 1071971392, "max_net_usage_words" => 0, "delay_sec" => 0, "context_free_actions" => [], "actions" => [ [ "account" => "eosio.token", "name" => "transfer", "authorization" => [ [ "actor" => "user", "permission" => "active" ] ], "data" => "00000000007015d6000000005c95b1ca102700000000000004454f53000000000c757365722d3e746573746572" ] ], "transaction_extensions" => [] ], [ "EOS7ijWCBmoXBi3CgtK7DJxentZZeTkeUnaSDvyro9dq7Sd1C3dC4" ] );

Push Transaction

付出推送三个交易

echo $api->pushTransaction("2018-08-23T05:29:39", "15780", "90170226", [ "actions" => [ [ "account" => "eosio.token", "name" => "transfer", "authorization" => [ [ "actor" => "user", "permission" => "active" ] ], "data" => "00000000007015d6000000005c95b1ca102700000000000004454f53000000000c757365722d3e746573746572" ] ], "signatures" => [ "SIG_K1_KaGHyi59BRqfaDUK6424TYEWcUhWxAG7BLCgYC8vwYNgaHgGLpduTUbNQEsfL8xLzboK8W9T2X69bNpqozTQVCbRSNJWFd" ] ]);

Push transactions

付给推送一些交易

echo $api->pushTransactions( [ [ "compression" => "none", "transaction" => [ "expiration" => "2018-08-23T06:27:26", "ref_block_num" => 22017, "ref_block_prefix" => 3920123292, "context_free_actions" => [], "actions" => [ [ "account" => "eosio.token", "name" => "transfer", "authorization" => [ [ "actor" => "user", "permission" => "active" ] ], "data" => "00000000007015d6000000005c95b1ca102700000000000004454f53000000000c757365722d3e746573746572" ] ], "transaction_extensions" => [] ], "signatures" => [ "SIG_K1_JzN9DnpyhKfjoef3C2TZBTPA5b6ftwuEBnBpvzkueVXThJ34PFFpUFgqyayfXjeLRc15JmZmDiMYAFX99hUgX8vkGAYcnx" ] ], [ "compression" => "none", "transaction" => [ "expiration" => "2018-08-23T06:27:26", "ref_block_num" => 22017, "ref_block_prefix" => 3920123292, "context_free_actions" => [], "actions" => [ [ "account" => "eosio.token", "name" => "transfer", "authorization" => [ [ "actor" => "tester", "permission" => "active" ] ], "data" => "000000005c95b1ca00000000007015d6881300000000000004454f53000000000c7465737465722d3e75736572" ] ], "transaction_extensions" => [] ], "signatures" => [ "SIG_K1_KZ2M4AG59tptdRCpqbwzMQvBv1dce5btJCJiCVVy96fTGepApGXqJAwsi17g8AQdJjUQB4R62PprfdUdRYHGdBqK1z9Sx9" ] ] ]);

任由你是或不是利用PHP,大家都期望这将是二个卓有作用的参谋点,能够起来创设你的第一个应用程序,可能只是掌握EOS区块链API提供的内容可以。

2.Geth

Geth是以太坊基金会提供的法定客户端软件。它是用Go编制程序语言编写的。该软件满含部分值得驾驭的组件:

  • 客户端守护程序

当您运维此客商端守护程序时,它将再三再四到网络中的其他客商端并下载区块链的别本。它将不断与其余节点通讯,以使其区块链的别本保持最新。它仍是能够够发掘块并向区块链增加交易,验证块中的交易并实行交易。它还经过公开能够由此RPC与之互相的API充任服务器。

图片 1image

  • geth控制台

那是一个命令行工具,可令你连接纳正在运作的节点,并实践各类操作,如创设和治本帐户,查询区块链,签订并向区块链提交交易等。

  • mist浏览器

那是用以与节点通讯的桌面应用程序。你选择geth调控台实践的别样操作都能够经过此图形顾客分界面达成。

钱包 Wallet APIs

Create

创制具备给定名称的新钱袋

echo $walapi->create("testwallet");

Open

开拓给定称号的幸存零钱袋

echo $walapi->open("testwallet");

Lock

锁定给定称号的依存钱包

echo $walapi->lock("testwallet");

Lock All

锁定全数现成卡包

echo $walapi->lockAll();

Unlock

动用给定的称谓和密码解锁钱袋

echo $ walapi-> unlock([“testwallet”,“PW5Jb8RAZP6CBjjMLPser3T8i8k9hZXZkMBJ8kb1p6f6hAg2n68jY”]);

Import Key

将私钥导入给定名称的钱袋

echo $walapi->importKey(["testwallet", "5Jmsawgsp1tQ3GD6JyGCwy1dcvqKZgX6ugMVMdjirx85iv5VyPR"]);

Remove Key

从给定名称的钱袋中剔除密钥对

echo $walapi->removeKey(["testwallet", "PW5Jb8RAZP6CBjjMLPser3T8i8k9hZXZkMBJ8kb1p6f6hAg2n68jY", "EOS7ijWCBmoXBi3CgtK7DJxentZZeTkeUnaSDvyro9dq7Sd1C3dC4"]);

Create Key

始建密钥对并导入

echo $walapi->createKey(["testwallet", "K1"]);

List Wallets

列出全部钱袋

echo $walapi->listWallets();

List Keys

列出给定称号和密码的卡包中的全数密钥对

echo $walapi->listKeys(["testwallet", "PW5Jb8RAZP6CBjjMLPser3T8i8k9hZXZkMBJ8kb1p6f6hAg2n68jY"]);

Get Public Keys

列出具备卡包中的全部公钥

echo $walapi->getPublicKeys();

Set Timeout

安装钱袋活动锁定超时

echo $walapi->setTimeout;

Sign Transaction

签字贸易

echo $walapi->signTransaction( [ "expiration" => "2018-08-23T06:35:30", "ref_block_num" => 22985, "ref_block_prefix" => 3016594541, "max_net_usage_workds" => 0, "delay_sec" => 0, "context_free_actions" => [], "actions" => [ [ "account" => "eosio.token", "name" => "transfer", "authorization" => [ [ "actor" => "user", "permission" => "active" ] ], "data" => "00000000007015d6000000005c95b1ca102700000000000004454f53000000000c757365722d3e746573746572" ] ], "transaction_extensions" => [] ], [ "EOS7ijWCBmoXBi3CgtK7DJxentZZeTkeUnaSDvyro9dq7Sd1C3dC4" ], "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f");

您可以查看EOS官方文书档案,但要注意缺乏一些较新的秘诀。此外,那几个文书档案中的一些演示使用了不适那个时候候宜的语法。

3.Parity

Parity是以太坊磋商的另一个很好的得以完结,用Rust编制程序语言编写。它是一个野鸡的顾客端,由一家名称叫Parity Inc.的商场维护。任何人都足以实现客商端软件并参与以太坊网络。你可以依据本红皮书中的标准来实施你协调的客商端!

图片 2image

本文由澳门威利斯人发布于威利斯人娱乐,转载请注明出处:以太坊生态系统中的工具和技术

关键词: 接口 开发包 Wallet Chain