create account


advanced mode

Ethereum Smart Contracts 101: Hello World by ryuzakilost

View this thread on steemit.com
View on official site
· @ryuzakilost · (edited)
$1.00
Ethereum Smart Contracts 101: Hello World
# What are Smart Contracts?

---
*A smart contract is a computer program which is intended to facilitate, verify, or enforce a negotiation/contract that was done in real life.*

---
![Image](https://i.imgsafe.org/52/528c7272b8.png)
<center><sub><sup>Image Credits: [Blockgeeks.com](https://blockgeeks.com/guides/smart-contracts/)</sup></sub></center>
With a smart contract many kinds of contractual clauses can be made partially or fully self-executing, self-enforcing, or both. The main motive of smart contracts is to provide security that is better to traditional contracts and to cut other transactional costs associated with traditional contracting. Smart contracts on Ethereum network run on something called Ethereum Virtual Machine (EVM) which for visualization purposes is similar to JVM in Java.

The Decentralized Applications (ĐApps) running on the Ethereum network are nothing more than a bunch of Complex Smart Contracts.

To start with Smart Contracts, you'll need the below mentioned tools.


# Tools
---
## Mist Browser

![Screen Shot 2017-09-21 at 6.17.11 PM.png](https://steemitimages.com/DQmZeEJprk6G5mdrEPThiVFdhe6NSsVdDFXdpHk4mUayXb7/Screen%20Shot%202017-09-21%20at%206.17.11%20PM.png)

Mist Browser is a DApp browser, built on top of Chromium Browser.

Download Latest Version of Mist from [Github Releases Page](https://github.com/ethereum/mist/releases).

Note: Mist has Ethereum Wallet built into it, so no need to download wallet seperately, just the Ethereum Mist would do.

#### Setting up Mist:
1. Install the Mist Browser:
&nbsp;- Mac Setup: Open the dmg file by double clicking it, and install it by dragging the Mist icon to Applications folder.
&nbsp;- Linux Setup: ```sudo dpkg -i Mist-linux64-0-9-0.deb```
&nbsp;- Windows Setup: Run the installer and follow installation instructions.
2. After installation run Mist, it will prompt you to select either `Main Network` or `Test Network`, select `Test Network`.
3. On first run, Mist will download the entire blockchain of the test network, which has almost 1 Million blocks, so be patient.
4. Since we're developing our Smart Contract, we'll use the `Test Network`, so that we don't have to spend any real money while learning.
5. Mist currently has two test networks `Rinkeby` and `Ropsten`, we're going to use `Rinkeby`, because obtaining free Test Ether on `Rinkeby` is much easier. 

#### Obtaining Test Ether
To create Smart Contracts, you're going to need some Ethereum on the Rinkeby test network, which can be obtained by following these steps:
![Screen Shot 2017-09-22 at 7.43.55 PM.png](https://steemitimages.com/DQmbfF4pFZSBLvd6cv1Lnbt6H1TnQydMkyLpHwA6X54HNNQ/Screen%20Shot%202017-09-22%20at%207.43.55%20PM.png)
1. Create a public gist on Github \[[Link](https://gist.github.com/)].
2. Copy your Main Account wallet address from Mist, and paste it in the gist content. Name and Description of the gist does not matter.
3. Go to the [Faucet site](https://faucet.rinkeby.io), paste your gist address and claim your Test Ether (18.75 Per 3 days).
4. You'll get the Test Ether when the next block is discovered on the network (30s to 2 mins).


## Remix IDE

![Screen Shot 2017-09-22 at 3.16.53 PM.png](https://steemitimages.com/DQmSmymiDNvQ85Pm65uutVasBogAnm9gLR1DCnnkPMgyWrV/Screen%20Shot%202017-09-22%20at%203.16.53%20PM.png)

Remix IDE is available as an Online IDE as well as it's bundled with the Mist Browser you downloaed.

Online Version: [Remix IDE](http://remix.ethereum.org/)

Mist Remix IDE: Go to `Develop` -> `Open Remix IDE`.

# The First Smart Contract

---
*Let's suppose there is a company which wants to pay it's employees equal share of the total earnings, using a Smart Contract.*

---

### Basic Requirements:
- A way to receive money in the smart contract.
- A way by which employees can withdraw their funds.
- Equal division of the funds between employees.
- Checking that the person trying to withdraw is actually one of the employees.
- Keeping track of how much an employee has already withdrawn from his share.

### Let's Create the Smart Contract

#### Structure of a Smart Contract
----

```javascript

pragma something;       <--- Solidity Version information for compiler

contract ContractName{

  constructor(){}       <--- Initialization stuff goes here

  fallback(){}          <--- Called whenever someone sends Ether

  someFunction1(){}     <--- Normal function

  someFunction2(){}     <--- Normal function

}

```
----
There are a couple of types of functions which are *required* in a smart contract:
- ```Constructor Function:``` The function which is called only once, when you deploy the smart contract. For example it can be used to receive the initial Ether sent to it, at the time of deployment.
- ```Fallback Function:``` The function without a name (*literally no name, defined as ```function (){ code... }```*) which is invoked when someone sends Ether to the address of your smart contract. In the lack of this function, Ether sent to the smart contract will be rejected.

There's also this thing called a ```Function Modifiers``` which are used to change the behaviour of a function, though they're **not essential**. For example, modifiers can check a condition prior to executing a function.

<br>
#### The Actual Contract Code

Copy Friendly Version:  <a href="https://gist.githubusercontent.com/ryuzaki6488/42cb2d506ef5ec60db1f96a3470f8aca/raw/a54c0e08ad73da66b48f247fcc82eb04fdd4f845/PayEmployees.sol" target="_blank">PayEmployees.sol</a>
```javascript
//The contract should start with the Solidity version it is written for.
pragma solidity ^0.4.0;

contract PayEmployees {

  address[] employees = [0xdd870fa1b7c4700f2bd7f44238821c26f7392148, 0x583031d1113ad414f02576bd6afabfb302140225];
  uint totalReceived = 0;
  mapping(address => uint) withdrawnAmounts;

  //Defining constructor as payable allows it to receive ethereum at the time of creation.
  function PayEmployees() payable{
    updateTotalReceived();
  }

  //fallback function, invoked ethereum is sent to the smart contract's address.
  function () payable {
    updateTotalReceived();
  }

  function updateTotalReceived() internal {
    totalReceived += msg.value;
  }

  //Function modifiers are used to imply restrictions on the function calls.
  modifier canWithdraw() {
    bool contains = false;

    for(uint i =0; i < employees.length; i++) {
      if(employees[i] == msg.sender) {
        contains = true;
        break;
      }
    }
    require(contains);

    //This "_;" will be replaced by the actual function body 
    _;
  }

  //this function uses canWithdraw modifier to check whether the address belongs to one of the employees.
  function withdraw() canWithdraw {
    uint amountAllocated = totalReceived/employees.length;
    uint amountWithdrawn = withdrawnAmounts[msg.sender];
    uint amount = amountAllocated - amountWithdrawn;
    withdrawnAmounts[msg.sender] = amountWithdrawn + amount;

    if(amount > 0){
      msg.sender.transfer(amount);
    }
  }
}
```
<br>
### Breaking Down the Code

Let's take a look what it's all about.

```javascript
pragma solidity ^0.4.0;

contract PayEmployees {

  address[] employees = [0xdd870fa1b7c4700f2bd7f44238821c26f7392148, 0x583031d1113ad414f02576bd6afabfb302140225];
  uint totalReceived = 0;
  mapping(address => uint) withdrawnAmounts;
  ...
```
<br>
*Pragma* in general refers to an instruction which tells the compiler it how it should treat the code. In our smart contract the first line ```pragma solidity ^0.4.0;``` simply tells that the smart contract is written for Solidity version 0.4.0 or anything newer that does not break or alter the functionality (up to, but not including, version 0.5.0)

The next line creates a contract named ```PayEmployees```. A contract is similar to a class, it's basically a collection of code containing variables and functions.

**[Data Types in Solidity:](http://solidity.readthedocs.io/en/develop/types.html)**
- *uint* - unsigned integer of 256 bits.
- *address* - holds a 20 byte value i.e size of an Ethereum address.
- *mapping(_KeyType => _ValueType)* - a map for mapping some key, values.

We need a list of the wallet addresses of all our employees, ```address[] employees``` creates an array in which we store the wallet addresses.

**Constructor Function**
```javascript
...
  function PayEmployees() payable{
    updateTotalReceived();
  }
...
```
<br>

This is the constructor, the function which is called only once, when we deploy the contract on the network. In our case, we're just updating the variable which stores the total ether received by our smart contract, to include the ether transferred to it at the time of deployment.

The ```payable``` keyword signifies that the function can receive money. Removing this keyword will make the smart contract reject the payment sent to it at the time of initialization.

**Fallback Function**
```javascript
...
  function () payable {
    updateTotalReceived();
  }
...
```
<br>

A fallback function is invoked whenever someone sends ether to the address of our contract's address. We've marked it as ```payable``` because who doesn't want money?

**A Normal Function**
```javascript
...
  function updateTotalReceived() internal {
    totalReceived += msg.value;
  }
...
```
<br>
Just because we wanted another function to update the ```totalReceived``` variable. We could've done without this function, but it would've meant writing two identical statements in the constructor and fallback function, programmers don't do that. (*Yeah yeah, I know, we did the same thing by invoking the fuction twice, but it is supposed to be better.*)

Also, ```msg``` is a variable containing all the details of the transaction, ```msg.value``` the number of wei (smallest unit of ether) sent, ```msg.sender``` is the address of the sender.

**Modifiers**
```javascript
...
  modifier canWithdraw() {
    bool contains = false;

    for(uint i =0; i < employees.length; i++) {
      if(employees[i] == msg.sender) {
        contains = true;
      }
    }

    require(contains); //this should be true for the function to proceed to the next line.
    _;
  }
...
```
<br>
*Modifiers* are there to change the behaviour of functions. For example, modifiers can check a condition prior to executing a function. In a Function Modifier, solidity replaces the **_;** by the body of the function, which in this case will be the ```withdraw()``` function's body. 

We're including a modifier in this smart contract just for the sake of familiarising ourselves with it, it's just checking one by one that the address which wants to invoke the ```withdraw()``` function is actually present in our array of employee addresses. The same could've been easily achieved by writing a similar check inside of our ```withdraw()``` function.

A better example would have been if we had 3 different kinds of withdraw() functions, each doing something differently, and each needed to check whether the address belongs to an employee, we won't have to write the same condition to verify that 3 times.

**Withdrawing Ether**
```javascript
...
  function withdraw() canWithdraw {
    uint amountAllocated = totalReceived/employees.length;
    uint amountWithdrawn = withdrawnAmounts[msg.sender];
    uint amount = amountAllocated - amountWithdrawn;
    withdrawnAmounts[msg.sender] = amountWithdrawn + amount;

    if(amount > 0){
      msg.sender.transfer(amount);
    }
  }
}
```
<br>
Just a simple withdraw function that does the following things: 
- Checks whether an employee or not, using the function modifier.
- Keeps a track of the amounts the employees have withdrawn previously.
- If the employee has already withdrawn his share, and the smart contract has received money after that, then the employee will be able to withdraw just the newly created share.
- Transfers the amount, to the address requesting ether.
---
**Note:** Every operation in a smart contract costs gas to execute, so you should minimize the number of operations in your smart contracts. We'll learn more about this in the coming tutorials.

---
# Deploying And Interacting with the Smart Contract
---

## Deploying on the Ethereum Network
We have coded our first smart contract, the employees will be so pissed if we don't deploy it on the network.

- Create two or more wallets for your employees and change the addresses in the ```employees``` array in the code.
- Open up ```Mist``` -> ```Contracts``` -> ```Deploy New Contract```
- Paste the contract code in the ```SOLIDITY CONTRACT SOURCE CODE``` field and select the contract ```PayEmployees``` to deploy. 
- Select an account to deploy the contract from, and change the ```AMOUNT``` field to however much you want to send to the smart contract initially.
- Leave the gas at suggested, and just deploy already!

![Screen Shot 2017-09-22 at 7.14.59 PM.png](https://steemitimages.com/DQmfRaWsqgNyhJedJN4HgKm2WsQxxaKHeuzySsBeJrcpFXN/Screen%20Shot%202017-09-22%20at%207.14.59%20PM.png)
<center>wait for it...</center>
![Screen Shot 2017-09-22 at 7.20.11 PM.png](https://steemitimages.com/DQmUGup2LZiS3cVWuXBT8bskN8KNomCmt2wbmCxve9wzTz1/Screen%20Shot%202017-09-22%20at%207.20.11%20PM.png)
<br>

## Interacting with the Smart Contract
- To withdraw money to the employee accounts you created in the beginning, go to ```Contracts``` -> ```Custom Contracts``` and select your smart contract.
- Just select the address you want to use while interacting with the smart contract, and select the function you want to invoke (```withdraw()``` in this case) and click ```Execute```. The smart contract will send the Ether and employee wallet balance should update in a minute or two.
- You can send the address of this contract to your employees, so that they know such a contract exists and they can withdraw money from it.

![Screen Shot 2017-09-22 at 7.27.23 PM.png](https://steemitimages.com/DQmXk8gdkZS12ezNsZsPCZUvQX88SHN8L9b7ze5Uq3ZrUpC/Screen%20Shot%202017-09-22%20at%207.27.23%20PM.png)

- To refill the smart contract with some more Ether, just send the Ether to it's address, and our fallback function should take care of the rest.
- Congratulations, you just created your first smart contract.
<br>

That's it for the *Getting Started With Smart Contracts*. Let's hope you enjoyed and understood how the pieces come together. Feel free to comment any improvements or doubts you have.
👍  , , , , , , , , , , , , , , , , , , , ,
json_metadata{"tags":["ethereum","programming","blockchain","cryptocurrency","smartcontracts"],"image":["https://i.imgsafe.org/52/528c7272b8.png","https://steemitimages.com/DQmZeEJprk6G5mdrEPThiVFdhe6NSsVdDFXdpHk4mUayXb7/Screen%20Shot%202017-09-21%20at%206.17.11%20PM.png","https://steemitimages.com/DQmbfF4pFZSBLvd6cv1Lnbt6H1TnQydMkyLpHwA6X54HNNQ/Screen%20Shot%202017-09-22%20at%207.43.55%20PM.png","https://steemitimages.com/DQmSmymiDNvQ85Pm65uutVasBogAnm9gLR1DCnnkPMgyWrV/Screen%20Shot%202017-09-22%20at%203.16.53%20PM.png","https://steemitimages.com/DQmfRaWsqgNyhJedJN4HgKm2WsQxxaKHeuzySsBeJrcpFXN/Screen%20Shot%202017-09-22%20at%207.14.59%20PM.png","https://steemitimages.com/DQmUGup2LZiS3cVWuXBT8bskN8KNomCmt2wbmCxve9wzTz1/Screen%20Shot%202017-09-22%20at%207.20.11%20PM.png","https://steemitimages.com/DQmXk8gdkZS12ezNsZsPCZUvQX88SHN8L9b7ze5Uq3ZrUpC/Screen%20Shot%202017-09-22%20at%207.27.23%20PM.png"],"links":["https://blockgeeks.com/guides/smart-contracts/","https://github.com/ethereum/mist/releases","https://gist.github.com/","https://faucet.rinkeby.io","http://remix.ethereum.org/","https://gist.githubusercontent.com/ryuzaki6488/42cb2d506ef5ec60db1f96a3470f8aca/raw/a54c0e08ad73da66b48f247fcc82eb04fdd4f845/PayEmployees.sol","http://solidity.readthedocs.io/en/develop/types.html"],"app":"steemit/0.1","format":"markdown"}
last_update2017-09-28 11:35:48
created2017-09-22 15:06:54
active2017-09-29 16:11:48
last_payout2017-09-29 15:06:54
depth0
children13
net_rshares0
vote_rshares0
children_abs_rshares0
cashout_time1969-12-31 23:59:59
max_cashout_time1969-12-31 23:59:59
total_vote_weight0
reward_weight10,000
total_payout_value0.776 SBD
curator_payout_value0.226 SBD
author_rewards644
net_votes20
root_comment13,494,095
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
allow_repliestrue
allow_votestrue
allow_curation_rewardstrue
beneficiaries[]
root_title"Ethereum Smart Contracts 101: Hello World"
pending_payout_value0.000 SBD
total_pending_payout_value0.000 STEEM
author_reputation12,058,979,176
promoted0.000 SBD
body_length0
reblogged_by[]
author_curate_reward""
vote details (21)

vote your-acct "ryuzakilost" "ethereum-smart-contracts-101-hello-world" 100 true
post_comment your-acct "re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20171017t100549450z" "ryuzakilost" "ethereum-smart-contracts-101-hello-world" "" "your reply.." "{}" true

View on official site
@bartosz546 ·
I like your tutorial. Have some problems with finding good ones.
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-09-22 15:20:03
active2017-09-22 15:20:03
last_payout2017-09-29 15:20:03
depth1
children0
net_rshares0
vote_rshares0
children_abs_rshares0
cashout_time1969-12-31 23:59:59
max_cashout_time1969-12-31 23:59:59
total_vote_weight0
reward_weight10,000
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
author_rewards0
net_votes0
root_comment13,494,095
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
allow_repliestrue
allow_votestrue
allow_curation_rewardstrue
beneficiaries[]
root_title"Ethereum Smart Contracts 101: Hello World"
pending_payout_value0.000 SBD
total_pending_payout_value0.000 STEEM
author_reputation214,915,215,548
promoted0.000 SBD
body_length0
reblogged_by[]

vote your-acct "bartosz546" "re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170922t152002898z" 100 true
post_comment your-acct "re-bartosz546-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20171017t100549455z" "bartosz546" "re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170922t152002898z" "" "your reply.." "{}" true

View on official site
@thelady ·
Amazing work!
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-09-22 15:39:09
active2017-09-22 15:39:09
last_payout2017-09-29 15:39:09
depth1
children0
net_rshares0
vote_rshares0
children_abs_rshares0
cashout_time1969-12-31 23:59:59
max_cashout_time1969-12-31 23:59:59
total_vote_weight0
reward_weight10,000
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
author_rewards0
net_votes0
root_comment13,494,095
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
allow_repliestrue
allow_votestrue
allow_curation_rewardstrue
beneficiaries[]
root_title"Ethereum Smart Contracts 101: Hello World"
pending_payout_value0.000 SBD
total_pending_payout_value0.000 STEEM
author_reputation12,649,185,622
promoted0.000 SBD
body_length0
reblogged_by[]

vote your-acct "thelady" "re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170922t153904562z" 100 true
post_comment your-acct "re-thelady-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20171017t100549461z" "thelady" "re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170922t153904562z" "" "your reply.." "{}" true

View on official site
@qagiri ·
Very well written with good examples!! :)
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-09-22 18:59:33
active2017-09-22 19:49:24
last_payout2017-09-29 18:59:33
depth1
children1
net_rshares0
vote_rshares0
children_abs_rshares0
cashout_time1969-12-31 23:59:59
max_cashout_time1969-12-31 23:59:59
total_vote_weight0
reward_weight10,000
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
author_rewards0
net_votes0
root_comment13,494,095
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
allow_repliestrue
allow_votestrue
allow_curation_rewardstrue
beneficiaries[]
root_title"Ethereum Smart Contracts 101: Hello World"
pending_payout_value0.000 SBD
total_pending_payout_value0.000 STEEM
author_reputation4,885,507,376,534
promoted0.000 SBD
body_length0
reblogged_by[]

vote your-acct "qagiri" "re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170922t185932484z" 100 true
post_comment your-acct "re-qagiri-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20171017t100549466z" "qagiri" "re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170922t185932484z" "" "your reply.." "{}" true

View on official site
@ryuzakilost ·
Thank you, I'm in process of improving it, there are still a few things I missed,  like the basic structure of a smart contract.  Will update it in a few hours, based on the feedback.
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-09-22 19:49:24
active2017-09-22 19:49:24
last_payout2017-09-29 19:49:24
depth2
children0
net_rshares0
vote_rshares0
children_abs_rshares0
cashout_time1969-12-31 23:59:59
max_cashout_time1969-12-31 23:59:59
total_vote_weight0
reward_weight10,000
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
author_rewards0
net_votes0
root_comment13,494,095
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
allow_repliestrue
allow_votestrue
allow_curation_rewardstrue
beneficiaries[]
root_title"Ethereum Smart Contracts 101: Hello World"
pending_payout_value0.000 SBD
total_pending_payout_value0.000 STEEM
author_reputation12,058,979,176
promoted0.000 SBD
body_length0
reblogged_by[]

vote your-acct "ryuzakilost" "re-qagiri-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170922t194927312z" 100 true
post_comment your-acct "re-ryuzakilost-re-qagiri-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20171017t100549470z" "ryuzakilost" "re-qagiri-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170922t194927312z" "" "your reply.." "{}" true

View on official site
@deveerei · (edited)
This looks great. Very detailed (but I'm not familiar with this field so everything is jargon to me haha). Are all of these instructions and screenshots yours (no references at all)? Do make an introduceyourself post about you, so people would know you more, it actually helps.
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
last_update2017-09-23 06:01:42
created2017-09-23 01:32:15
active2017-09-26 09:59:33
last_payout2017-09-30 01:32:15
depth1
children2
net_rshares0
vote_rshares0
children_abs_rshares0
cashout_time1969-12-31 23:59:59
max_cashout_time1969-12-31 23:59:59
total_vote_weight0
reward_weight10,000
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
author_rewards0
net_votes0
root_comment13,494,095
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
allow_repliestrue
allow_votestrue
allow_curation_rewardstrue
beneficiaries[]
root_title"Ethereum Smart Contracts 101: Hello World"
pending_payout_value0.000 SBD
total_pending_payout_value0.000 STEEM
author_reputation8,518,130,908,614
promoted0.000 SBD
body_length0
reblogged_by[]

vote your-acct "deveerei" "re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170923t013211237z" 100 true
post_comment your-acct "re-deveerei-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20171017t100549474z" "deveerei" "re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170923t013211237z" "" "your reply.." "{}" true

View on official site
@ryuzakilost ·
$0.04
Thank you @deveerei, and Yes, all the screenshots are mine. I'll do an introduction post later sometime.
👍  
json_metadata{"tags":["ethereum"],"users":["deveerei"],"app":"steemit/0.1"}
created2017-09-26 09:47:27
active2017-09-26 09:59:33
last_payout2017-10-03 09:47:27
depth2
children1
net_rshares0
vote_rshares0
children_abs_rshares0
cashout_time1969-12-31 23:59:59
max_cashout_time1969-12-31 23:59:59
total_vote_weight0
reward_weight10,000
total_payout_value0.033 SBD
curator_payout_value0.002 SBD
author_rewards23
net_votes1
root_comment13,494,095
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
allow_repliestrue
allow_votestrue
allow_curation_rewardstrue
beneficiaries[]
root_title"Ethereum Smart Contracts 101: Hello World"
pending_payout_value0.000 SBD
total_pending_payout_value0.000 STEEM
author_reputation12,058,979,176
promoted0.000 SBD
body_length0
reblogged_by[]
author_curate_reward""
vote details (1)

vote your-acct "ryuzakilost" "re-deveerei-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170926t094726311z" 100 true
post_comment your-acct "re-ryuzakilost-re-deveerei-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20171017t100549477z" "ryuzakilost" "re-deveerei-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170926t094726311z" "" "your reply.." "{}" true

View on official site
@deveerei ·
That will be really great. Do that and make another awesome post like this. I'll check out your blog again. Or try to reach me on Discord, @deveerei is my name there too.
json_metadata{"tags":["ethereum"],"users":["deveerei"],"app":"steemit/0.1"}
created2017-09-26 09:59:33
active2017-09-26 09:59:33
last_payout2017-10-03 09:59:33
depth3
children0
net_rshares0
vote_rshares0
children_abs_rshares0
cashout_time1969-12-31 23:59:59
max_cashout_time1969-12-31 23:59:59
total_vote_weight0
reward_weight10,000
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
author_rewards0
net_votes0
root_comment13,494,095
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
allow_repliestrue
allow_votestrue
allow_curation_rewardstrue
beneficiaries[]
root_title"Ethereum Smart Contracts 101: Hello World"
pending_payout_value0.000 SBD
total_pending_payout_value0.000 STEEM
author_reputation8,518,130,908,614
promoted0.000 SBD
body_length0
reblogged_by[]

vote your-acct "deveerei" "re-ryuzakilost-re-deveerei-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170926t095932547z" 100 true
post_comment your-acct "re-deveerei-re-ryuzakilost-re-deveerei-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20171017t100549479z" "deveerei" "re-ryuzakilost-re-deveerei-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170926t095932547z" "" "your reply.." "{}" true

View on official site
@bartosz546 ·
Tell me what am I doing wrong? 
<img src="https://image.ibb.co/jfOoB5/Untitled.jpg"/>
👍  
json_metadata{"tags":["ethereum"],"image":["https://image.ibb.co/jfOoB5/Untitled.jpg"],"app":"steemit/0.1"}
created2017-09-27 22:24:09
active2017-09-29 16:11:48
last_payout2017-10-04 22:24:09
depth1
children4
net_rshares0
vote_rshares0
children_abs_rshares0
cashout_time1969-12-31 23:59:59
max_cashout_time1969-12-31 23:59:59
total_vote_weight0
reward_weight10,000
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
author_rewards0
net_votes1
root_comment13,494,095
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
allow_repliestrue
allow_votestrue
allow_curation_rewardstrue
beneficiaries[]
root_title"Ethereum Smart Contracts 101: Hello World"
pending_payout_value0.000 SBD
total_pending_payout_value0.000 STEEM
author_reputation214,915,215,548
promoted0.000 SBD
body_length0
reblogged_by[]
author_curate_reward""
vote details (1)

vote your-acct "bartosz546" "re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170927t222407134z" 100 true
post_comment your-acct "re-bartosz546-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20171017t100549481z" "bartosz546" "re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170927t222407134z" "" "your reply.." "{}" true

View on official site
@ryuzakilost ·
Hi @bartosz546, Can you show me your contract code?
json_metadata{"tags":["ethereum"],"users":["bartosz546"],"app":"steemit/0.1"}
created2017-09-27 22:29:12
active2017-09-29 16:11:48
last_payout2017-10-04 22:29:12
depth2
children3
net_rshares0
vote_rshares0
children_abs_rshares0
cashout_time1969-12-31 23:59:59
max_cashout_time1969-12-31 23:59:59
total_vote_weight0
reward_weight10,000
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
author_rewards0
net_votes0
root_comment13,494,095
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
allow_repliestrue
allow_votestrue
allow_curation_rewardstrue
beneficiaries[]
root_title"Ethereum Smart Contracts 101: Hello World"
pending_payout_value0.000 SBD
total_pending_payout_value0.000 STEEM
author_reputation12,058,979,176
promoted0.000 SBD
body_length0
reblogged_by[]

vote your-acct "ryuzakilost" "re-bartosz546-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170927t222912812z" 100 true
post_comment your-acct "re-ryuzakilost-re-bartosz546-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20171017t100549483z" "ryuzakilost" "re-bartosz546-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170927t222912812z" "" "your reply.." "{}" true

View on official site
@bartosz546 · (edited)
I just copy paste your code. I made it again. Still Fails. 
The error tells:
Intristic gas too low.
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
last_update2017-09-28 10:05:06
created2017-09-28 09:57:18
active2017-09-29 16:11:48
last_payout2017-10-05 09:57:18
depth3
children2
net_rshares0
vote_rshares0
children_abs_rshares0
cashout_time1969-12-31 23:59:59
max_cashout_time1969-12-31 23:59:59
total_vote_weight0
reward_weight10,000
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
author_rewards0
net_votes0
root_comment13,494,095
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
allow_repliestrue
allow_votestrue
allow_curation_rewardstrue
beneficiaries[]
root_title"Ethereum Smart Contracts 101: Hello World"
pending_payout_value0.000 SBD
total_pending_payout_value0.000 STEEM
author_reputation214,915,215,548
promoted0.000 SBD
body_length0
reblogged_by[]

vote your-acct "bartosz546" "re-ryuzakilost-re-bartosz546-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170928t095719501z" 100 true
post_comment your-acct "re-bartosz546-re-ryuzakilost-re-bartosz546-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20171017t100549485z" "bartosz546" "re-ryuzakilost-re-bartosz546-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170928t095719501z" "" "your reply.." "{}" true

View on official site
@ryuzakilost · (edited)
@bartosz546, That's strange. I verified the code just now by redeploying the exact same code. I'm pretty sure, you must have taken care of all these things, but just to verify: 
- The account from which you are trying to deploy the contract has sufficient ethers (gas + initial value you want to send)
- You have updated the employee wallet addresses in the code with your own before deploying.
- The employee wallet addresses have enough funds to execute the withdraw function (because to call the withdraw method, you'll need to spend some gas)
- Try increasing the Maximum gas fee value in the screenshot by clicking the blue colored "0".

If things still don't work, please send me your exact code, with the updated variables.
json_metadata{"tags":["ethereum"],"users":["bartosz546"],"app":"steemit/0.1"}
last_update2017-09-28 10:51:48
created2017-09-28 10:51:03
active2017-09-29 16:11:48
last_payout2017-10-05 10:51:03
depth4
children1
net_rshares0
vote_rshares0
children_abs_rshares0
cashout_time1969-12-31 23:59:59
max_cashout_time1969-12-31 23:59:59
total_vote_weight0
reward_weight10,000
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
author_rewards0
net_votes0
root_comment13,494,095
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
allow_repliestrue
allow_votestrue
allow_curation_rewardstrue
beneficiaries[]
root_title"Ethereum Smart Contracts 101: Hello World"
pending_payout_value0.000 SBD
total_pending_payout_value0.000 STEEM
author_reputation12,058,979,176
promoted0.000 SBD
body_length0
reblogged_by[]

vote your-acct "ryuzakilost" "re-bartosz546-re-ryuzakilost-re-bartosz546-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170928t105104803z" 100 true
post_comment your-acct "re-ryuzakilost-re-bartosz546-re-ryuzakilost-re-bartosz546-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20171017t100549487z" "ryuzakilost" "re-bartosz546-re-ryuzakilost-re-bartosz546-re-ryuzakilost-ethereum-smart-contracts-101-hello-world-20170928t105104803z" "" "your reply.." "{}" true

View on official site
@bartosz546 ·
Ok, I found solution I was trying to execute contract from account I deployed it, but it is not employee.
json_metadata{"tags":"ethereum","app":"esteem/1.4.6","format":"markdown+html","community":"esteem"}
created2017-09-29 16:11:48
active2017-09-29 16:11:48
last_payout2017-10-06 16:11:48
depth5
children0
net_rshares0
vote_rshares0
children_abs_rshares0
cashout_time1969-12-31 23:59:59
max_cashout_time1969-12-31 23:59:59
total_vote_weight0
reward_weight10,000
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
author_rewards0
net_votes0
root_comment13,494,095
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
allow_repliestrue
allow_votestrue
allow_curation_rewardstrue
beneficiaries
0.
accountesteemapp
weight500
root_title"Ethereum Smart Contracts 101: Hello World"
pending_payout_value0.000 SBD
total_pending_payout_value0.000 STEEM
author_reputation214,915,215,548
promoted0.000 SBD
body_length0
reblogged_by[]

vote your-acct "bartosz546" "re-ryuzakilost-2017929t181139970z" 100 true
post_comment your-acct "re-bartosz546-re-ryuzakilost-2017929t181139970z-20171017t100549489z" "bartosz546" "re-ryuzakilost-2017929t181139970z" "" "your reply.." "{}" true

View on official site
@minnowpond ·
This post recieved an upvote from minnowpond. If you would like to recieve upvotes from minnowpond on all your posts, simply FOLLOW @minnowpond
json_metadata"{"app": "pysteem/0.5.4"}"
created2017-09-28 11:46:42
active2017-09-28 11:46:42
last_payout2017-10-05 11:46:42
depth1
children0
net_rshares0
vote_rshares0
children_abs_rshares0
cashout_time1969-12-31 23:59:59
max_cashout_time1969-12-31 23:59:59
total_vote_weight0
reward_weight10,000
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
author_rewards0
net_votes0
root_comment13,494,095
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
allow_repliestrue
allow_votestrue
allow_curation_rewardstrue
beneficiaries[]
root_title"Ethereum Smart Contracts 101: Hello World"
pending_payout_value0.000 SBD
total_pending_payout_value0.000 STEEM
author_reputation1,764,598,708,991
promoted0.000 SBD
body_length0
reblogged_by[]

vote your-acct "minnowpond" "re-ethereum-smart-contracts-101-hello-world-20170928t114640" 100 true
post_comment your-acct "re-minnowpond-re-ethereum-smart-contracts-101-hello-world-20170928t114640-20171017t100549491z" "minnowpond" "re-ethereum-smart-contracts-101-hello-world-20170928t114640" "" "your reply.." "{}" true


created by @roadscape