Deploy a Local Node

This guide is not for deploying nodes in the LACChain Networks. Instead, it creates an isolated LACChain environment on your machine for testing and development purposes in a simulated LACChain Network. If what you want is to deploy a node in the LACChain Networks, please go here

For quick local and isolated testing, you can follow this guide. After completing this guide for local and isolated node deployment, you can also follow our complementary Getting Started guide to deploy a smart contract and Getting Started guide to send a transaction.

Requirements

Recommended hardware features for the LACChain node:

2 vCPUs

RAM memory 8Gb

Hard Disk 10GB

 

Clone Repository

To configure and deploy your node, you must clone this git repository in your machine.

				
					$ git clone https://github.com/LACNet-Networks/besu-networks


				
			

Install Docker and Docker compose

Make sure you have Docker and Docker-compose installed on machine. If not, you can install them following the instructions to install docker and docker-compose.

Run your node

Execute the following command to run your containers:

				
					$ cd besu-networks/docker/compose/local/writer1
				
			

This node comes with all the smart contracts pre-deployed, so you have to give permissions in the data directory to your user so you can read, write, and execute in this directory. Depending on your docker version, run:

				
					$ sudo chmod -R 667 data
$ cd ..
$ docker-compose up -d  
				
			

Or:

				
					$ docker compose up -d
				
			

(Optional) Run Firefly on Your Local Node

Execute the following command to run your containers

				
					$ cd besu-networks/docker/compose/firefly/writer1
				
			

We have deployed all smart contracts previously, now you have to give permissions to data directory to your user can read write and execute in this directory.

				
					$ sudo chmod -R 667 data
$ cd ..
$ docker-compose up -d  

				
			

Or

				
					$ docker compose up -d
				
			

Depending on your docker version

Next, it is necessary to register your node identity, so execute the following command to register your node identity on smart contract:

				
					$ curl -X POST -H 'content-type:application/json' --data '{}' http://localhost:5000/api/v1/network/organizations/self\?confirm\=true
				
			

It could take a few seconds to register your identity. Result of this command should be similar like this:

				
					{«id»:»d16f0a0e-a24b-4596-9a01-fd6f103aad05″,»did»:»did:firefly:org/XXXXXX»,»type»:»org»,»namespace»:»ff_system»,»name»:»XXXX»,»messages»:{«claim»:»8dbc7002-b647-40ea-abd3-43b12838c57d»,»verification»:null,»update»:null},»created»:»2022-06-16T22:39:28.674387388Z»,»updated»:»2022-06-16T22:39:28.67
				
			

Finally, we need to listen events related to token creation, so execute the following command to init token events:

				
					$ curl -X POST -H 'content-type:application/json' http://localhost:5108/api/v1/init
				
			

It is done! Now you can access using these urls:

  • http://localhost:5000/ui—> Firefly monitor (to monitor your stack and transactions) 
  • http://localhost:5109/home—> Firefly sandbox (to deploy tokens and custom smart contracts)

Verify your node

Check if the node is syncing blocks by getting the log of the Besu containter. Depending on your docker version, run:

				
					$ docker-compose logs -f besu
				
			

Or:

				
					$ docker compose logs -f besu
				
			

You should get a log similar to the following:

Stop your node

If you want or need to stop your node, please execute one of the following commands depending on your docker version:

				
					$ docker-compose down
				
			

Or:

				
					$ docker compose down
				
			

(Optional) Set GAS Limit

If you want to make some tests with a GAS limit that emulates the one you will be having in the Mainnet (see GAS limits associated to memberships), follow these steps:

Clone Repository

If you haven’t cloned this repository yet, please clone this repository now. It contains all the code necessary to send a transaction and change gas limit.

				
					$ git clone https://github.com/LACNetNetworks/samples.git
				
			

Now download all the necessary dependencies:

				
					$ cd samples/local
$ yarn install (If you haven’t done it yet)
				
			

Send Transaction to Change GAS Limit

To send the transaction, please execute this script:

				
					$ node changeGasLimit.js --gasLimit=10000000
				
			

Where gasLimit will be the new value set to gas limit on your local node. You will see your transaction sent and a new gas limit value set into the smart contract like this:

Tx hash: 0x936b7a20ce1da316ed31160751fb31f5fb7eec60ca968b16f845089edf5a44ee

New GasLimit set: 10000000

That’s all, you have sent a transaction and changed the GAS limit value on your local node.

Next steps

Now you can continue and deploy a first smart contract in your node following this guide.

Copyright 2024 © All rights Reserved. Designed by LACNet