Ethereum react dapps

I finished my first dapp with (react-boilerplate)[https://github.com/mxstbr/] this week and here are the few things I learnt. I won’t get into the redux, redux-saga details, I let you play with the amazing boilerplate. Interacting with constant functions Let’s use the typical balanceOf function of the EIP20 contracts: function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } Here are the sagas (redux-sagas) I used to interact: import { take, call, put, cancel, select, fork } from 'redux-saga/effects'; import { BALANCE_OF_GET, } from '....

October 27, 2016 · 6 min · Me

Ethereum contracts and Golang

The contract contract Trigger { function () { throw; } address owner; function Trigger() { owner = msg.sender; } event TriggerEvt(address _sender, uint _trigger); function trigger(uint _trigger) { TriggerEvt(msg.sender, _trigger); } function getOwner() constant returns (address) { return owner; } } This is a very simple contract that we will take as an example. Getting the right tools for binding A good starting point is this wiki. You will need to follow the install procedure of go-ethereum....

October 10, 2016 · 3 min · Me

Blockchain week in Shanghai!

I participated to the devcon2 and blockchain summit last week. Here is my summary!

September 16, 2016 · 1 min · Me

Ethereum first dapp - part 3

setting up a light wallet In order to have a setup close to what the DAPP would be, we will use (metamask) [http://www.metamask.io] as a light wallet (there are other choices). Metamask allows you to connect to a custom node. We will then connect to our node, http://localhost:9012 If everthing is fine, metamasks should indicate it’s connected. Then, we can import the metamask account to our local node by simply specifying the datadir we have setup the node data....

August 12, 2016 · 1 min · Me

Ethereum first dapp - part 2

Frontend Prepare your folder for your dapp I will be using https://github.com/mxstbr/react-boilerplate as it’s quite nice and I’ve been playing with React for a bit now. I will not go into the details of setting this up, it’s a totally different topic. If you are not familiar with it, it’s probably a waste of time for you to read. Example web3 component with React This boilerplate uses immutable, redux and redux-sagas in order to deal with data....

August 10, 2016 · 3 min · Me

Ethereum first dapp - part 1

Contracts Prepare your folder for your dapp mkdir dapp inside this folder, we’ll create one folder for truffle, one for geth. cd dapp mkdir truffle geth inside the geth folder, simply put the customGenesis block you can find in the ethereum-dev-environment blog post. We are going to use two Ethereum clients, one for tests and devs, testrpc and one for a more real interaction, geth. Let’s install truffle and testrpc...

August 8, 2016 · 4 min · Me

Interacting with an Ethereum smart contract

Check the address of the current deployed contract Remember when you mined your contract, it told your its address. Now, reuse it! eth.getCode("0x5f3425ccedeae0eb36521c4cf93ec6544dbad9bd") Test the contract with a simple interaction get the latest web3-light.min.js js from https://github.com/ethereum/web3.js/releases and simply copy the dist/web3-light.min.js into the same folder as the following HTML file. then, use this html to interact with your contract on the local node: <!doctype> <html> <head> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bignumber.js/2.4.0/bignumber.min.js"></script> <script type="text/javascript" src="....

August 3, 2016 · 2 min · Me

Ethereum first smart contract

Launch your geth (or testrpc) private instance ./geth \ --identity "gethTest" \ --rpc --rpcport "9012" \ --rpccorsdomain "YOUR_TEST_DOMAIN_APP_RUN_FROM" \ --datadir "./testChain" \ --port "30303" \ --nodiscover \ --rpcapi "db,eth,net,web3" \ --networkid 1999 \ --dev console Within the console, compile your contract check this tutorial: https://www.ethereum.org/greeter I had an issue when I followed the contract tutorial, my contract would not be mined after I was trying to deploy it. The issue was that my account was locked :/ and the greeter contract stupidly silently fails… Here is the modified code to see the obvious error....

August 3, 2016 · 2 min · Me

Ethereum dev environment

Part 1 - Setup your ethereum node There are many ways you can setup a node to dev an Ethereum dapp. You can use the live network: not advisable obviously for cost and speed reasons. You can use the test network: not advisable for speed reasons. You can use a testchain set up with Geth: easy but a bit tedious as you need to mine. You can the ethereum testrpc: easiest!...

August 1, 2016 · 2 min · Me