pragma solidity ^0.5.10;
import './Deployable';
contract HelloWorld is Deployable {
function helloWorld() public pure returns(string memory) {
return "Hello world!";
}
}
Even harder with the blockchain part.
es5/es6, html, css, sass, jquery, ajax, xml, bootstrap, sql, nosql,
angluar/vuejs/reactjs, expressjs, aws, firebase, webpack/parcel, babel, git/github, node.js, jenkins, docker
solidity, remix, truffle/embark, ethers, web3, ganache, infura, ethereum, metamask, and all others blockchains.
npm i -g create-blockchain-app
npx create-blockchain-app yourApp
cd yourApp && npm start
Dev environment with hot reload, files watchers, plugins
Blazing fast, zero configuration web application bundler
Metamask context is automatically injected in your app:
<MetamaskContext>
<youDapp />
</MetamaskContext>
Metamask with react hooks:
const yourApp () => {
const metamask = useMetamask();
console.log(metamask.address);
console.log(metamask.network);
console.log(metamask.balance);
};
sol2js: generate javascript from solidity file. And deploy contracts on the blockchain.
https://github.com/akersof/sol2js
parcel-plugin-solidity: automatically trigger sol2js when solidity files changed
create-blockchain-app: dev environment, web server, build.
https://github.com/akersof/create-blockchain-app
//Raw javascript
import {helloYou, goodbye} from './contracts/hello';
const res1 = await helloYou('bob');
const res2 = await goodbye('alice');
pragma solidity ^0.5.8;
import "./Deployable.sol";
contract hello is Deployable {
function helloYou(string memory _name) public view returns(string memory){
return string(abi.encodePacked("Hello"," ",_name));
}
function goodbye(string memory _name) public view returns(string memory){
return string(abi.encodePacked("Goobye"," ",_name, ", see you soon"));
}
}
//with react hook
import React from 'react';
import {helloYou, goodbye} from './contracts/hooks/hello.js';
function Dapp() {
const [res1] = helloYou('bob');
const [res2] = goodbye('alice');
return ( <div>
{res1.status === "success" ? response.result : "Loading"}
<br />
{response2.status === "success" ? response2.result : "Loading"}
</div>
);
}