MENU

Deploy Solidity helloWorld to Ethereum testnet

January 22, 2021
0
5508
0
Building on from the previous article on creating a helloWorld smart contract, here we will show how to deploy a contract to an Ethereum testnet. The testnet we will use is called Ropsten but there are others can you can choose such as Koven, Rinkeby or Goerli. Step 1: Install Metamask Metamask is a browser plugin that can serve as a crypto wallet and also as a connection to various blockchains to communicate and sign transactions. Install this by visiting: https://metamask.io/download.html Step 2: Change the Metamask network Change the network to the Ropsten testnet. Step 3: Get some test ether To get some test ether, click buy, and then click Get Ether in the Test Faucet section below. Step 4: Deploy your smart contract Change your environment from Javascript VM to Injected Web3. Now when you click deploy, Metamask will pop up and ask you to confirm the transaction. Click confirm. Step 5: Interacting with your smart contract Now you can interact with your smart contract the same way but each time you try and store a message, you will have to pay a small fee (gas) and sign the transaction using Metamask. Here is a link to the smart […]
Read More ›

Solidity HelloWorld (updated for 2021) with Remix

December 22, 2020
0
5643
0
It is really easy to get up and running with Solidity smart contracts using Remix which is an online IDE for developing smart contracts in Solidity. If you visit https://remix.ethereum.org/, you’ll see some sample code Removing all the comments to make it less scary, you can see that the name of the contract is “Storage”, there is one variable called number of type uint256 which stands for an unsigned integer that is 256 bits long and then two functions. One to store the number and one to retrieve the number. And that is it really. Read this explanation of functions to demystify the key words such as public, view and returns and this smart contract should be easy to understand. Below I’ve changed the code to store a string instead and changed the contract name to “helloWorld” To run this, you will have to compile the contract first. Then deploy the contract. Now you can store a string and retrieve the string.
Read More ›

Which is cheaper, a public function or an external function?

June 17, 2020
0
7612
0
Here is a quick video explaining which function is cheaper, a public function or an external function in Solidity. I’ve also included a demonstration to prove it as well.
Read More ›

Understanding basic functions in solidity

December 22, 2018
1
11881
0
Smart contracts are comprised mainly of functions so it is important to understand how to construct one and all the various options available. From the solidity documentation, the syntax of a function is as follows: function FunctionName([parameters]) {public|private|internal|external} [pure|constant|view|payable] [modifiers] [returns (<return types>)] What this means is that when creating a function, here are the required steps. Use the function keyword Provide a function name Provide parameters if required Set the function’s visibility. There’s 4 options to choose from. public, private, internal, or external: Set the behaviour of the function. Choose from view, pure, or payable. Add any applicable modifiers Add any applicable return types/parameters Here is a brief explanation of the different visibilities. Public: All (contracts can a call the function) Private: Only this contract Internal – only this contract and contracts deriving from it External – Cannot be accessed internally, only externally. Private is a subset of internal and external is a subset of public. For a more detailed and intriguing analysis of the difference between public and external check this. (TLDR: public uses more gas because it uses memory instead of calldata). (Check the docs for more details). The behaviours are defined as: View: Can read the state but will not modify storage state […]
Read More ›

What does semantic versioning have to do with Solidity

December 17, 2018
0
9294
2
Considering that the very first line of a solidity smart contract is something like: pragma solidity ^0.4.21 What does the caret really mean? The short answer is the caret or top hat (^) means the code will be compatible with compiler version from 0.4.21 to 0.5.0. This sounds easy to understand but it doesn’t actually tell the whole story. To really understand it, means learning about the concept of Semantic Versioning. In short, software versioning generally follows the format major.minor.revision. The caret is only one symbol out of various others such as ~ (tilde), * (wild card), || (logical or) and a bunch of typical ones such as >, >=, < and <=. The real definition of ^ is: “Allows changes that do not modify the left-most non-zero digit in the major.minor.version tuple format.“  This definition explains the following examples: ^1.2.3:  >=1.2.3 and <2.0.0 ^0.2.3: >=0.2.3 and <0.3.0 ^0.0.3: >=0.0.3 and <0.0.4 Tilde is interesting. The definition is: “Allows patch-level changes if a minor version is specified on the comparator. Allows minor-level changes if not.” which again is explained by these examples: ~1.2.3:  >=1.2.3 and <1.3.0 ~0.2.3: >=0.2.3 and <0.3.0 ~1.2:>=1.2.0 and <1.3.0 (Same as 1.2.x) ~1: >=1.0.0 <2.0.0 (Same as […]
Read More ›

Great resources for learning about NEO

March 9, 2018
0
8080
0
Here are some great links to learn about NEO. The analogies are very good. https://steemit.com/cryptocurrency/@basiccrypto/almost-everything-you-wanted-to-know-about-neo-part-1-of-2 https://steemit.com/cryptocurrency/@basiccrypto/almost-everything-you-wanted-to-know-about-neo-part-2-of-2 https://steemit.com/neo/@basiccrypto/neo-s-consensus-protocol-how-delegated-byzantine-fault-tolerance-works
Read More ›

What are smart contracts?

March 18, 2017
0
5894
0
Simply stated, A smart contract is some software code that transfers assets between parties when certain conditions occur. That is a very simple explanation but let’s dive deeper into what it really means, what it looks like and how it works. What it means? Smart contracts were brought to light in the mid 90’s and cryptographer Nick Szabo is generally credited with “inventing” smart contracts. The reason it has gained significant momentum now is because of the invention of bitcoins, the most successful digital currency to date and the underlying framework it provides. In a sentence, contracts are agreements between parties. Smart contracts are agreements between parties in the digital realm. A more formal definition of a smart contract is: a computer program that directly controls the transfer of digital currencies or assets between parties under certain conditions. It not only defines the rules and penalties around an agreement in the same way that a traditional contract does, but it can also automatically enforce those obligations. It does this by taking in information as input, assigning value to that input through the rules set out in the contract, and executing the actions required by those contractual clauses. These contracts are […]
Read More ›

Ian Grigg: Ricardian Contracts And Digital Assets Prehistory

March 8, 2017
0
6628
0
Ian Grigg: Ricardian Contracts And Digital Assets Prehistory A neat and very informative podcast on the history of digi cash, financial cryptography and Ricardian contracts. The history was fascinating because it provides a lot of context to how we got to where we are today. It’s a little lengthy but definitely worth a watch.
Read More ›