Ethereum: Receive money in regtest mode

Ethereum: Receiving money in Regression Test Mode (Regtest)

When developing an application that interacts with a bitcoin server to obtain details of transactions of transaction ID transactions, it is necessary to consider the use of Ethereum for other features. One such case of use is to receive money through Regtest mode that allows you to test and verify your app without revealing your wallet on the main network. Here is an article on how to get funds in Regtest mode in Ethereum.

What is Regression Test Mode?

The regression mode (Regtest) simulates a transaction with the same transaction ID as used to create it in the main hall, but without actually sending or accepting any means. This will help you verify that your code is behaving correctly and there is no errors that could appear after deployment.

Setting Ethereum for Regtest mode

Before you continue, make sure you have Node.JS, Geth (client Go Ethereum) and truffle package on your computer.

Ethereum: Receive money in regtest mode

assumptions

  • Install the required packages:

npm install @coarse/core oryarn add tuber Core

npm install @coarse/compile oryarn add Compile

  • Create a new project with NPX Truffle Init

  • Configure your Mainnet and Regtest networks in the .env file.

Configuration of your Ethereum network

You will need to update your network configuration in config/contonce.json. Make sure you have the following setting:

`json

{

“Network”: {{

“Mainnet”: True,

“Regtest”: False,

“RPC”: “

“ETH1”: {{

“RPC”: “

},

}

}

`

Replace your_project_id for your actual infura project.

Creating a contract to receive funds

Create a new file called SRC/Contract/Reccipient.sol. Here is an example of a contract:

`Solidity

Pragma of solidity ^0.8.0;

Import “

Import “

The recipient of the contract {

Use Safeerc20 for (ERC20.ierc20);

ERC20 Public Payment;

Constructor (address _Payable) {

Payable = ERC20 (_Payable);

}

The function accepts () public payments (BOOL) {

Return Pravda;

}

}

`

Testing contract with Regtest

If you want to test your contract without actually sending or receiving funds, you can use a combination of commands:

  • Run the Geth knot:

`Bash

GO Launch –NODE = 127.0.0.1: 8545 ./SRC/Contract/recip

`

  • Build and deploy your intelligent contract to the Ethereum network.

  • Use the “Compile” Truffle command to compile and update the contract in the local Regtest.

For example::

`Bash

Composition of truffles NPX

Truffle Migration -siete = Regtest

`

Receiving funds through Regtest Mode

After successful deployment and updating of your intelligent contract, you can test the receipt of funds via Regtest. As follows:

1.

`Bash

GO Launch –NODE = 127.0.0.1: 8545 ./SRC/Contract/recip

`

  • Create a new transaction that calls your contract and sends funds:

`Solidity

Pragma of solidity ^0.8.0;

Import “

Import “

The recipient of the contract {

Use Safeerc20 for (ERC20.ierc20);

ERC20 Public Payment;

Constructor (address _Payable) {

Payable = ERC20 (_Payable);

}

The function accepts () public payments (BOOL) {

Return Pravda;

}

}

Pragma of solidity ^0.8.0;

Import “https: // github.

EVOLUTION EVOLUTION BEHAVIORAL CRYPTOCURRENCIES

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Scroll to Top