Giter VIP home page Giter VIP logo

fork-ethereum's Introduction

Join the chat at https://gitter.im/fork-ethereum/Lobby

Installation

Docker

Install Docker

Dockerfile

https://hub.docker.com/r/forkblockchain/fork-ethereum/

docker pull forkblockchain/fork-ethereum:latest

or

Docker compose

docker-compose up -d

then

./enter-docker.sh

cd /ethereum

Vagrant

Install VirtualBox

Install Vagrant

vagrant up --provision

cd /home/ethereum/

Initialization of Chain

geth Commands

./init-genesis.sh

./start-geth.sh

./connect-geth.sh

Account Setup Commands

Create New Account

personal.newAccount();

or (need to specify passpharse as argument in container)

personal.newAccount("YOUR PASSPHRASE");

Show Balance

eth.getBalance(eth.accounts[0]);

Generate DAG and mine coins

miner.start();

miner.stop();

Smart Contract Example

Contract Commands

loadScript("simple.js")

var parsedSimpleContract = web3.eth.contract(JSON.parse(simpleContract.contracts["simple.sol:Simple"].abi));

personal.unlockAccount(eth.accounts[0], "YOUR PASSPHRASE");

Log mined contract

var simpleContract = parsedSimpleContract.new({ from: eth.accounts[0], data: "0x" + simpleContract.contracts["simple.sol:Simple"].bin, gas: 4700000},
  function (e, contract) {
    console.log(e, contract);
    if (typeof contract.address !== 'undefined') {
         console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
    }
  }
);

Mine contract miner.start();

miner.stop();

Execute locally

simpleContract.multiply.call(9,2);

Execute on evm

simpleContract.multiply.sendTransaction(2,2,{from:eth.accounts[0]})

Process smart contract transaction

miner.start();

miner.stop();

View Logged Events

var simpleContractEvents = simpleContract.allEvents({fromBlock: 0, toBlock: 'latest'});

simpleContractEvents.get(function(error, logs) {
  logs.forEach( function(log,error) {
    console.log(JSON.stringify(log.args));
  })
});

References

Puppeth https://modalduality.org/posts/puppeth/

Private Network https://github.com/ethereum/go-ethereum/wiki/Private-network

Default Bootnodes https://github.com/ethereum/go-ethereum/blob/master/params/bootnodes.go

https://alanbuxton.wordpress.com/2017/07/19/first-steps-with-ethereum-private-networks-and-smart-contracts-on-ubuntu-16-04/

https://ethereum.stackexchange.com/questions/15435/how-to-compile-solidity-contracts-with-geth-v1-6

fork-ethereum's People

Contributors

forkblockchain avatar gitter-badger avatar

Watchers

 avatar

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.