Before following this guide to send a transaction you need to have deployed a smart contract. This guide will allow you to change the value stored in the smart contract deployed previously. Also you will get this new value making a call to your node.
If you have not cloned this repository yet, please clone this repository now. 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 #(If you haven’t done it yet)
To send a transaction, please execute this script:
$ node sendTransaction.js --contractAddress=0x4ca1ec8E10E4bD9797882706C644A8e48314731B --value=30
Where contractAddress is the address of your smart contract previously deployed and value is a new value to store.
You will see your transaction sent and a new value stored into the smart contract like this:
Storage: 0x4ca1ec8E10E4bD9797882706C644A8e48314731B Tx hash: 0x936b7a20ce1da316ed31160751fb31f5fb7eec60ca968b16f845089edf5a44ee contract owner: 0x1306E8B4CD9593c49E2A021DAF7d513d7E634405 New value set: 30
That’s it. You have deployed a node and a smart contract, and sent a transaction to change the value of an integer number, which you have also read making a call to your local node.