- Truffle Framework used to create an Ethereum app using Javascript and Solidity.
- Code from Fazt Code - see 👏 Inspiration below
- Note: to open web links in a new window use: ctrl+click on link
- Ethereum blockchain app is written in Solidity, similar to Javascript
- The app is a simple todo list with title & description strings, integer id & date fields with a boolean 'done' field
- Truffle suite includes Ganache, required to run the tests
- Truffle Suite tools for smart contracts
- @truffle/contract Ethereum contract abstraction, for Node & browser.
- Ganache framework to run Ethereum blockchain apps
- Ethereum decentralised app (DApps)
- Solidity v0.8.6 a curly-bracket language, object-oriented, high-level language for implementing smart contracts
- Javascript testing using the Mocha framework and the Chai assertion library
- Node.js v14.17.0 JavaScript runtime built on Chrome's V8 JavaScript engine.
- lite-server v2.6 node server
- Bootstrap v5 frontend framework
- Google Material Fonts
- MetaMask website & MetaMask Chrome Extension browser Ethereum wallet to use blockchain app
Solidity code:
truffle console
to start Truffle command prompttruffle migrate
to compile app
Frontend:
npm run dev
for a server-lite dev server
truffle test
to run tests on Solidity code - Ganache has to be running
contracts/TasksContract.sol
extract - In order to make events stand out with regards to regular function calls, emit TaskCreated(var1, var2...) as opposed to just EventName() is used to "call" the TaskCreated function.
function createTask(string memory _title, string memory _description) public {
taskCounter++;
tasks[taskCounter] = Task(taskCounter, _title, _description, false, block.timestamp);
emit TaskCreated(taskCounter, _title, _description, false, block.timestamp);
}
- connects with MetaMask Ethereum wallet Chrome Extension - see top screen print
- Working
- To-Do: Replace Bootstrap cards etc. with new style
- Fazt Code: Solidity & Javascript App - Ethereum Aplicacion Decentralizada in Spanish
- Aniket: ‘emit’ keyword in Solidity
- Ethereum questions: Smart contract now vs javascript now explains how Javascript's timestamp is always a factor of 1000 larger than the one used by Solidity
- N/A
- Repo created by ABateman, email: [email protected]