Giter Club home page Giter Club logo

neo-local's Introduction

City of Zion logo

neo-local

Personal blockchain for NEO dApp development!

What?

Quickly fire up a personal NEO blockchain which you can use to run tests, execute commands, and inspect state while controlling how the chain operates.

This project quickly sets this up for you without any prior knowledge needed, along with a number of other utility services that help with development.

This project works on MacOS, Linux and Windows machines ๐Ÿ‘

It shares similar goals to the Ganache project from the Truffle Framework.

Documentation

Please visit the Documentation for instructions on how to install and use the project.

image

neo-local's People

Contributors

adrienmo avatar alloro avatar jeroenptrs avatar metachris avatar nunojusto avatar revett avatar slipo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neo-local's Issues

Command (script) to bootstrap an offline downloaded chain

Is your feature request related to a problem? Please describe.
Not related to a problem.

Describe the solution you'd like
A command (script) to bootstrap consensus nodes with an offline downloaded chain

Describe alternatives you've considered
Needs to be docker commands to be able to be integrated in the neo-local-cli

Additional context
In the end, all nodes need to sync to that chain.

ContainerName cannot be based on ImageName in CLI

Summary

Using CLI, if we have two containers with the same docker image, like neo-python and notifications-server the name of the containers are the same.

To Reproduce

Create/merge both PR for adding neo-python and notification-server and rum the CLI.

Expected Behaviour

The name of the containers cannot be based on the image names.
Needs to have a service name.

Docker

All

Docker Compose

No, it's CLI

Operating System

All

Screenshots

N/A

Using old version of neo-python (v0.7.7)

Problem

@ChristophK#0509 raised in #dev-general of Discord:

I've just switched to neo-local repo . Whenever I create a new wallet and want to reopen it, I get the error message: Could not open wallet: This wallet is currently vulnerable. Please execute the "reencrypt_wallet.py" script on this wallet before continuing.

This is due to an old version of neo-python being used within the stack, see:

neo-python:
container_name: neo-python
depends_on:
- neo-nodes
- neo-scan
image: cityofzion/neo-python:v0.7.7
network_mode: host
tty: true
volumes:
- "./smart-contracts:/smart-contracts"
- "./wallets:/wallets"

Solution

Bump to latest version, see releases:

https://github.com/CityOfZion/neo-python/releases

Test for latest Docker images

Idea

This project pins the version of the Docker images it uses because of breaking changes that occur in upstream projects that it consumes.

This however means that it regularly falls out of date as these projects regularly post updates.

It would be good to have automated tests to check that the Docker image versions are the latest.

These test should be run within the nightly test suite.

When i run `make start` and exit neo-py and run `make start` again it will wipe things

I think it would be more useful to warn users // ask if they really want to remove the old containers or simply reconnect.

I think a better development workflow would be to provide a simple way to start all the services, and then another command to attach to it.

  • make start should start the containers
  • make attach should attach to the neo-python prompt

via @revett: make start should be smart enough to work out if there are containers already running and then give the user the option to remove them or not.

Add 'destroy' command to CLI

Feature

Currently the CLI can only start containers with the following command:

neo-local start

It should also be able to remove all containers from the local machine with:

neo-local destroy 

Cannot start service neo-nodes

Got this error for a while now, not sure what's the root of the problem.
Removed all images/containers, restarted docker, pulled latest branch, but that doesn't seem to resolve anything.

ERROR: for neo-nodes  Cannot start service neo-nodes: driver failed programming external connectivity on endpoint neo-noCreating postgres  ... done
.0.0.0:30336:tcp:172.18.0.3:30336: input/output error

ERROR: for neo-nodes  Cannot start service neo-nodes: driver failed programming external connectivity on endpoint neo-nodes (f427c0b37614765e32aa5d69ee8fa9c015369598068cd7524355baa8020f1881): Error starting userland proxy: mkdir /port/tcp:0.0.0.0:30336:tcp:172.18.0.3:30336: input/output error
ERROR: Encountered errors while bringing up the project.

Tagged CI builds are failing

Problem

Example: https://travis-ci.org/CityOfZion/neo-local/builds/409058230

CI builds on the master branch or a tag should ignore the make check-version check as that should apply to a feature branch.

See:

#!/bin/bash
# Script that Travis CI will run to test the project, it is conditional on the branch.
set -e
if [[ $TRAVIS_BRANCH == 'master' ]]
then
make integration-tests
else
make check-version
make integration-tests
fi

CLI: error on postgres starting neo-local cli

Summary

Error starting neo-local cli on postgres
image

To Reproduce

Everytime
I'm using API 1.38 with $ export DOCKER_API_VERSION='1.38'

Expected Behaviour

Should start

Docker

API 1.38

Operating System

Linux...

Travis test services and not containers

Describe the solution you'd like
Currently travis tests only the number of containers running.

Describe alternatives you've considered
Travis should test the services running inside containers

CLI: Start comand is not pulling any image

Summary

Command start is not pullimng the images.

To Reproduce

Delete all (or each) images on your local disk.
Issue command ./neo-local start

Expected Behaviour

No error should occur because neo-cli should pull all images necessary before starting them in containers

Docker

All

Docker Compose

N/A

Operating System

Linux, but should be all

neo-local doesn't work offline

Is your feature request related to a problem? Please describe.
Make it work offline when you already have the necessary images.
When using make start offline, it fails trying to download the images even when they are already available locally.

Describe the solution you'd like
Perhaps make start-offline

Describe alternatives you've considered
It fails in https://github.com/CityOfZion/neo-local/blob/master/Makefile#L26, if you comment this line works as workarround.

Missing SimplePolicy plugin from neo-cli Docker images

Summary

neo-cli images from neo-local-privnet don't have the plugin SimplePolicy.
This will render wrong consensus mechanism.

To Reproduce

This was reported by @belane
__
First, new transactions are filtered on arrive to the memory pool, here
https://github.com/neo-project/neo/blob/master/neo/Ledger/Blockchain.cs#L364

Then when the primary CN make a proposal for a new block, https://github.com/neo-project/neo/blob/master/neo/Consensus/ConsensusService.cs#L107 uses the policy to order the transactions.

And in AddTransaction is used to filter tx https://github.com/neo-project/neo/blob/master/neo/Consensus/ConsensusService.cs#L39

All this logic is in the plugin https://github.com/neo-project/neo-plugins/blob/master/SimplePolicy/SimplePolicyPlugin.cs

If you don't use the SimplePolicy, of course you can generate blocks, but you are not following the policy, I mean blocks of 500 tx, only 20 free tx per block, tx prioritized by fee,
__

Which version...

Docker images 2.8 and above

NeoScan timeout in nightly builds

Problem

TLDR: The nightly builds are failing due to a timeout.

See build #296 as an example.

The nightly builds starts the Compose stack and then runs a test to check that all of the containers have been started and are still running. During the Compose stack starting, it will wait for NeoScan to start. This is what is timing out in the build.

CLI: No logic to test dependency containers

Describe the Solution

When CLI starts containers must have a logic to test if a dependent container is already up and running.

Why?

Some services need other containers to start first. Like neo-scan with postgres.
On docker-compose this is achieved with: depends_on
CLI needs to mimic the same concept

Additional Context

This must be done with Health (Healthcheck) and ContainerState

Packaging all config file inside the released Go binary

Describe the Solution

We need to include some config files inside the bin releases

Why?

When the neo-local bin is executed, some containers need config files and we cannot know where are those files in the host filesystem.
So the solution is to use a packager that includes all external files inside the binary to be release.
That way we can use a virtual memory filesystem or write down to a known folder all those files.

Additional Context

Some part can be done with this:
https://github.com/gobuffalo/packr

Make chain sync as mounted volume

Could you, please, mount volume for chain sync for separate docker-compose run neo-python calls to be synced, and also optional wallet path specification would be a great feature!

Build a Web NEO API Explorer

Is your feature request related to a problem? Please describe.
This service/tool will help explore the NEO API with a simple browsing experience.
It will give users/developers a way query (make API calls) the nodes via browser using forms.
We can see similar services for bitcoin here http://chainquery.com/bitcoin-api

Describe the solution you'd like
The site will be like a wiki of all API calls. Easy to navigate and fast.
Should be build with static pages using a static page generator, like Hugo.

Describe alternatives you've considered
Using PHP and mysql, but that will just make it more complex without any advantage.

Break out privatenet in separate dockers

Effect AI already does this https://github.com/effectai/neo-dev-toolkit/blob/master/docker-compose.yml and we can always keep the neo-privatenet docker image for developers that need a quick setup, but this caters to more use cases:

  • Occasionally a node goes offline, we should be able to simply start and restart nodes (potentially even from the CLI!).
  • In a way, learning to work with consensus nodes (adding a new one to the already existing pool f.e.) can also be a learning experience for developers interested in DBFT.

These two key points are more easily possible if we break out the consensus nodes in separate dockers.

Travis not updating PR with status of build

Problem

Travis runs a CI job open each commit within a PR. However it does not update the status of that build from the orange pending state to the red failed state or the green success state.

CLI not using project version

Problem

The CLI is not using the project's version from the VERSION file in the root of the directory.

See: https://github.com/CityOfZion/neo-local/blob/master/VERSION

It instead has to manually set it's version within the main.go, see:

neo-local/cli/main.go

Lines 13 to 47 in 046c115

const (
copyright = "MIT"
description = "Quickly setup a local environment for NEO smart contract development"
version = "0.2.0"
)
var (
author = cli.Author{
Name: "City of Zion - https://github.com/cityofzion",
}
name = color.GreenString("neo-local")
)
func main() {
logWriter := logger.NewWriter(name, version)
log.SetFlags(0)
log.SetOutput(logWriter)
app := cli.NewApp()
app.Authors = []cli.Author{author}
app.Commands = commands.GenerateCommandsIndex()
app.Copyright = copyright
app.Name = name
app.Usage = description
app.Version = version
err := app.Run(os.Args)
if err != nil {
log.Fatalf(
"%s %s. Please check the FAQ: https://github.com/CityOfZion/neo-local/wiki/FAQ",
color.RedString("ERROR:"),
color.RedString(err.Error()),
)
}
}

This is annoying as you tend to forget to bump both, and the CI build on checks against one of them.

Solution

Pass the value of VERSION through when building the CLI.

See this gist for documentation on how to achieve this: https://gist.github.com/marz619/e91796afa5a951c0aa4595d7e73d78d0

Convert tests to Go

Problem

The tests currently used within CI builds are written in bash scripts.

Solution

Convert them to Go.

Make docker image consensus nodes with a full testnet chain

THIS IS A FEATURE TO BE AVAILABLE AFTER 4-ISOLATED-CONSENSUS-NODES HAD BEEN MERGED TO MASTER

Is your feature request related to a problem? Please describe.
New feature

Describe the solution you'd like
Until now we only have nodes with a 3k long blockchain. The idea is to make possible to load a full testnet image for each node.

Additional context
This is still a privanetenet, but mimics a full testnet in a local environment

Windows portability

Unfortunately Makefiles are not easily supported in the platform 90% of the developers of the world use.

[neo-local] Waiting for network......... takes a looong time

When running make start, the step which shows [neo-local] Waiting for network................... takes too long, like 2 minutes or even more. Why is that? Doesn't seem necessary. The original privnet container starts immediately, so does neo-python.

Add 'status' command to CLI

Feature

The CLI cannot show the status of all the containers that are currently running in the stack, this should be implemented under the following command:

neo-local status

Document usage on Windows

How can I use this on Windows? Add some documentation. There is no reason that shouldn't be possible -- Docker works just fine, and a lot of devs actually use Windows.

So I think documentation on how to get the setup up and running on Windows is quite critical to reach the full potential of this setup.

via @revett: Is there a make equivalent for Windows?

Container Name Already In Use

image

Problem

The CLI heavily uses container names to check the state of the containers that have been started.

It does not take into consideration when creating new containers that one with the same name may already exist.

NeoScan doesn't detect transaction output in invocation transactions

Describe the bug
I found the bug when I worked on Cgas and Cneo contracts. Neoscan does not read outputs and asset transfers in invocation transactions.
For example:
I send a Cgas mint invocation with 10 NEO. In the chain it works but Neoscan does not show the transfer and correct balance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.