Merge branch 'staging' into update/accountBalances

This commit is contained in:
Dustin Brickwood 2018-08-08 17:45:11 -04:00 committed by GitHub
commit e1a36f6d89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 1091 additions and 328 deletions

11
.gitignore vendored
View file

@ -14,7 +14,7 @@
*/**/*tx_database*
*/**/*dapps*
build/_vendor/pkg
privatenet/
#*
.#*
*#
@ -52,3 +52,12 @@ shyftData/*
shyft-cli/web3/token_test/node_modules
shyft-cli/web3/transfer-through-master/node_modules
shyft-cli/web3/transfer-through-master/build
# Remove pg data
pg-data/*
# Ignore shyftBlockExplorerApi vendored dependencies used for docker build
shyftBlockExplorerApi/vendor/**/.git
shyftBlockExplorerApi/vendor/*
!shyftBlockExplorerApi/vendor/*.json

161
README.md
View file

@ -2,10 +2,8 @@
Official golang implementation of the Ethereum protocol.
[![API Reference](
https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f676f6c616e672f6764646f3f7374617475732e737667
)](https://godoc.org/github.com/ethereum/go-ethereum)
[![Go Report Card](https://goreportcard.com/badge/github.com/ethereum/go-ethereum)](https://goreportcard.com/report/github.com/ethereum/go-ethereum)
[![API Reference](https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f676f6c616e672f6764646f3f7374617475732e737667)](https://godoc.org/github.com/empyrean/go-ethereum)
[![Go Report Card](https://goreportcard.com/badge/github.com/empyrean/go-ethereum)](https://goreportcard.com/report/github.com/empyrean/go-ethereum)
[![Build Status](https://travis-ci.org/ShyftNetwork/shyft_go-ethereum.svg?branch=master)](https://travis-ci.org/ShyftNetwork/shyft_go-ethereum)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ethereum/go-ethereum?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
@ -15,7 +13,7 @@ Binary archives are published at https://geth.ethereum.org/downloads/.
## Building the source
For prerequisites and detailed build instructions please read the
[Installation Instructions](https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum)
[Installation Instructions](https://github.com/empyrean/go-ethereum/wiki/Building-Ethereum)
on the wiki.
Building geth requires both a Go (version 1.7 or later) and a C compiler.
@ -33,9 +31,9 @@ or, to build the full suite of utilities:
The go-ethereum project comes with several wrappers/executables found in the `cmd` directory.
| Command | Description |
|:----------:|-------------|
| **`geth`** | Our main Ethereum CLI client. It is the entry point into the Ethereum network (main-, test- or private net), capable of running as a full node (default) archive node (retaining all historical state) or a light node (retrieving data live). It can be used by other processes as a gateway into the Ethereum network via JSON RPC endpoints exposed on top of HTTP, WebSocket and/or IPC transports. `geth --help` and the [CLI Wiki page](https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options) for command line options. |
| `abigen` | Source code generator to convert Ethereum contract definitions into easy to use, compile-time type-safe Go packages. It operates on plain [Ethereum contract ABIs](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI) with expanded functionality if the contract bytecode is also available. However it also accepts Solidity source files, making development much more streamlined. Please see our [Native DApps](https://github.com/ethereum/go-ethereum/wiki/Native-DApps:-Go-bindings-to-Ethereum-contracts) wiki page for details. |
| :-----------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`geth`** | Our main Ethereum CLI client. It is the entry point into the Ethereum network (main-, test- or private net), capable of running as a full node (default) archive node (retaining all historical state) or a light node (retrieving data live). It can be used by other processes as a gateway into the Ethereum network via JSON RPC endpoints exposed on top of HTTP, WebSocket and/or IPC transports. `geth --help` and the [CLI Wiki page](https://github.com/empyrean/go-ethereum/wiki/Command-Line-Options) for command line options. |
| `abigen` | Source code generator to convert Ethereum contract definitions into easy to use, compile-time type-safe Go packages. It operates on plain [Ethereum contract ABIs](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI) with expanded functionality if the contract bytecode is also available. However it also accepts Solidity source files, making development much more streamlined. Please see our [Native DApps](https://github.com/empyrean/go-ethereum/wiki/Native-DApps:-Go-bindings-to-Ethereum-contracts) wiki page for details. |
| `bootnode` | Stripped down version of our Ethereum client implementation that only takes part in the network node discovery protocol, but does not run any of the higher level application protocols. It can be used as a lightweight bootstrap node to aid in finding peers in private networks. |
| `evm` | Developer utility version of the EVM (Ethereum Virtual Machine) that is capable of running bytecode snippets within a configurable environment and execution mode. Its purpose is to allow isolated, fine-grained debugging of EVM opcodes (e.g. `evm --code 60ff60ff --debug`). |
| `gethrpctest` | Developer utility tool to support our [ethereum/rpc-test](https://github.com/ethereum/rpc-tests) test suite which validates baseline conformity to the [Ethereum JSON RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC) specs. Please see the [test suite's readme](https://github.com/ethereum/rpc-tests/blob/master/README.md) for details. |
@ -46,7 +44,7 @@ The go-ethereum project comes with several wrappers/executables found in the `cm
## Running geth
Going through all the possible command line flags is out of scope here (please consult our
[CLI Wiki page](https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options)), but we've
[CLI Wiki page](https://github.com/empyrean/go-ethereum/wiki/Command-Line-Options)), but we've
enumerated a few common parameter combos to get you up to speed quickly on how you can run your
own Geth instance.
@ -63,12 +61,12 @@ $ geth console
This command will:
* Start geth in fast sync mode (default, can be changed with the `--syncmode` flag), causing it to
- Start geth in fast sync mode (default, can be changed with the `--syncmode` flag), causing it to
download more data in exchange for avoiding processing the entire history of the Ethereum network,
which is very CPU intensive.
* Start up Geth's built-in interactive [JavaScript console](https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console),
- Start up Geth's built-in interactive [JavaScript console](https://github.com/empyrean/go-ethereum/wiki/JavaScript-Console),
(via the trailing `console` subcommand) through which you can invoke all official [`web3` methods](https://github.com/ethereum/wiki/wiki/JavaScript-API)
as well as Geth's own [management APIs](https://github.com/ethereum/go-ethereum/wiki/Management-APIs).
as well as Geth's own [management APIs](https://github.com/empyrean/go-ethereum/wiki/Management-APIs).
This too is optional and if you leave it out you can always attach to an already running Geth instance
with `geth attach`.
@ -88,22 +86,22 @@ testnet too. Please see above for their explanations if you've skipped to here.
Specifying the `--testnet` flag however will reconfigure your Geth instance a bit:
* Instead of using the default data directory (`~/.ethereum` on Linux for example), Geth will nest
- Instead of using the default data directory (`~/.ethereum` on Linux for example), Geth will nest
itself one level deeper into a `testnet` subfolder (`~/.ethereum/testnet` on Linux). Note, on OSX
and Linux this also means that attaching to a running testnet node requires the use of a custom
endpoint since `geth attach` will try to attach to a production node endpoint by default. E.g.
`geth attach <datadir>/testnet/geth.ipc`. Windows users are not affected by this.
* Instead of connecting the main Ethereum network, the client will connect to the test network,
- Instead of connecting the main Ethereum network, the client will connect to the test network,
which uses different P2P bootnodes, different network IDs and genesis states.
*Note: Although there are some internal protective measures to prevent transactions from crossing
_Note: Although there are some internal protective measures to prevent transactions from crossing
over between the main network and test network, you should make sure to always use separate accounts
for play-money and real-money. Unless you manually move accounts, Geth will by default correctly
separate the two networks and will not make any accounts available between them.*
separate the two networks and will not make any accounts available between them._
### Full node on the Rinkeby test network
The above test network is a cross client one based on the ethash proof-of-work consensus algorithm. As such, it has certain extra overhead and is more susceptible to reorganization attacks due to the network's low difficulty / security. Go Ethereum also supports connecting to a proof-of-authority based test network called [*Rinkeby*](https://www.rinkeby.io) (operated by members of the community). This network is lighter, more secure, but is only supported by go-ethereum.
The above test network is a cross client one based on the ethash proof-of-work consensus algorithm. As such, it has certain extra overhead and is more susceptible to reorganization attacks due to the network's low difficulty / security. Go Ethereum also supports connecting to a proof-of-authority based test network called [_Rinkeby_](https://www.rinkeby.io) (operated by members of the community). This network is lighter, more secure, but is only supported by go-ethereum.
```
$ geth --rinkeby console
@ -123,7 +121,7 @@ To get an idea how the file should look like you can use the `dumpconfig` subcom
$ geth --your-favourite-flags dumpconfig
```
*Note: This works only with geth v1.6.0 and above.*
_Note: This works only with geth v1.6.0 and above._
#### Docker quick start
@ -144,7 +142,7 @@ Do not forget `--rpcaddr 0.0.0.0`, if you want to access RPC from other containe
As a developer, sooner rather than later you'll want to start interacting with Geth and the Ethereum
network via your own programs and not manually through the console. To aid this, Geth has built in
support for a JSON-RPC based APIs ([standard APIs](https://github.com/ethereum/wiki/wiki/JSON-RPC) and
[Geth specific APIs](https://github.com/ethereum/go-ethereum/wiki/Management-APIs)). These can be
[Geth specific APIs](https://github.com/empyrean/go-ethereum/wiki/Management-APIs)). These can be
exposed via HTTP, WebSockets and IPC (unix sockets on unix based platforms, and named pipes on Windows).
The IPC interface is enabled by default and exposes all the APIs supported by Geth, whereas the HTTP
@ -153,19 +151,19 @@ These can be turned on/off and configured as you'd expect.
HTTP based JSON-RPC API options:
* `--rpc` Enable the HTTP-RPC server
* `--rpcaddr` HTTP-RPC server listening interface (default: "localhost")
* `--rpcport` HTTP-RPC server listening port (default: 8545)
* `--rpcapi` API's offered over the HTTP-RPC interface (default: "eth,net,web3")
* `--rpccorsdomain` Comma separated list of domains from which to accept cross origin requests (browser enforced)
* `--ws` Enable the WS-RPC server
* `--wsaddr` WS-RPC server listening interface (default: "localhost")
* `--wsport` WS-RPC server listening port (default: 8546)
* `--wsapi` API's offered over the WS-RPC interface (default: "eth,net,web3")
* `--wsorigins` Origins from which to accept websockets requests
* `--ipcdisable` Disable the IPC-RPC server
* `--ipcapi` API's offered over the IPC-RPC interface (default: "admin,debug,eth,miner,net,personal,shh,txpool,web3")
* `--ipcpath` Filename for IPC socket/pipe within the datadir (explicit paths escape it)
- `--rpc` Enable the HTTP-RPC server
- `--rpcaddr` HTTP-RPC server listening interface (default: "localhost")
- `--rpcport` HTTP-RPC server listening port (default: 8545)
- `--rpcapi` API's offered over the HTTP-RPC interface (default: "eth,net,web3")
- `--rpccorsdomain` Comma separated list of domains from which to accept cross origin requests (browser enforced)
- `--ws` Enable the WS-RPC server
- `--wsaddr` WS-RPC server listening interface (default: "localhost")
- `--wsport` WS-RPC server listening port (default: 8546)
- `--wsapi` API's offered over the WS-RPC interface (default: "eth,net,web3")
- `--wsorigins` Origins from which to accept websockets requests
- `--ipcdisable` Disable the IPC-RPC server
- `--ipcapi` API's offered over the IPC-RPC interface (default: "admin,debug,eth,miner,net,personal,shh,txpool,web3")
- `--ipcpath` Filename for IPC socket/pipe within the datadir (explicit paths escape it)
You'll need to use your own programming environments' capabilities (libraries, tools, etc) to connect
via HTTP, WS or IPC to a Geth node configured with the above flags and you'll need to speak [JSON-RPC](http://www.jsonrpc.org/specification)
@ -194,15 +192,17 @@ and agree upon. This consists of a small JSON file (e.g. call it `genesis.json`)
"eip155Block": 0,
"eip158Block": 0
},
"alloc" : {},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x20000",
"extraData" : "",
"gasLimit" : "0x2fefd8",
"nonce" : "0x0000000000000042",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00"
"alloc": {},
"coinbase": "0x0000000000000000000000000000000000000000",
"difficulty": "0x20000",
"extraData": "",
"gasLimit": "0x2fefd8",
"nonce": "0x0000000000000042",
"mixhash":
"0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash":
"0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp": "0x00"
}
```
@ -228,7 +228,8 @@ $ geth init path/to/genesis.json
#### Creating the rendezvous point
With all nodes that you want to run initialized to the desired genesis state, you'll need to start a
bootstrap node that others can use to find each other in your network and/or over the internet. The
bootstrap node that others can use to find each other in your
network and/or over the internet. The
clean way is to configure and run a dedicated bootnode:
```
@ -241,7 +242,7 @@ that other nodes can use to connect to it and exchange peer information. Make su
displayed IP address information (most probably `[::]`) with your externally accessible IP to get the
actual `enode` URL.
*Note: You could also use a full fledged Geth node as a bootnode, but it's the less recommended way.*
_Note: You could also use a full fledged Geth node as a bootnode, but it's the less recommended way._
#### Starting up your member nodes
@ -254,8 +255,8 @@ private network separated, so do also specify a custom `--datadir` flag.
$ geth --datadir=path/to/custom/data/folder --bootnodes=<bootnode-enode-url-from-above>
```
*Note: Since your network will be completely cut off from the main and test networks, you'll also
need to configure a miner to process transactions and create new blocks for you.*
_Note: Since your network will be completely cut off from the main and test networks, you'll also
need to configure a miner to process transactions and create new blocks for you._
#### Running a private miner
@ -280,6 +281,7 @@ limit blocks converge to (`--targetgaslimit`) and the price transactions are acc
## SHYFT NOTES
#### CLI
Run `./shyft-geth.sh` with one of the following flags:
- `--setup` - Setups postgres and the shyft chain db.
@ -287,6 +289,63 @@ Run `./shyft-geth.sh` with one of the following flags:
- `--reset` - Drops postgress and chain db, and reinstantiates both.
- `--js [web3 filename]` - Executes web3 calls with a passed file name. If the file name is `sendTransactions.js`, `./shyft-geth.sh --js sendTransactions`.
#### Docker Images
Docker Images are available for ShyftGeth and the Postgresql Database which can be used for development and testing. To launch these containers you will need to have docker-compose installed on your computer. Installation instructions for docker-compose are available [here](https://docs.docker.com/install/).
To launch ShyftGeth, PG, the ShyftBlock Explorer Api and UI - issue the following command from the root of the project directory:
`docker-compose up`
If you would like to reinitialize/rebuild the docker images you can issue the following command:
`docker-compose up --build`
To rebuild any one of the services - issue the following commands:
```
docker-compose up -d --no-deps --build <docker compose file service name>
# ie. for shyftBlockExplorerApi:
# docker-compose up -d --no-deps --build shyft_block_api
```
__The Postgresql Database Container will persist the database data to the the ./pg-data directory__. So if you do want to reinitialize the database you should delete the content of this directory prior to launching the docker containers. From your local machine you can view the database by connecting to the database in the container at 127.0.0.1:8001. To access the shyftBlockExplorer open a browser and visit http://localhost:3000
__Blockchain data is persisted to ./privatenet/.ethash__. If you would like to reset the test blockchain you will need to delete the ./privatenet directory.
The docker container for the ShyftBlockExplorerApi utilizes govendor to minimize its image size. __If you would like the docker image for this container to reflect any uncommitted changes which may have occurred in the go-empyrean repository, ie. changes with respect to go-empyrean core (ie. cryptographic functions and database). Prior to launching the docker containers you should rebuild the vendor directory for the shyftBlockExplorerApi - by executing the following steps:__
```
# remove existing shyftBlockExplorerApi vendor.json and vendored components:
rm -rf shyftBlockExplorerApi/vendor
# reinitialize vendor.json
cd shyftBlockExplorerApi && govendor init
# rebuild vendor.json using latest uncommitted changes
govendor add -tree -uncommitted +external
# due to a bug in govendor and it not being able to pull in some dependencies that are c-header files
# you should execute the following commands - see these issues - which whilst closed
# appears to have not been fixed: https://github.com/kardianos/govendor/issues/124 && https://github.com/kardianos/govendor/issues/61
govendor remove github.com/ShyftNetwork/go-empyrean/crypto/secp256k1/^
govendor fetch github.com/ShyftNetwork/go-empyrean/crypto/secp256k1/^
```
NB: The Shyft Geth docker image size is 1+ GB so make sure you have adequate space on your disk drive/
_TODO_
- Find better dependency management solution that pulls in c header files without manual intervention
- Reduce size of the ShytfGeth docker container which is responsible for mining and running the blockchain
- Adjust docker scripts and ports to facilitate sending of test transactions
- Modify Docker scripts to facilitate hot reloading during development
## Contribution
Thank you for considering to help out with the source code! We welcome contributions from
@ -301,13 +360,13 @@ procedures quick and simple.
Please make sure your contributions adhere to our coding guidelines:
* Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)).
* Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines.
* Pull requests need to be based on and opened against the `master` branch.
* Commit messages should be prefixed with the package(s) they modify.
* E.g. "eth, rpc: make trace configs optional"
- Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)).
- Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines.
- Pull requests need to be based on and opened against the `master` branch.
- Commit messages should be prefixed with the package(s) they modify.
- E.g. "eth, rpc: make trace configs optional"
Please see the [Developers' Guide](https://github.com/ethereum/go-ethereum/wiki/Developers'-Guide)
Please see the [Developers' Guide](https://github.com/empyrean/go-ethereum/wiki/Developers'-Guide)
for more details on configuring your environment, managing project dependencies and testing procedures.
## License

View file

@ -31,7 +31,6 @@ import (
"github.com/stretchr/testify/require"
)
var jsonEventTransfer = []byte(`{
"anonymous": false,
"inputs": [
{

View file

@ -2,12 +2,12 @@ Pod::Spec.new do |spec|
spec.name = 'Geth'
spec.version = '{{.Version}}'
spec.license = { :type => 'GNU Lesser General Public License, Version 3.0' }
spec.homepage = 'https://github.com/ethereum/go-ethereum'
spec.homepage = 'https://github.com/empyrean/go-ethereum'
spec.authors = { {{range .Contributors}}
'{{.Name}}' => '{{.Email}}',{{end}}
}
spec.summary = 'iOS Ethereum Client'
spec.source = { :git => 'https://github.com/ethereum/go-ethereum.git', :commit => '{{.Commit}}' }
spec.source = { :git => 'https://github.com/empyrean/go-ethereum.git', :commit => '{{.Commit}}' }
spec.platform = :ios
spec.ios.deployment_target = '9.0'

View file

@ -11,7 +11,7 @@ EnablePreimageRecording = false
CacheDir = "ethash"
CachesInMem = 2
CachesOnDisk = 3
DatasetDir = "$HOME/.ethash"
DatasetDir = "./privatenet/.ethash"
DatasetsInMem = 1
DatasetsOnDisk = 2
PowMode = 0

View file

@ -1,14 +0,0 @@
FROM alpine:3.7
RUN \
apk add --update go git make gcc musl-dev linux-headers ca-certificates && \
git clone --depth 1 https://github.com/ethereum/go-ethereum && \
(cd go-ethereum && make geth) && \
cp go-ethereum/build/bin/geth /geth && \
apk del go git make gcc musl-dev linux-headers && \
rm -rf /go-ethereum && rm -rf /var/cache/apk/*
EXPOSE 8545
EXPOSE 30303
ENTRYPOINT ["/geth"]

View file

@ -1,17 +0,0 @@
FROM ubuntu:xenial
ENV PATH=/usr/lib/go-1.9/bin:$PATH
RUN \
apt-get update && apt-get upgrade -q -y && \
apt-get install -y --no-install-recommends golang-1.9 git make gcc libc-dev ca-certificates && \
git clone --depth 1 https://github.com/ethereum/go-ethereum && \
(cd go-ethereum && make geth) && \
cp go-ethereum/build/bin/geth /geth && \
apt-get remove -y golang-1.9 git make gcc libc-dev && apt autoremove -y && apt-get clean && \
rm -rf /go-ethereum
EXPOSE 8545
EXPOSE 30303
ENTRYPOINT ["/geth"]

View file

@ -1,14 +0,0 @@
FROM alpine:3.7
RUN \
apk add --update go git make gcc musl-dev linux-headers ca-certificates && \
git clone --depth 1 --branch release/1.8 https://github.com/ethereum/go-ethereum && \
(cd go-ethereum && make geth) && \
cp go-ethereum/build/bin/geth /geth && \
apk del go git make gcc musl-dev linux-headers && \
rm -rf /go-ethereum && rm -rf /var/cache/apk/*
EXPOSE 8545
EXPOSE 30303
ENTRYPOINT ["/geth"]

View file

@ -1,17 +0,0 @@
FROM ubuntu:xenial
ENV PATH=/usr/lib/go-1.9/bin:$PATH
RUN \
apt-get update && apt-get upgrade -q -y && \
apt-get install -y --no-install-recommends golang-1.9 git make gcc libc-dev ca-certificates && \
git clone --depth 1 --branch release/1.8 https://github.com/ethereum/go-ethereum && \
(cd go-ethereum && make geth) && \
cp go-ethereum/build/bin/geth /geth && \
apt-get remove -y golang-1.9 git make gcc libc-dev && apt autoremove -y && apt-get clean && \
rm -rf /go-ethereum
EXPOSE 8545
EXPOSE 30303
ENTRYPOINT ["/geth"]

View file

@ -1 +0,0 @@
.vagrant

View file

@ -1,38 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
VAGRANTFILE_API_VERSION = 2
VM_RAM = 2048
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "ubuntu", :primary => true do |ubuntu|
ubuntu.vm.box = "ubuntu/trusty64"
ubuntu.vm.provision "shell", :path => "provisioners/shell/ubuntu.sh"
end
config.vm.define "debian", :primary => true do |debian|
debian.vm.box = "debian/jessie64"
debian.vm.provision "shell", :path => "provisioners/shell/debian.sh"
end
config.vm.define "centos", :autostart => false do |centos|
centos.vm.box = "centos/7"
centos.vm.provision "shell", :path => "provisioners/shell/centos.sh"
end
config.vm.provider "virtualbox" do |vb|
vb.memory = VM_RAM
end
config.vm.provider "libvirt" do |lv|
lv.memory = VM_RAM
config.vm.synced_folder ".", "/home/vagrant/sync", :disabled => true
end
config.vm.synced_folder ".", "/vagrant", :disabled => true
config.vm.synced_folder "../../", "/home/vagrant/go/src/github.com/ethereum/go-ethereum"
end

View file

@ -1,11 +0,0 @@
#!/bin/bash
sudo yum install -y git wget
sudo yum update -y
wget --continue https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.8.1.linux-amd64.tar.gz
GETH_PATH="~vagrant/go/src/github.com/ethereum/go-ethereum/build/bin/"
echo "export PATH=$PATH:/usr/local/go/bin:$GETH_PATH" >> ~vagrant/.bashrc

View file

@ -1,11 +0,0 @@
#!/bin/bash
sudo apt-get install -y build-essential git-all wget
sudo apt-get update
wget --continue https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.8.1.linux-amd64.tar.gz
GETH_PATH="~vagrant/go/src/github.com/ethereum/go-ethereum/build/bin/"
echo "export PATH=$PATH:/usr/local/go/bin:$GETH_PATH" >> ~vagrant/.bashrc

View file

@ -1,11 +0,0 @@
#!/bin/bash
sudo apt-get install -y build-essential git-all wget
sudo apt-get update
wget --continue https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.8.1.linux-amd64.tar.gz
GETH_PATH="~vagrant/go/src/github.com/ethereum/go-ethereum/build/bin/"
echo "export PATH=$PATH:/usr/local/go/bin:$GETH_PATH" >> ~vagrant/.bashrc

View file

@ -1,18 +1,25 @@
package core
import (
"fmt"
"database/sql"
"fmt"
"os"
)
var blockExplorerDb *sql.DB
// @NOTE: SHYFT - could be refactored to add a test db environment
const (
connStr = "user=postgres dbname=shyftdb sslmode=disable"
connStrTest = "user=postgres dbname=shyftdbtest sslmode=disable"
connStrTest = "user=postgres dbname=shyftdbtest password=docker sslmode=disable"
)
func InitDB() (*sql.DB, error){
var connStr = connectionStr()
// InitDB - initalizes a Postgresql Database for use by the Blockexplorer
func InitDB() (*sql.DB, error) {
// To set the environment you can run the program with an ENV variable DBENV.
// DBENV defaults to local for purposes of running the correct local
// database connection parameters but will use docker connection parameters if DBENV=docker
db, err := sql.Open("postgres", connStr)
if err != nil {
fmt.Println("ERROR OPENING DB, NOT INITIALIZING")
@ -24,7 +31,17 @@ func InitDB() (*sql.DB, error){
}
}
func InitDBTest() (*sql.DB, error){
func connectionStr() string {
dbEnv := os.Getenv("DBENV")
switch dbEnv {
default:
return "user=postgres dbname=shyftdb host=localhost sslmode=disable"
case "docker":
return "user=postgres dbname=shyftdb host=pg password=docker sslmode=disable"
}
}
func InitDBTest() (*sql.DB, error) {
db, err := sql.Open("postgres", connStrTest)
if err != nil {
fmt.Println("ERROR OPENING DB, NOT INITIALIZING")

View file

@ -165,7 +165,7 @@ class Footer extends Component<Props> {
{general.commit && (
<Typography type='caption' color='inherit'>
<span style={commonStyles.light}>{'Commit '}</span>
<a href={`https://github.com/ethereum/go-ethereum/commit/${general.commit}`} target='_blank' style={{color: 'inherit', textDecoration: 'none'}} >
<a href={`https://github.com/empyrean/go-ethereum/commit/${general.commit}`} target='_blank' style={{color: 'inherit', textDecoration: 'none'}} >
{general.commit.substring(0, 8)}
</a>
</Typography>

77
docker-compose.yml Normal file
View file

@ -0,0 +1,77 @@
version: '3'
services:
shyftgeth:
build:
context: $PWD
dockerfile: docker/shyftGeth/Dockerfile.geth
ports:
- "8545:8545"
- "8546:8546"
- "30301:30301"
- "30303:30303/udp"
- "30304:30304"
volumes:
- .:/go/src/ShyftNetwork/go-empyrean
working_dir: /go/src/ShyftNetwork/go-empyrean
depends_on:
- pg
networks:
- shyftnet
command: >
sh -c 'cd /go/src/ShyftNetwork/go-empyrean &&
./wait-for.sh pg:5432 &&
DBENV=docker export DBENV &&
./shyft-cli/initShyftGeth.sh &&
./shyft-cli/startShyftGeth.sh'
pg:
build:
context: $PWD
dockerfile: docker/pg/Dockerfile.pg
volumes:
- ./pg-data:/var/lib/postgresql/data
ports:
- "8001:5432"
networks:
- shyftnet
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=docker
shyft_block_api:
build:
context: $PWD
dockerfile: docker/shyftApi/Dockerfile.api
# volumes:
# - ./shyftBlockExplorerApi:/go/src/github.com/ShyftNetwork/go-empyrean/shyftBlockExplorerApi
working_dir: /go/src/github.com/ShyftNetwork/go-empyrean/shyftBlockExplorerApi
ports:
- "8080:8080"
depends_on:
- shyftgeth
- pg
networks:
- shyftnet
command: >
sh -c '
pwd && govendor remove github.com/ShyftNetwork/go-empyrean/crypto/secp256k1/^ &&
govendor fetch github.com/ShyftNetwork/go-empyrean/crypto/secp256k1/^ &&
/wait-for.sh pg:5432 &&
DBENV=docker export DBENV &&
go run -v *.go'
shyft_block_ui:
build:
context: $PWD
dockerfile: docker/shyftUi/Dockerfile.ui
# volumes:
# - ./shyftBlockExplorerApi:/go/src/github.com/ShyftNetwork/go-empyrean/shyftBlockExplorerApi
ports:
- "3000:3000"
depends_on:
- shyft_block_api
networks:
- shyftnet
networks:
shyftnet:
driver: bridge

9
docker/pg/Dockerfile.pg Normal file
View file

@ -0,0 +1,9 @@
FROM postgres:10.4-alpine
# @NOTE:Shyft - need to modify scripts to check db/table existence
WORKDIR /
COPY ./shyft-cli/postgres_setup/docker_init_user_db.sh /docker-entrypoint-initdb.d/
COPY ./shyft-cli/postgres_setup/create_tables.psql /create_tables.psql
RUN cd /docker-entrypoint-initdb.d && ls -a
VOLUME ["/var/lib/postgresql"]
EXPOSE 5432

View file

@ -0,0 +1,15 @@
FROM golang:1.10.3-alpine
RUN apk add --update git make gcc musl-dev linux-headers ca-certificates
COPY ./shyftBlockExplorerApi /go/src/github.com/ShyftNetwork/go-empyrean/shyftBlockExplorerApi
COPY ./wait-for.sh /
WORKDIR /go/src/github.com/ShyftNetwork/go-empyrean/shyftBlockExplorerApi
RUN go get -u github.com/kardianos/govendor
RUN govendor sync
RUN cat /go/src/github.com/ShyftNetwork/go-empyrean/shyftBlockExplorerApi/vendor/vendor.json
RUN echo `ls -l /go/src/github.com/ShyftNetwork/go-empyrean/shyftBlockExplorerApi/vendor`
CMD go run -v *.go
EXPOSE 8080

57
docker/shyftApi/wait-for.sh Executable file
View file

@ -0,0 +1,57 @@
#!/bin/sh
# https://github.com/eficode/wait-for.git
log() {
echo "[wait-for] [`date +'%Y%m%d%H%M%S'`] $@"
}
usage() {
echo "Usage: `basename "$0"` [--timeout=15] <HOST>:<PORT> [<HOST_2>:<PORT_2>]"
}
unknown_arg() {
log "[ERROR] unknown argument: '$@'"
usage
exit 2
}
wait_for() {
timeout=$1 && host=$2 && port=$3
log "wait '$host':'$port' up to '$timeout'"
for i in `seq $timeout` ; do
if nc -z "$host" "$port" > /dev/null 2>&1 ; then
log "wait finish '$host:$port' [`expr $(date +%s) - $START`] seconds"
exit 0
fi
log "wait attempt '${host}:${port}' [$i]"
sleep 1
done
log "[ERROR] wait timeout of '$timeout' on '$host:$port'"
exit 1
}
trap 'kill $(jobs -p) &>/dev/null' EXIT
START=$(date +%s)
timeout=30
pids=""
for i in $@ ; do
case $i in
--timeout=*) timeout="${i#*=}" ;;
-t=*) timeout="${i#*=}" ;;
*:* )
wait_for "$timeout" "${i%%:*}" "${i##*:}" &
pids="$pids $!"
;;
*) unknown_arg "$i" ;;
esac
done
status=0
for pid in $pids; do
if ! wait $pid ; then
status=1
fi
done
log "wait done with status=$status"
exit $status

View file

@ -0,0 +1,24 @@
FROM golang:1.10.3-alpine
# To copy complete directory
COPY ./ /go/src/github.com/ShyftEthereum/go-empyrean
WORKDIR /go/src/github.com/ShyftEthereum/go-empyrean
RUN \
apk add --update git make gcc musl-dev linux-headers ca-certificates && \
(cd /go/src/github.com/ShyftEthereum/go-empyrean && make geth) && \
cp -v /go/src/github.com/ShyftEthereum/go-empyrean/build/bin/geth /bin
COPY config.toml /
COPY unlockPasswords.txt /
COPY ShyftNetwork.json /
COPY UTC--2018-03-18T22-35-03.111589431Z--43ec6d0942f7faef069f7f63d0384a27f529b062 /
COPY UTC--2018-03-18T22-36-53.786508893Z--9e602164c5826ebb5a6b68e4afd9cd466043dc4a /
COPY UTC--2018-03-18T22-37-04.212101982Z--5bd738164c61fb50eb12e227846cbaef2de965aa /
COPY UTC--2018-03-18T22-37-12.082606217Z--c04ee4131895f1d0c294d508af65d94060aa42bb /
COPY UTC--2018-03-18T22-37-19.650676366Z--07d899c4ac0c1725c35c5f816e60273b33a964f7 /
WORKDIR /go/src/github.com/ShyftEthereum/go-empyrean
CMD ["./shyft-cli/initShyftGeth.sh", "./shyft-cli/startShyftGeth.sh"]

View file

@ -0,0 +1,25 @@
FROM node:8.11.3-alpine
# set working directory
RUN echo `cd usr && ls -a`
RUN mkdir -p usr/src/shyftBlockExplorerUI
WORKDIR /usr/src/shyftBlockExplorerUI
# add `/usr/src/app/node_modules/.bin` to $PATH
ENV PATH /usr/src/shyftBlockExplorerUI/node_modules/.bin:$PATH
# install and cache app dependencies
COPY ./shyftBlockExplorerUI/package.json /usr/src/shyftBlockExplorerUI/package.json
RUN npm install
# RUN npm add react-scripts@1.1.1 -g --silent
COPY ./shyftBlockExplorerUI/src /usr/src/shyftBlockExplorerUI/src
COPY ./shyftBlockExplorerUI/scripts /usr/src/shyftBlockExplorerUI/scripts
COPY ./shyftBlockExplorerUI/config /usr/src/shyftBlockExplorerUI/config
COPY ./shyftBlockExplorerUI/public /usr/src/shyftBlockExplorerUI/public
# start app
EXPOSE 3000
CMD ["npm", "start"]

View file

@ -5862,7 +5862,7 @@ module.exports = Shh;
* @author Alex Beregszaszi <alex@rtfs.hu>
* @date 2016
*
* Reference: https://github.com/ethereum/go-ethereum/blob/swarm/internal/web3ext/web3ext.go#L33
* Reference: https://github.com/empyrean/go-ethereum/blob/swarm/internal/web3ext/web3ext.go#L33
*/
"use strict";

View file

@ -1,2 +1,6 @@
#!/bin/sh
./build/bin/geth --identity "ShyftTestnetNode" --keystore ./ --datadir "./shyftData" init ShyftNetwork.json
if [[ -z "${DBENV}" ]]; then
./build/bin/geth --identity "ShyftTestnetNode" --keystore ./ --datadir "./shyftData" init ShyftNetwork.json
else
/bin/geth --identity "ShyftTestnetNode" --keystore ./ --datadir "./shyftData" init ShyftNetwork.json
fi

View file

@ -1 +1 @@
CREATE DATABASE shyftdb
CREATE DATABASE shyftdb;

View file

@ -55,4 +55,4 @@ CREATE TABLE IF NOT EXISTS internalTxs (
time text,
input text,
output text
)
);

View file

@ -0,0 +1,10 @@
#!/bin/bash
set -e
echo $POSTGRES_USER
echo $POSTGRES_DB
# createTables="$(cat /create_tables.psql)"
# echo $createTables
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE DATABASE shyftdb;
EOSQL
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" -d shyftdb < /create_tables.psql

View file

@ -1,3 +1,5 @@
\connect
shyftdb;
DROP TABLE internalTxs;
DROP TABLE txs;
DROP TABLE blocks;

View file

@ -1,2 +1,6 @@
#!/bin/sh
./build/bin/geth --config config.toml --ws --wsaddr="0.0.0.0" --wsorigins "*" --nat=none --mine --minerthreads 4 --targetgaslimit 80000000 --unlock "0x43EC6d0942f7fAeF069F7F63D0384a27f529B062,0x9e602164C5826ebb5A6B68E4AFD9Cd466043dc4A,0x5Bd738164C61FB50eb12E227846CbaeF2dE965Aa,0xC04eE4131895F1d0C294D508AF65D94060AA42BB,0x07D899C4aC0c1725C35C5f816e60273B33a964F7" --password ./unlockPasswords.txt
if [[ -z "${DBENV}" ]]; then
./build/bin/geth --config config.toml --ws --wsaddr="0.0.0.0" --wsorigins "*" --nat=none --mine --minerthreads 4 --targetgaslimit 80000000 --unlock "0x43EC6d0942f7fAeF069F7F63D0384a27f529B062,0x9e602164C5826ebb5A6B68E4AFD9Cd466043dc4A,0x5Bd738164C61FB50eb12E227846CbaeF2dE965Aa,0xC04eE4131895F1d0C294D508AF65D94060AA42BB,0x07D899C4aC0c1725C35C5f816e60273B33a964F7" --password ./unlockPasswords.txt
else
/bin/geth --config config.toml --ws --wsaddr="0.0.0.0" --wsorigins "*" --nat=none --mine --minerthreads 4 --targetgaslimit 80000000 --unlock "0x43EC6d0942f7fAeF069F7F63D0384a27f529B062,0x9e602164C5826ebb5A6B68E4AFD9Cd466043dc4A,0x5Bd738164C61FB50eb12E227846CbaeF2dE965Aa,0xC04eE4131895F1d0C294D508AF65D94060AA42BB,0x07D899C4aC0c1725C35C5f816e60273B33a964F7" --password ./unlockPasswords.txt
fi

399
shyftBlockExplorerApi/vendor/vendor.json vendored Normal file
View file

@ -0,0 +1,399 @@
{
"comment": "",
"ignore": "test",
"package": [
{
"checksumSHA1": "4/fb4r/Y7MEVCaTN7PdPPRJBe7M=",
"path": "github.com/ShyftNetwork/go-empyrean/common",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "0lTXpt67indxty1DyfsGUhZUxtc=",
"path": "github.com/ShyftNetwork/go-empyrean/common/bitutil",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "Wzv00R7tDEPGN5lbROZLRork+38=",
"path": "github.com/ShyftNetwork/go-empyrean/common/hexutil",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "aNgexBwEfI8ANaaMyQDyeHuFCUY=",
"path": "github.com/ShyftNetwork/go-empyrean/common/math",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "zaAV9eypVRaotW+MMizuPxPJfHM=",
"path": "github.com/ShyftNetwork/go-empyrean/common/mclock",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "FZSyCzy79paVzTFiw9hwQMmYqYM=",
"path": "github.com/ShyftNetwork/go-empyrean/consensus",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "sT7DF05X1yBnMUcVgJhd4p+q7s0=",
"path": "github.com/ShyftNetwork/go-empyrean/consensus/ethash",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "Fdv4KUKWQ+owyPIUlv8c2WLS6B4=",
"path": "github.com/ShyftNetwork/go-empyrean/consensus/misc",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "2B0x5+B/4dtzj/xOwF7Q+yGhhr0=",
"path": "github.com/ShyftNetwork/go-empyrean/core",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "vhNvzOqmXFBYdZtrpWhW8jhmGzY=",
"path": "github.com/ShyftNetwork/go-empyrean/core/state",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "SRoGhYQpFaq3OQbf8g2WT2gAnwA=",
"path": "github.com/ShyftNetwork/go-empyrean/core/types",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "dMRUmW+Wq2zvupYeXuYj0k3Vndc=",
"path": "github.com/ShyftNetwork/go-empyrean/core/vm",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "MGgNhnPT/mJEIpdmWnTtewtzk0g=",
"path": "github.com/ShyftNetwork/go-empyrean/crypto",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "3glJGNkz78GAuDWdW0Vn4AshJZ8=",
"path": "github.com/ShyftNetwork/go-empyrean/crypto/bn256",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "YzKGOtVGw0wcMcQzyOcwx77TSsE=",
"path": "github.com/ShyftNetwork/go-empyrean/crypto/bn256/cloudflare",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "VXAuy+4VsjnX8wiXEFcxPYwMu0c=",
"path": "github.com/ShyftNetwork/go-empyrean/crypto/bn256/google",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "VtCDPH1wjVu+6mjuEqY57mRsjwA=",
"path": "github.com/ShyftNetwork/go-empyrean/crypto/secp256k1",
"revision": "81a40842f57bda0d10516e8a193ca2db45d67f2c",
"revisionTime": "2018-08-02T21:47:13Z"
},
{
"checksumSHA1": "QR0Uoq+x3/CiCbNWHXmsTIDrdF0=",
"path": "github.com/ShyftNetwork/go-empyrean/crypto/sha3",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "DD9RzILcd1jH8JQS1wFnntJWb9Q=",
"path": "github.com/ShyftNetwork/go-empyrean/ethdb",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "XnrX5RuMLgEGBXCUJCzAAYAyfMQ=",
"path": "github.com/ShyftNetwork/go-empyrean/event",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "z1EsZ0xPHsbrmEP9f548xU5vRe0=",
"path": "github.com/ShyftNetwork/go-empyrean/log",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "o1Jo5QZjpoQu/jlV8EdRReqx12I=",
"path": "github.com/ShyftNetwork/go-empyrean/metrics",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "YHme1HzZG6QEuj+omsBga9q+Rng=",
"path": "github.com/ShyftNetwork/go-empyrean/params",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "YaGPda/QZ2y7bTdRsIIlyI1zZlo=",
"path": "github.com/ShyftNetwork/go-empyrean/rlp",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "8IM59NA2oUvUbqXJw+jYUcBIYWY=",
"path": "github.com/ShyftNetwork/go-empyrean/rpc",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "X+6gj7lAoWmwGhd8kZCr/r13Ljw=",
"path": "github.com/ShyftNetwork/go-empyrean/shyfttracerinterface",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "V0TAmfyHQS5bTiNTWBpPyWC26I4=",
"path": "github.com/ShyftNetwork/go-empyrean/trie",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "USkefO0g1U9mr+8hagv3fpSkrxg=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/aristanetworks/goarista/monotime",
"path": "github.com/aristanetworks/goarista/monotime",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "gZQ6HheWahvZzIc3phBnOwoWHjE=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/btcsuite/btcd/btcec",
"path": "github.com/btcsuite/btcd/btcec",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "zYnPsNAVm1/ViwCkN++dX2JQhBo=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/edsrzf/mmap-go",
"path": "github.com/edsrzf/mmap-go",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "BP3m/oEeoC9ustdCYzAVS/gabqg=",
"path": "github.com/ethereum/go-ethereum/common/math",
"revision": "35fcd2f42388d10c2c638dd3e2b4bd4306b07c19",
"revisionTime": "2018-08-03T10:26:39Z"
},
{
"checksumSHA1": "KZ3QD2QgUS4RcoKiA3mn5pSlJxQ=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/go-stack/stack",
"path": "github.com/go-stack/stack",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "p/8vSviYF91gFflhrt5vkyksroo=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/golang/snappy",
"path": "github.com/golang/snappy",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "g/V4qrXjUGG9B+e3hB+4NAYJ5Gs=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/gorilla/context",
"path": "github.com/gorilla/context",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "XOY0t65siat4bLbC4VCmBA9dE7Y=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/gorilla/handlers",
"path": "github.com/gorilla/handlers",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "YuYKzn2jczaM6DQcFDmukvAHUX4=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/gorilla/mux",
"path": "github.com/gorilla/mux",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "d9PxF1XQGLMJZRct2R8qVM/eYlE=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/hashicorp/golang-lru",
"path": "github.com/hashicorp/golang-lru",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "9hffs0bAIU6CquiRhKQdzjHnKt0=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/hashicorp/golang-lru/simplelru",
"path": "github.com/hashicorp/golang-lru/simplelru",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "F7vsuKOVSMnFSi90odRxfhBEBeA=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/lib/pq",
"path": "github.com/lib/pq",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "AU3fA8Sm33Vj9PBoRPSeYfxLRuE=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/lib/pq/oid",
"path": "github.com/lib/pq/oid",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "LjPdvMphElL0GOVNQCsmZMVgWIw=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/rs/cors",
"path": "github.com/rs/cors",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "hCRfPlNpqv8tvVivLzmXsoUOf1c=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/rs/xhandler",
"path": "github.com/rs/xhandler",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "3QsnhPTXGytTbW3uDvQLgSo9s9M=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/syndtr/goleveldb/leveldb",
"path": "github.com/syndtr/goleveldb/leveldb",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "EKIow7XkgNdWvR/982ffIZxKG8Y=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/syndtr/goleveldb/leveldb/cache",
"path": "github.com/syndtr/goleveldb/leveldb/cache",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "5KPgnvCPlR0ysDAqo6jApzRQ3tw=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/syndtr/goleveldb/leveldb/comparer",
"path": "github.com/syndtr/goleveldb/leveldb/comparer",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "1DRAxdlWzS4U0xKN/yQ/fdNN7f0=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/syndtr/goleveldb/leveldb/errors",
"path": "github.com/syndtr/goleveldb/leveldb/errors",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "eqKeD6DS7eNCtxVYZEHHRKkyZrw=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/syndtr/goleveldb/leveldb/filter",
"path": "github.com/syndtr/goleveldb/leveldb/filter",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "weSsccMav4BCerDpSLzh3mMxAYo=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/syndtr/goleveldb/leveldb/iterator",
"path": "github.com/syndtr/goleveldb/leveldb/iterator",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "gJY7bRpELtO0PJpZXgPQ2BYFJ88=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/syndtr/goleveldb/leveldb/journal",
"path": "github.com/syndtr/goleveldb/leveldb/journal",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "MtYY1b2234y/MlS+djL8tXVAcQs=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/syndtr/goleveldb/leveldb/memdb",
"path": "github.com/syndtr/goleveldb/leveldb/memdb",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "UmQeotV+m8/FduKEfLOhjdp18rs=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/syndtr/goleveldb/leveldb/opt",
"path": "github.com/syndtr/goleveldb/leveldb/opt",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "QCSae2ub87f8awH+PKMpd8ZYOtg=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/syndtr/goleveldb/leveldb/storage",
"path": "github.com/syndtr/goleveldb/leveldb/storage",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "gWFPMz8OQeul0t54RM66yMTX49g=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/syndtr/goleveldb/leveldb/table",
"path": "github.com/syndtr/goleveldb/leveldb/table",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "V/Dh7NV0/fy/5jX1KaAjmGcNbzI=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/github.com/syndtr/goleveldb/leveldb/util",
"path": "github.com/syndtr/goleveldb/leveldb/util",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "y/oIaxq2d3WPizRZfVjo8RCRYTU=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/golang.org/x/crypto/ripemd160",
"path": "golang.org/x/crypto/ripemd160",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "Y+HGqEkYM15ir+J93MEaHdyFy0c=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/golang.org/x/net/context",
"path": "golang.org/x/net/context",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "7EZyXN0EmZLgGxZxK01IJua4c8o=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/golang.org/x/net/websocket",
"path": "golang.org/x/net/websocket",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "NGg7/qIJVUfXi7xnEyyDLocdi6Y=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/gopkg.in/fatih/set.v0",
"path": "gopkg.in/fatih/set.v0",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "DQXNV0EivoHm4q+bkdahYXrjjfE=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/gopkg.in/karalabe/cookiejar.v2/collections/prque",
"path": "gopkg.in/karalabe/cookiejar.v2/collections/prque",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
},
{
"checksumSHA1": "0xgs8lwcWLUffemlj+SsgKlxvDU=",
"origin": "github.com/ShyftNetwork/go-empyrean/vendor/gopkg.in/natefinch/npipe.v2",
"path": "gopkg.in/natefinch/npipe.v2",
"revision": "bc318b381ebd1042f4e282dd879a0463f9378786",
"revisionTime": "2018-08-03T12:51:19Z"
}
],
"rootPath": "github.com/ShyftNetwork/go-empyrean/shyftBlockExplorerApi"
}

View file

@ -349,6 +349,13 @@ aws4@^1.2.1, aws4@^1.6.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.7.0.tgz#d4d0e9b9dbfca77bf08eeb0a8a471550fe39e289"
axios@^0.18.0:
version "0.18.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.18.0.tgz#32d53e4851efdc0a11993b6cd000789d70c05102"
dependencies:
follow-redirects "^1.3.0"
is-buffer "^1.1.5"
axobject-query@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-0.1.0.tgz#62f59dbc59c9f9242759ca349960e7a2fe3c36c0"
@ -2792,6 +2799,12 @@ flatten@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"
follow-redirects@^1.3.0:
version "1.5.2"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.2.tgz#5a9d80e0165957e5ef0c1210678fc5c4acb9fb03"
dependencies:
debug "^3.1.0"
for-in@^1.0.1, for-in@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
@ -3172,6 +3185,16 @@ he@1.1.x:
version "1.1.1"
resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd"
history@^4.7.2:
version "4.7.2"
resolved "https://registry.yarnpkg.com/history/-/history-4.7.2.tgz#22b5c7f31633c5b8021c7f4a8a954ac139ee8d5b"
dependencies:
invariant "^2.2.1"
loose-envify "^1.2.0"
resolve-pathname "^2.2.0"
value-equal "^0.4.0"
warning "^3.0.0"
hmac-drbg@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
@ -3188,6 +3211,10 @@ hoek@4.x.x:
version "4.2.1"
resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.1.tgz#9634502aa12c445dd5a7c5734b572bb8738aacbb"
hoist-non-react-statics@^2.5.0:
version "2.5.5"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47"
home-or-tmp@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8"
@ -3427,7 +3454,7 @@ interpret@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614"
invariant@^2.2.2:
invariant@^2.2.1, invariant@^2.2.2, invariant@^2.2.4:
version "2.2.4"
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
dependencies:
@ -4042,6 +4069,10 @@ js-tokens@^3.0.0, js-tokens@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"
"js-tokens@^3.0.0 || ^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
js-yaml@^3.4.3, js-yaml@^3.7.0, js-yaml@^3.9.1:
version "3.11.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.11.0.tgz#597c1a8bd57152f26d622ce4117851a51f5ebaef"
@ -4323,6 +4354,12 @@ loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1:
dependencies:
js-tokens "^3.0.0"
loose-envify@^1.2.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
dependencies:
js-tokens "^3.0.0 || ^4.0.0"
loud-rejection@^1.0.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f"
@ -4998,7 +5035,7 @@ path-to-regexp@0.1.7:
version "0.1.7"
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c"
path-to-regexp@^1.0.1:
path-to-regexp@^1.0.1, path-to-regexp@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d"
dependencies:
@ -5432,6 +5469,13 @@ prop-types@^15.5.10, prop-types@^15.6.0:
loose-envify "^1.3.1"
object-assign "^4.1.1"
prop-types@^15.6.1:
version "15.6.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.2.tgz#05d5ca77b4453e985d60fc7ff8c859094a497102"
dependencies:
loose-envify "^1.3.1"
object-assign "^4.1.1"
proxy-addr@~2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.3.tgz#355f262505a621646b3130a728eb647e22055341"
@ -5588,6 +5632,29 @@ react-error-overlay@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-4.0.0.tgz#d198408a85b4070937a98667f500c832f86bd5d4"
react-router-dom@^4.2.2:
version "4.3.1"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-4.3.1.tgz#4c2619fc24c4fa87c9fd18f4fb4a43fe63fbd5c6"
dependencies:
history "^4.7.2"
invariant "^2.2.4"
loose-envify "^1.3.1"
prop-types "^15.6.1"
react-router "^4.3.1"
warning "^4.0.1"
react-router@^4.3.1:
version "4.3.1"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.3.1.tgz#aada4aef14c809cb2e686b05cee4742234506c4e"
dependencies:
history "^4.7.2"
hoist-non-react-statics "^2.5.0"
invariant "^2.2.4"
loose-envify "^1.3.1"
path-to-regexp "^1.7.0"
prop-types "^15.6.1"
warning "^4.0.1"
react@^16.3.1:
version "16.3.2"
resolved "https://registry.yarnpkg.com/react/-/react-16.3.2.tgz#fdc8420398533a1e58872f59091b272ce2f91ea9"
@ -5882,6 +5949,10 @@ resolve-from@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748"
resolve-pathname@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-2.2.0.tgz#7e9ae21ed815fd63ab189adeee64dc831eefa879"
resolve-url@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"
@ -6855,6 +6926,10 @@ validate-npm-package-license@^3.0.1:
spdx-correct "^3.0.0"
spdx-expression-parse "^3.0.0"
value-equal@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-0.4.0.tgz#c5bdd2f54ee093c04839d71ce2e4758a6890abc7"
vary@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
@ -6883,6 +6958,18 @@ walker@~1.0.5:
dependencies:
makeerror "1.0.x"
warning@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/warning/-/warning-3.0.0.tgz#32e5377cb572de4ab04753bdf8821c01ed605b7c"
dependencies:
loose-envify "^1.0.0"
warning@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/warning/-/warning-4.0.1.tgz#66ce376b7fbfe8a887c22bdf0e7349d73d397745"
dependencies:
loose-envify "^1.0.0"
watch@~0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/watch/-/watch-0.10.0.tgz#77798b2da0f9910d595f1ace5b0c2258521f21dc"

View file

@ -22,13 +22,13 @@ func ClearTables() {
fmt.Println(err)
}
sqlStatementTx:= `DELETE FROM txs`
sqlStatementTx := `DELETE FROM txs`
_, err = blockExplorerDbTest.Exec(sqlStatementTx)
if err != nil {
panic(err)
}
sqlStatementAcc:= `DELETE FROM accounts`
sqlStatementAcc := `DELETE FROM accounts`
_, err = blockExplorerDbTest.Exec(sqlStatementAcc)
if err != nil {
panic(err)

View file

@ -3,24 +3,31 @@ package main
//@NOTE SHYFT main func for api, sets up router and spins up a server
//to run server 'go run shyftRingWalletConn/*.go'
import (
"net"
"bufio"
"fmt"
"github.com/ShyftNetwork/go-empyrean/common/hexutil"
"github.com/ShyftNetwork/go-empyrean/crypto"
"io"
"net"
"net/http"
"os"
//"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"bytes"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ShyftNetwork/go-empyrean/ethclient"
"github.com/ShyftNetwork/go-empyrean/common"
"context"
)
const (
CONN_HOST = "localhost"
CONN_PORT = "3333"
CONN_TYPE = "tcp"
NEW_LINE_BYTE = 0x0a
)
var testAddrHex = "14791697260E4c9A71f18484C9f997B308e59325"
var testPrivHex = "0123456789012345678901234567890123456789012345678901234567890123"
var client = &http.Client{}
// This gives context to the signed message and prevents signing of transactions.
func signHash(data []byte) []byte {
msg := fmt.Sprintf("\x19Ethereum Signed Message:\n%d%s", len(data), data)
@ -28,7 +35,6 @@ func signHash(data []byte) []byte {
}
func main() {
l, err := net.Listen(CONN_TYPE, CONN_HOST+":"+CONN_PORT)
if err != nil {
fmt.Println("Error listening:", err.Error())
@ -50,44 +56,42 @@ func main() {
// Handles incoming requests.
func handleRequest(conn net.Conn) {
// Make a buffer to hold incoming data.
// Read the incoming connection into the buffer.
go func() {
buf := make([]byte, 1024)
msgBuf := make([]byte, 0)
messages := make(chan []byte)
checkBalanceChan := make(chan []byte)
go readerConn(conn, messages)
go handleMessages(messages, checkBalanceChan)
go checkBalance(checkBalanceChan, conn)
sendRingSignedMsg(conn)
}
func handleMessages(channel chan []byte, checkBalancesChan chan []byte) {
var prevMsg []byte
var addressOfClient []byte
var signatureFromClient []byte
var msgFromClient []byte
for {
msg, err := conn.Read(buf)
msg := <-channel
if err == nil {
msgBuf = append(msgBuf, buf[:msg]...)
}
index := bytes.IndexByte(msgBuf, 0x0a)
for index != -1 {
newMsg := msgBuf[:index]
rest := msgBuf[(index + 1):len(msgBuf)]
msgBuf = rest
index = bytes.IndexByte(msgBuf, 0x0a)
//similar to shift in bash
if prevMsg != nil {
s := string(prevMsg[:])
if s == "-- ADDRESS --" {
addressOfClient = newMsg
addressOfClient = msg
checkBalancesChan <- addressOfClient
}
if s == "-- SIGNATURE --" {
signatureFromClient = newMsg
signatureFromClient = msg
}
if s == "-- MESSAGE --" {
msgFromClient = newMsg
msgFromClient = msg
}
prevMsg = nil
} else {
prevMsg = newMsg
}
prevMsg = msg
}
if addressOfClient != nil && signatureFromClient != nil && msgFromClient != nil {
@ -113,22 +117,62 @@ func handleRequest(conn net.Conn) {
fmt.Println("ADDRESS IS ::", recoveredAddr.Hex())
}
}
}()
go func() {
}
func readerConn(conn net.Conn, channel chan []byte) {
bufReader := bufio.NewReader(conn)
for {
msg, err := bufReader.ReadBytes(NEW_LINE_BYTE)
if err == io.EOF {
fmt.Println("END OF FILE, CLOSING CONNECTION")
conn.Close()
conn = nil
break
}
if err != nil {
fmt.Println("Connection error: ", err)
break
}
msg = msg[:len(msg)-1] // remove trailing new line byte
channel <- msg
}
}
func checkBalance(checkBalanceChan chan []byte, conn net.Conn) {
address := <-checkBalanceChan
c, err := ethclient.Dial("http://127.0.0.1:8545")
if err != nil {
fmt.Println("Eth Client not initialized: " , err)
}
balance, error := c.BalanceAt(context.Background(), common.HexToAddress(string(address[:])),nil)
if error != nil {
fmt.Println("Balance at error ", error)
}
fmt.Println("the bal is ", balance)
fmt.Println("The balance for address ", address, " is ", balance)
conn.Write([]byte("Broadcasting Balance"))
conn.Write([]byte("\n"))
conn.Write([]byte(balance.String()))
conn.Write([]byte("\n"))
}
func sendRingSignedMsg(conn net.Conn){
key, _ := crypto.HexToECDSA(testPrivHex)
f_msg := "Hello World"
first_message := []byte(f_msg)
new_msg2 := crypto.Keccak256(first_message)
fmt.Println("HASH IS ::", hexutil.Encode(new_msg2))
//send_message := append(new_msg2, []byte{byte(10)}...)
new_sig , err := crypto.Sign(new_msg2, key)
new_sig, err := crypto.Sign(new_msg2, key)
if err != nil {
fmt.Println("The crypto.Sign err is ", err)
}
hex_sig := hexutil.Encode(new_sig)
fmt.Println("HEX SIG ::", hex_sig)
conn.Write([]byte("Broadcasting Message"))
conn.Write([]byte("\n"))
@ -136,5 +180,4 @@ func handleRequest(conn net.Conn) {
conn.Write([]byte("\n"))
conn.Write(new_sig)
conn.Write([]byte("\n"))
}()
}

View file

@ -3,12 +3,12 @@
default: build
build:
go build -o bin/swarm github.com/ethereum/go-ethereum/cmd/swarm
go build -o bin/geth github.com/ethereum/go-ethereum/cmd/geth
go build -o bin/bootnode github.com/ethereum/go-ethereum/cmd/bootnode
go build -o bin/swarm github.com/empyrean/go-ethereum/cmd/swarm
go build -o bin/geth github.com/empyrean/go-ethereum/cmd/geth
go build -o bin/bootnode github.com/empyrean/go-ethereum/cmd/bootnode
cluster: build
scripts/boot-cluster.sh
test:
go test -v github.com/ethereum/go-ethereum/swarm/...
go test -v github.com/empyrean/go-ethereum/swarm/...

View file

@ -1,4 +1,4 @@
export ROOT="${GOPATH}/src/github.com/ethereum/go-ethereum"
export ROOT="${GOPATH}/src/github.com/empyrean/go-ethereum"
export PATH="${ROOT}/swarm/dev/bin:${PATH}"
cd "${ROOT}/swarm/dev"

View file

@ -80,7 +80,7 @@ run_image() {
--rm \
--hostname "${name}" \
--name "${name}" \
--volume "${ROOT}:/go/src/github.com/ethereum/go-ethereum" \
--volume "${ROOT}:/go/src/github.com/empyrean/go-ethereum" \
--volume "/var/run/docker.sock:/var/run/docker.sock" \
${docker_args} \
"${name}" \

2
vendor/vendor.json vendored
View file

@ -794,5 +794,5 @@
"revisionTime": "2017-08-11T01:42:03Z"
}
],
"rootPath": "github.com/ethereum/go-ethereum"
"rootPath": "github.com/ShyftNetwork/go-empyrean"
}

57
wait-for.sh Executable file
View file

@ -0,0 +1,57 @@
#!/bin/sh
# https://github.com/eficode/wait-for.git
log() {
echo "[wait-for] [`date +'%Y%m%d%H%M%S'`] $@"
}
usage() {
echo "Usage: `basename "$0"` [--timeout=15] <HOST>:<PORT> [<HOST_2>:<PORT_2>]"
}
unknown_arg() {
log "[ERROR] unknown argument: '$@'"
usage
exit 2
}
wait_for() {
timeout=$1 && host=$2 && port=$3
log "wait '$host':'$port' up to '$timeout'"
for i in `seq $timeout` ; do
if nc -z "$host" "$port" > /dev/null 2>&1 ; then
log "wait finish '$host:$port' [`expr $(date +%s) - $START`] seconds"
exit 0
fi
log "wait attempt '${host}:${port}' [$i]"
sleep 1
done
log "[ERROR] wait timeout of '$timeout' on '$host:$port'"
exit 1
}
trap 'kill $(jobs -p) &>/dev/null' EXIT
START=$(date +%s)
timeout=30
pids=""
for i in $@ ; do
case $i in
--timeout=*) timeout="${i#*=}" ;;
-t=*) timeout="${i#*=}" ;;
*:* )
wait_for "$timeout" "${i%%:*}" "${i##*:}" &
pids="$pids $!"
;;
*) unknown_arg "$i" ;;
esac
done
status=0
for pid in $pids; do
if ! wait $pid ; then
status=1
fi
done
log "wait done with status=$status"
exit $status