Posts

Showing posts with the label #EthereumTools

Creating Decentralized Apps Part 2

In this post i will be using javascript to call a contract deployed using Remix IDE and ethereum-js Test RPC(nodeJs) The contract being deployed is pragma solidity ^0.4.0; contract NumberGetNextNumberAresh{ uint index; function getNumber() returns (uint) { index = index + 1; return index; } function myConstantMethod(string a) constant returns (string d) { return a; } function myConstantNumber() constant returns (uint) { return index; } } To get the ABI or  "Interface ABI"   Follow this POST for the "Contract Address" Follow this POST After Deploying you should now be ready to create a UI (interface with html) The html will contain javascript as well <html> <head> <title>Smart Contract Ethereum</title> </head> <body> <fieldset> <button onclick="send()">Send Data</button> <button onclick="...

"Donation Contract" Example

Image
So in this Post i will be writing a Donation Contract. The idea is, The Creator Creates the contract. another person wants to Donate a certain amount of Ether to the Creator. Warning: Tests done with Remix, i can be the creator and send ether to myself without deduction of my own ether. (Im not sure why it allows this.) ideally if i dont have enough ether, it has to revert back, but it doesnt.  (Please help me by commenting Below) pragma solidity ^0.4.0; contract DonationAresh { address creator; //this is Aresh function DonationAresh() public{ creator = msg.sender; } //fall back function that gets an amount of ether and sends to Creator function () payable public{ safeMoney(msg.value); } //send the amount to the creator function safeMoney(uint amountRaised) private{ creator.send(amountRaised); } } So from the Remix IDE there are 5 Accounts. im using the first account as the Creator of the Contr...

Testing using MetaMask Part 2 "Executing the Contract"

Image
Before writing any javascript code we first need to deploy the contract after deploying we will need 2 things 1. The Contract address 2. The Contract ABI In the next post i will be showing how to use the "web3 Deploy" to get the Contract Address. On the Remix - Solidity IDE. Make sure you are on the "Compile" Tab. Click on the "Details" Button for a popup. scroll down to see the "Interface ABI". (Not needed if you are using Remix IDE) Deploy the contract using the "Web3 Deploy" to get the Contract Address  (Not needed if you are using Remix IDE) Make sure you have Remix IDE open with MetaMask. You will notice the Account Number and number of Ether match. Make sure you have selected "Injected Web3"  Click the "Create" to see a popup Window Requesting for the Transaction. Click "Submit" to Accept the transaction. You will need to wait a minimum of 15 Seconds. In my case i waited ...

The Language of Ethereum Smart Contracts

This Post will be updated Constantly as i progress SOURCE: https://solidity.readthedocs.io/en/develop/ The language to create Ethereum Smart Contracts is "Solidity" There are many integrations for solidity, i will be using Remix mostly as it does not require any additional installations and can run on the latest Chrome Browser Available Solidity Integrations Remix Browser-based IDE with integrated compiler and Solidity runtime environment without server-side components. Geth  For running Ethereum nodes, i will be using Geth https://github.com/ethereum/go-ethereum/wiki/geth as the command line interface. Some advantages with geth, is it allows interaction between the smart contract and creation of a private block-chain network for testing. Capabilities By installing and running  geth , you can take part in the ethereum frontier live network and mine real ether transfer funds between addresses create contracts and send transactions explore...