Skip to content

Commit

Permalink
Merge pull request #1 from EthereumGasStation/deployer
Browse files Browse the repository at this point in the history
Deployer
  • Loading branch information
sponnet committed May 2, 2018
2 parents 5e193ac + 4c68153 commit 5f98905
Show file tree
Hide file tree
Showing 8 changed files with 913 additions and 471 deletions.
80 changes: 80 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,83 @@
[![Coverage Status](https://coveralls.io/repos/github/EthereumGasStation/ethereumgasstation/badge.svg)](https://coveralls.io/github/EthereumGasStation/ethereumgasstation)

Simpler Ethereum GasStation

## Deploy your own gasstation

### Setup

checkout the repo then run

```
npm install
```

### Create a set of keypairs

```
truffle exec ./scripts/mkkp.js
```

This should output the following

```
written owner account to <path>/ethereumgasstation/gasstationowner.json
owner= 0xb985effab2481828ab5d15109b2835ba5e748bfa
written signer account to <path>/ethereumgasstation/gasstationsigner.json
signer= 0x1028e1276e16012f7afd0b863225e1351fa024d6
```

This script create 2 files called `gasstationowner.json` and `gasstationsigner.json` in the project folder. *keep these files secure and back them up.*


### Fund the owner key

Send around 0.1 ETH to the public key of the owner.

If you're on Ropsten you can use the faucet available here : http://faucet.ropsten.be/

### Deploy your gasstation

Deploy your gasstation ( to Ropsten in this case )

```
truffle --network ropsten migrate --reset
```

outputs

```
...
Replacing GasStation...
... 0xdcd2791b8708fe5af993a715dc18a888dc04c1958ce86ae2dc897b0ab28181c4
GasStation: 0x8393249596b812af26fa128d15202e4818276403
Saving artifacts...
```

Now the deployed gasstation address is shown (`0x8393249596b812af26fa128d15202e4818276403` in this example) - write this down too.

## Put some ETH on your accounts

* Put some ETH on the gasstation contract (ex. 1 ETH - this will be the gas that is sold to your clients).
* Put some ETH on the signer address (ex. 0.5 ETH - this account will send the upfront gas & execute the transactions on behalf of the client)

( again if you're on Ropsten - use the faucet )

## Ready to go !

Your gasstation contract and accounts are now ready to go.

The blockchain part is done.

Now lease proceed to the https://github.com/EthereumGasStation/ethereumgasstationserver to set up your gasstation server.


## Maintaining your gasstation

TODO





27 changes: 24 additions & 3 deletions migrations/1_initial_migration.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
//var Migrations = artifacts.require("./Migrations.sol");
const GasStation = artifacts.require("./GasStation.sol");
const fs = require('fs');
const path = require('path');
const signerFileName = path.join(__dirname, '..', 'gasstationsigner.json');

module.exports = function(deployer) {
// deployer.deploy(Migrations);
module.exports = function(deployer, network, accounts) {
var signerAccount = null;
if (fs.existsSync(signerFileName)) {
signerAccount = require(signerFileName);
}
if (!signerAccount) {
console.log('please create a pubkey file', signerFileName, 'for the SIGNER address. see the README.md');
} else {
const signerAddress = signerAccount.public;
const maxGas = 1e16;
console.log('deploying gasstation. Parameters: ');
console.log('owner address =', accounts[0]);
console.log('signer address =', signerAddress);
console.log('maxgas =', maxGas);
deployer.deploy(GasStation, signerAddress, maxGas, {
//gasprice: 1e6,
gas: 4600000,
from: accounts[0]
});
}
};

0 comments on commit 5f98905

Please sign in to comment.