Posts

Showing posts with the label #ethereumjs

Crypto-Currency "Coin Contract" Example

Image
So here is my starting point pragma solidity ^0.4.18; //Used like an Interface in C# or Java contract Token { function totalSupply() public constant returns (uint256 supply) {} function balanceOf(address _owner) public constant returns (uint256 balance) {} function transfer(address _to, uint256 _value) public returns (bool success) {} function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {} function approve(address _spender, uint256 _value) public returns (bool success) {} function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {} //needed to Log the Events event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract StandardToken is Token { mapping (address => uint256) balances; mapping (address => mapping (address => uint25...

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="...

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...