Deploy a Smart Contract

Before to deploy a smart contract you need to have deployed a local node, which you can do using this guide. This guide will allow you to deploy simple contract that you can use to record integer numbers.

 

Download prerequisites

For this part you will need to have nodejs installed. Check whether node is installed on your local computer by running the following command:

 
				
					$ node --version
				
			

If the command does not return a version number, download and install node by following the instructions for the operating system you use on the Node.js website. Node version have to be at least v14. 

Now, check whether yarn is installed on your local computer by running the following command:

 
				
					$ yarn --version
				
			

If the command doe not return a version number, download and install yarn running the following command:

				
					$ npm install -g yarn
				
			

Clone Repository

Please clone this repository. It contains all the code necessary to deploy a contract and send a transaction.

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

Now, download all the necessary dependencies

 
				
					$ cd samples/local
$ yarn install

				
			

Deploy smart contract

Please run this command to deploy the smart contract.

 
				
					$ node deployContract.js
				
			

The smart contract will be deployed and a blockchain address will be returned like this:

 
				
					Storage address: 0x4ca1ec8E10E4bD9797882706C644A8e48314731B
				
			

Please, copy the smart contract address deployed (e.g., 0x4ca1ec8E10E4bD9797882706C644A8e48314731B) because you will need it to send transactions.

 

Send a Transaction

To send a transaction to the smart contract you can follow this guide.

 

Copyright 2022 © All rights Reserved. Designed by LACNet