Ethereum testrpc
Publish: 2021-04-18 21:02:37
1. (1) Download the wallet software, install it, and close the wallet software after synchronizing data
(2) click system "start", "run", enter% appdata% in it, and then click OK (WIN XP and win7 systems both operate in this way), or press "win" key and "R" key at the same time to open the running interface
(3) after confirming the second step, open a file manager and display the interface as shown in the figure below. Find the folder named after the currency, litecoin. The data corresponding to the wallet software are all in this folder. Double click to open this folder
(4) configure the. Conf file
at the beginning, enter Notepad to confirm and open Notepad software, Input the following contents in it: ( the following code directly)
rpcuser = Test
rpcpassword = Test
rpcport = 11095
daemon = 1
server = 1
Gen = 0
testnet = 0
Listen = 0
maxconnections = 100
rpcallowip = 10.255.16. *
rpcuser, rpcpassword and rpcport can be modified or not, Rpcallowip needs to be modified according to your own situation. If your miner and wallet software are on the same machine, delete the line rpcallowip
after the file is modified, save it to the previous litecain directory with the file name of litecain.conf, or save it to the desktop, and then it
take the mining software cgminer as an example, modify the IP address of the pools part in the cgminer.conf file
URL part to the IP address of the machine where your wallet is located. Port 11095 is the port configured in litecain.conf just now. User and pass are the same, just keep consistent with the above configuration file< In addition, it is suggested to modify the values of the other two parameters as follows:
& quot; queue" : & quot; 0",< br />" scan-time" : & quot; 1",
after setting, run cgminer to start mining....
(2) click system "start", "run", enter% appdata% in it, and then click OK (WIN XP and win7 systems both operate in this way), or press "win" key and "R" key at the same time to open the running interface
(3) after confirming the second step, open a file manager and display the interface as shown in the figure below. Find the folder named after the currency, litecoin. The data corresponding to the wallet software are all in this folder. Double click to open this folder
(4) configure the. Conf file
at the beginning, enter Notepad to confirm and open Notepad software, Input the following contents in it: ( the following code directly)
rpcuser = Test
rpcpassword = Test
rpcport = 11095
daemon = 1
server = 1
Gen = 0
testnet = 0
Listen = 0
maxconnections = 100
rpcallowip = 10.255.16. *
rpcuser, rpcpassword and rpcport can be modified or not, Rpcallowip needs to be modified according to your own situation. If your miner and wallet software are on the same machine, delete the line rpcallowip
after the file is modified, save it to the previous litecain directory with the file name of litecain.conf, or save it to the desktop, and then it
take the mining software cgminer as an example, modify the IP address of the pools part in the cgminer.conf file
URL part to the IP address of the machine where your wallet is located. Port 11095 is the port configured in litecain.conf just now. User and pass are the same, just keep consistent with the above configuration file< In addition, it is suggested to modify the values of the other two parameters as follows:
& quot; queue" : & quot; 0",< br />" scan-time" : & quot; 1",
after setting, run cgminer to start mining....
2.
Generally speaking, the steps of deploying smart contract are as follows:
- start an Ethereum node (such as geth or testrpc) Li >
- use Solc to compile smart contracts=& gt; Get the binary code Li >
- deploy the compiled contract to the network This step will consume Ethernet currency, and you need to use the default address or specified address of your node to sign the contract.)=& gt; Get the blockchain address and ABI of the contract (JSON representation of the contract interface, including variables, events and callable methods) The author confused ABI with contract interface here. ABI is the binary representation of the contract interface.) Li >
- use the JavaScript API provided by web3.js to call the contract Depending on the type of call, it may consume Ethernet currency.) li>
3. Using Kushen cold wallet, the private key does not touch the net to ensure the security of assets
4. There is no inevitable relationship between whether the virtual currency will disappear or not and whether it can not be used on the third-party platform. Online third-party trading platform can only say that this kind of currency has another platform for trading, which shows that this kind of currency is more reliable
Ruitai coin has not been launched on the third-party platform, but it is rumored that it will also be launched on the third-party platform.
Ruitai coin has not been launched on the third-party platform, but it is rumored that it will also be launched on the third-party platform.
5. Truffle is a world-class development environment, testing framework, Ethereum resource management channel, dedicated to making Ethereum development easier, truffle has the following:
built in smart contract compilation, linking, deployment and binary file management
automatic contract testing under rapid development
scripted and extensible deployment and publishing framework
the network environment management function deployed to no matter how many public or private networks
uses the package management provided by ethpm & NPM and erc190 standard
a direct interactive console that communicates directly with the contract (after writing the contract, you can verify it on the command line)
the configurable construction process supports tight integration
external scripts can be executed in truffle environment< Truffle is the most popular development framework, whose mission is to make development easier
installation method:
$NPM install - G truffle
environment requirements
nodejs 5.0 +
windows, Linux, or Mac OS X
truffle needs Ethereum client and supports standard JSON RPC API. For development, some are more suitable, which will be introced in the following chapters (for example, testrpc provides real-time feedback ring coding and debugging)
suggestions for Windows users
if you are a Windows user, we recommend that you use PowerShell or git bash to install and use the truffle framework. These two shell environments provide more convenient features than the default
if you have to use the command line, see the discussion here on how to configure truffle.
built in smart contract compilation, linking, deployment and binary file management
automatic contract testing under rapid development
scripted and extensible deployment and publishing framework
the network environment management function deployed to no matter how many public or private networks
uses the package management provided by ethpm & NPM and erc190 standard
a direct interactive console that communicates directly with the contract (after writing the contract, you can verify it on the command line)
the configurable construction process supports tight integration
external scripts can be executed in truffle environment< Truffle is the most popular development framework, whose mission is to make development easier
installation method:
$NPM install - G truffle
environment requirements
nodejs 5.0 +
windows, Linux, or Mac OS X
truffle needs Ethereum client and supports standard JSON RPC API. For development, some are more suitable, which will be introced in the following chapters (for example, testrpc provides real-time feedback ring coding and debugging)
suggestions for Windows users
if you are a Windows user, we recommend that you use PowerShell or git bash to install and use the truffle framework. These two shell environments provide more convenient features than the default
if you have to use the command line, see the discussion here on how to configure truffle.
6. < / UL >
Hello, many examples are that eth. Getcompilers() returns solidity or configures Solc
and then reports error: the method eth_ Getcompilers does not exist / is not available error
because this method has been removed after 1.6, and it is not advisable to use lower version geth
solution:
< UL >start an Ethereum node (such as geth private chain or testrpc)
compile smart contracts with Solc
the compiled contract is deployed to the network
the JavaScript API provided by eb3.js is used to call the contract Depending on the type of call, it may consume Ethernet currency.)
hope to help you
7. Generally speaking, the steps of deploying smart contract are:
1 start an Ethereum node (such as geth or testrpc)
2 use Solc to compile smart contracts=& gt; Get the binary code
3 deploy the compiled contract to the network This step will consume Ethernet currency, and you need to use the default address or specified address of your node to sign the contract.)=& gt; Get the blockchain address and ABI of the contract (JSON representation of the contract interface, including variables, events and callable methods) The author confused ABI with contract interface here. ABI is the binary representation of the contract interface.)
4 use the JavaScript API provided by web3.js to call the contract Depending on the type of call, it may consume Ethernet currency.)
1 start an Ethereum node (such as geth or testrpc)
2 use Solc to compile smart contracts=& gt; Get the binary code
3 deploy the compiled contract to the network This step will consume Ethernet currency, and you need to use the default address or specified address of your node to sign the contract.)=& gt; Get the blockchain address and ABI of the contract (JSON representation of the contract interface, including variables, events and callable methods) The author confused ABI with contract interface here. ABI is the binary representation of the contract interface.)
4 use the JavaScript API provided by web3.js to call the contract Depending on the type of call, it may consume Ethernet currency.)
8. C#实现方式
需要去下载CookComputing.XmlRpcV2.dll这个dll的支持,以下是实现代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CookComputing.XmlRpc;
using System.Text;
namespace XmlrpcTest
{
public class Program
{
static void Main(string[] args)
{
IXmlrpc proxy = XmlRpcProxyGen.Create<IXmlrpc>();
var result = proxy.login("test123", "123456");
}
}
/// <summary>
/// xmlrpc的部署的地址
/// </summary>
[XmlRpcUrl("http://192.168.10.11:8080/middlers")]
public interface IXmlrpc : IXmlRpcProxy
{
[XmlRpcMethod("middler.login")]
int login(string szPassportId, string szPassword);
}
}
需要去下载CookComputing.XmlRpcV2.dll这个dll的支持,以下是实现代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CookComputing.XmlRpc;
using System.Text;
namespace XmlrpcTest
{
public class Program
{
static void Main(string[] args)
{
IXmlrpc proxy = XmlRpcProxyGen.Create<IXmlrpc>();
var result = proxy.login("test123", "123456");
}
}
/// <summary>
/// xmlrpc的部署的地址
/// </summary>
[XmlRpcUrl("http://192.168.10.11:8080/middlers")]
public interface IXmlrpc : IXmlRpcProxy
{
[XmlRpcMethod("middler.login")]
int login(string szPassportId, string szPassword);
}
}
9. Step 1: openresty server installation and Lapis framework deployment (only Lapis installation is introced here)
A). Install luarocks
sudo apt get install luarocks
b)< Step 2: create an openresty project with Lapis.
Lapis new
3. Create a timed task in openresty< The idea of timer implementation is as follows:
let openresty load a Lua script. The script starts a timer setting and calls a function. Inside the called function, it recursively sets the time and calls the weekly function itself. Using this periodic call event, we can set the time in the function body of regular recursion, Execute a function procere callrpc() to access the data on SAE cloud through RPC Protocol
the definition and implementation of RPC interface will be described in detail in the following Django section. The following is the function mentioned. The main purpose of this function is to pull the data in the MySQL database on SAE through RPC Protocol. As for what data is directly related to your business, we use a simple data structure here to illustrate the problem
local handler
function handler (premature, params)
-- callrpc is Lua's access to SAE's RPC server through json.rpc
callrpc()
-- recursive timer, repeatedly calling handler function< br />local ok, err = ngx.timer.at(6, handler, " params-data")< br />ngx.log(ngx.DEBUG, " ok:", ok, " err:", ERR)
end
-- set timer for the first time and call handler function< br />local ok, err = ngx.timer.at(6, handler," params-data")< br />ngx.log(ngx.DEBUG, " ok:", ok," err:", ERR)
-- judge whether the first call is successful, if not, print out the cause of the problem< br />if not ok then
ngx.log(ngx.ERR, " err:", Create RPC service on SAE:
there are five steps to complete the creation:
1. Create a Django project
2. Install rpc4django
3. Create database table
4. Implement RPC service interface
5. Start RPC service
let's pause the openrest section and first introce how to build RPC server in SAE
as mentioned before, the RPC service on SAE uses the python service of SAE and the Django framework naturally supported by SAE. The following is to create a Django project. SAE naturally supports Django, tornado and flag. If you need more information, please refer to the following article< br /> http://www.epubit.com.cn/article/143
server side
Step 1: create a Django project
A)
Django admin. Pystartproject testrpc
b)
pythonmanage. Py startapp myrpc
after executing two instructions, the following directory structure is established on the system
this indicates that djago has successfully completed the creation of the project and app
Step 2: install rpc4django
RPC services are mainly implemented by using rpc4django. Rpc4django is an open source project. The address of the project is as follows: https://github.com/davidfischer/rpc4django
rpc4django is also a Django app. To use it, you only need to reference it in the setting.py configuration file
modify the setting.py file in the testrpc folder, as shown in the following figure:
add rpc4django to the list of apps installed by the project, so that rpc4django can be used just like the general app< The third step is to create a database table
Django is a python frame in MVC mode, and supports orm. As long as you define a python model class, you can generate database tables synchronously
we add a table definition class in models.py in myrpc folder, as shown in the following figure:
after creating the model mole class, we need to synchronize the DB and generate the corresponding DB table from Django according to the definition of the class
pythonmanage. Py syncdb
if the local running environment of SAE is installed before, cloudsql.py may be used to directly access the remote SAE database command line
Step 5: start the RPC service
after the above four steps, the simplest RPC service on SAE will be set up. Let's start this application, and then RPC service will be available
Python manager.py runserver 127.0.0.1:8080
back to the previous introction of lua, the remaining steps are:
1. Lua calls the RPC service interface on SAE
2. Write the returned data into openresty's sharediction
3. Use Lapis template system to display the returned results on the web page.
A). Install luarocks
sudo apt get install luarocks
b)< Step 2: create an openresty project with Lapis.
Lapis new
3. Create a timed task in openresty< The idea of timer implementation is as follows:
let openresty load a Lua script. The script starts a timer setting and calls a function. Inside the called function, it recursively sets the time and calls the weekly function itself. Using this periodic call event, we can set the time in the function body of regular recursion, Execute a function procere callrpc() to access the data on SAE cloud through RPC Protocol
the definition and implementation of RPC interface will be described in detail in the following Django section. The following is the function mentioned. The main purpose of this function is to pull the data in the MySQL database on SAE through RPC Protocol. As for what data is directly related to your business, we use a simple data structure here to illustrate the problem
local handler
function handler (premature, params)
-- callrpc is Lua's access to SAE's RPC server through json.rpc
callrpc()
-- recursive timer, repeatedly calling handler function< br />local ok, err = ngx.timer.at(6, handler, " params-data")< br />ngx.log(ngx.DEBUG, " ok:", ok, " err:", ERR)
end
-- set timer for the first time and call handler function< br />local ok, err = ngx.timer.at(6, handler," params-data")< br />ngx.log(ngx.DEBUG, " ok:", ok," err:", ERR)
-- judge whether the first call is successful, if not, print out the cause of the problem< br />if not ok then
ngx.log(ngx.ERR, " err:", Create RPC service on SAE:
there are five steps to complete the creation:
1. Create a Django project
2. Install rpc4django
3. Create database table
4. Implement RPC service interface
5. Start RPC service
let's pause the openrest section and first introce how to build RPC server in SAE
as mentioned before, the RPC service on SAE uses the python service of SAE and the Django framework naturally supported by SAE. The following is to create a Django project. SAE naturally supports Django, tornado and flag. If you need more information, please refer to the following article< br /> http://www.epubit.com.cn/article/143
server side
Step 1: create a Django project
A)
Django admin. Pystartproject testrpc
b)
pythonmanage. Py startapp myrpc
after executing two instructions, the following directory structure is established on the system
this indicates that djago has successfully completed the creation of the project and app
Step 2: install rpc4django
RPC services are mainly implemented by using rpc4django. Rpc4django is an open source project. The address of the project is as follows: https://github.com/davidfischer/rpc4django
rpc4django is also a Django app. To use it, you only need to reference it in the setting.py configuration file
modify the setting.py file in the testrpc folder, as shown in the following figure:
add rpc4django to the list of apps installed by the project, so that rpc4django can be used just like the general app< The third step is to create a database table
Django is a python frame in MVC mode, and supports orm. As long as you define a python model class, you can generate database tables synchronously
we add a table definition class in models.py in myrpc folder, as shown in the following figure:
after creating the model mole class, we need to synchronize the DB and generate the corresponding DB table from Django according to the definition of the class
pythonmanage. Py syncdb
if the local running environment of SAE is installed before, cloudsql.py may be used to directly access the remote SAE database command line
Step 5: start the RPC service
after the above four steps, the simplest RPC service on SAE will be set up. Let's start this application, and then RPC service will be available
Python manager.py runserver 127.0.0.1:8080
back to the previous introction of lua, the remaining steps are:
1. Lua calls the RPC service interface on SAE
2. Write the returned data into openresty's sharediction
3. Use Lapis template system to display the returned results on the web page.
Hot content
