From d133808c5f32db2b95232b7d897f2b85e3abb387 Mon Sep 17 00:00:00 2001 From: Rob Stupay Date: Mon, 13 Apr 2020 22:19:48 -0400 Subject: [PATCH] Update conf.py with comments for docs build & rm geth-remix tutorial --- docs/conf.py | 7 +- docs/tutorial_geth-remix.md | 279 ------------------------------------ 2 files changed, 4 insertions(+), 282 deletions(-) delete mode 100644 docs/tutorial_geth-remix.md diff --git a/docs/conf.py b/docs/conf.py index bfc760e4722..4d4ccac4ebf 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -288,9 +288,10 @@ # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False -# Remove this two lines if 'recommonmark' is in extensions array (at line 33) and sphinx version is v1.0.0 -from recommonmark.parser import CommonMarkParser -source_parsers = {'.md': CommonMarkParser} + +# Uncomment these two lines with sphinx version 1.0.0 +# from recommonmark.parser import CommonMarkParser +# source_parsers = {'.md': CommonMarkParser} # app setup hook diff --git a/docs/tutorial_geth-remix.md b/docs/tutorial_geth-remix.md deleted file mode 100644 index ec096a1fda1..00000000000 --- a/docs/tutorial_geth-remix.md +++ /dev/null @@ -1,279 +0,0 @@ -Debugging a Dapp using Remix & Geth -========================================== - -The ultimate goal of this tutorial is to debug transactions that have -been created by a dapp front end. - -It is easy in Remix to debug a transaction created from its own GUI. -However, setting up an environment that allows you to debug transactions -created outside of Remix, require a bit more of complexity. - -We will need four tools for that : - -> - Geth - this is the center piece and provides the blockchain -> environment. We will basically run geth in a dev mode. -> - Remix - this is the Ethereum IDE. We will use it to develop our -> Solidity contract. -> - Any code editor you want - in order to write your front end :) - -Install the environment ------------------------ - -### Install Metamask - -Basically we will run our front end in the Metamask Chrome plugin ([Metamask](http://metamask.io)). - -### Install Geth - -[Geth](http://github.com/ethereum/go-ethereum/releases) is the official -Ethereum client. - -Running the environment ------------------------ - -### Run Geth - -We will run a test node. This node will have a new empty state and will -not be synced to the main or ropsten network. - - geth --ipcpath /geth.ipc --datadir --dev console - -`` is the folder where keys and chain data will be -stored. - -`--ipcpath` defines the end point that other apps (like Metamask) use to -talk to geth. - -`--datadir` specifies the data directory. - -`--dev` sets the node into private chain mode and adds some debugging -flags. - -Then we need to create accounts and mine a bit to generate some Ether: - - // from the geth console : - personal.newAccount() // You can execute this command several time if you need more than one account. - miner.start() // generate some Ether. - miner.stop() // stop mining after 30s-60s - we could also keep mining. - -Next time we run Geth, we will only need to mine transactions (no need -to recreate account). - - -### Starting Remix - -In Mist click on `Develop` / `Open Remix IDE` - -Remix will open in a new window. If this is the first time it is run, -the `Ballot` contract will be loaded. - -Now, we need to check if Remix is connected to Mist: - -Right panel / third tab from the left, `Injected Provider` should be -checked. - -![image](remix4.png) - -Right panel / second tab from the left, `Transaction Origin` should -contain accounts we have previously created in Geth. - -![image](remix5.png) - -Developing contract / front end -------------------------------- - -### Donation contract - Dapp Back end - -Here is a sample solidity contract. - -Copy and paste the following inside remix: - -``` -{.sourceCode .none} -contract Donation { - address owner; - event fundMoved(address _to, uint _amount); - modifier onlyowner { if (msg.sender == owner) _; } - address[] _giver; - uint[] _values; - - function Donation() { - owner = msg.sender; - } - - function donate() payable { - addGiver(msg.value); - } - - function moveFund(address _to, uint _amount) onlyowner { - uint balance = this.balance; - uint amount = _amount; - if (_amount <= this.balance) { - if (_to.send(this.balance)) { - fundMoved(_to, _amount); - } else { - throw; - } - } else { - throw; - } - } - - function addGiver(uint _amount) internal { - _giver.push(msg.sender); - _values.push(_amount); - } -} -``` - -### Dapp Front end - -and here is the front end: - -```html -
-
Donation Contract
-
- -
-
-
- -
-
- -
-
-
-
-
-
-
-
-
- - -``` - -I would suggest serving this file using `http-serve`, but you can use -any web server you like. - -Example: Dapp Front End - -### Important notice ! - -The variable `contractspec` contains the abi of the `donation` contract. -This means that if you change something in the contract interface -(function names, parameters, ...) you need to copy the new abi from -remix to the front end. - -Deploying ---------- - -Right panel / Red button `Create` - -![image](remix1.png) - -This creates a new transaction that deploys the `Donation` contract -(Mist will ask for the usual passphrase check). - -Wait for the transaction to be mined (don't forget to activate mining -`miner.start()`). Once this is done, you can use it by executing the -`moveFund` and `donate` function. But this is not what we want to -achieve. We want to run and debug those functions from the front end. - -Remix also display the address of the contract. Save it, we'll need this -address later. - -![image](remix2.png) - -Debugging ---------- - -From Mist, browse the above front end. In the first field, paste the -address of the newly created contract. Now, let's call the first -function (label `give`). - -You will need an account and a value. - -The account could be any account that is declared in the Wallet section -of Mist. This is the sender of the transaction that we are going to -create. The value should be no more than the actual balance of the -account - the unit is in wei, so just put `100` (100 wei), that should -be fine. - -Click on `Give` and wait for the transaction to be mined. - -The HTML block with id `log` is filled by all the transactions created -from the front end. It was easier for the purpose of this tutorial to -just log transactions in a div but you can have your own logging -mechanism. - -There is only one field that we need, this is the `transactionHash`. - -Copy it and switch to Remix. On the right side, the fifth panel shows a -small "bug" icon, that is the debugger. - -Paste the hash into the transaction field and click on the `play` -button. - -![image](remix3.png) - -You are now entering a debug session for the call to `donate`. - -Debugging in Remix is easier than with common tools like gdb because you -can freely move in time. Use the slider to change the current step and -click on the panels below to expand them and explore the curret state, -local variables, etc. There are also breakpoints to move between -sections of the code quickly, but more on all that later. - -At the time of this writing, there is an issue that could break the -contract creation. The a workaround for that at - . Please follow -the workaround or wait for this issue to be closed. - -Also, although retrieving a contract's storage when Remix is using the -JavaScript VM is working well, there is still work to be done when Remix -is using eth or geth as backend.