All Projects → YsnKsy → React Native Geth

YsnKsy / React Native Geth

Licence: mit
Ethereum Light-Client implementation for React Native

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to React Native Geth

Coinbasepro Csharp
The unofficial .NET/C# client library for the Coinbase Pro/GDAX API
Stars: ✭ 143 (-5.92%)
Mutual labels:  ethereum
Raiden
Raiden Network
Stars: ✭ 1,825 (+1100.66%)
Mutual labels:  ethereum
Sparkle Airdrop
Sparkle Airdrop Contract Built on Ethereum
Stars: ✭ 150 (-1.32%)
Mutual labels:  ethereum
Truffle Plugin Verify
✅ Verify your smart contracts on Etherscan from the Truffle CLI
Stars: ✭ 144 (-5.26%)
Mutual labels:  ethereum
Nsfminer
No Fee Ethash miner for AMD and Nvidia
Stars: ✭ 141 (-7.24%)
Mutual labels:  ethereum
Pm Contracts
Collection of smart contracts for the Gnosis prediction market platform.
Stars: ✭ 148 (-2.63%)
Mutual labels:  ethereum
Coinpusher
📈 real-time cryptocurrency chart prediction based on neuronal-networks
Stars: ✭ 141 (-7.24%)
Mutual labels:  ethereum
Rattle
evm binary static analysis
Stars: ✭ 152 (+0%)
Mutual labels:  ethereum
Sablier
The protocol for real-time finance on the Ethereum blockchain
Stars: ✭ 147 (-3.29%)
Mutual labels:  ethereum
0x Mesh
A peer-to-peer network for sharing 0x orders
Stars: ✭ 149 (-1.97%)
Mutual labels:  ethereum
Tokens
Ethereum token definitions
Stars: ✭ 144 (-5.26%)
Mutual labels:  ethereum
Ethers Rs
Complete Ethereum & Celo library and wallet implementation in Rust. https://docs.rs/ethers
Stars: ✭ 145 (-4.61%)
Mutual labels:  ethereum
Ebtc
eBitcoin (eBTC) is an ERC20 token. Its primary utility is to provide an easy & fast payment solution. Its edge over other tokens is that it is capable of sending up to 255 payments in a single transaction.
Stars: ✭ 149 (-1.97%)
Mutual labels:  ethereum
Ethereum Studio
Official Ethereum Studio project repository. And IDE specially tailored to make it as simple as possible to onboard new users into the Ethereum ecosystem
Stars: ✭ 144 (-5.26%)
Mutual labels:  ethereum
Erc20 Rest Service
ERC-20 token standard RESTful service using Spring Boot and web3j
Stars: ✭ 150 (-1.32%)
Mutual labels:  ethereum
Ethjsonrpc
Python JSON-RPC client for the Ethereum blockchain
Stars: ✭ 142 (-6.58%)
Mutual labels:  ethereum
Vanity Eth
⚡ Browser-based ETH vanity address generator
Stars: ✭ 148 (-2.63%)
Mutual labels:  ethereum
Tokenbase
A repository of ERC20 token information. Tokens listed are tradeable on https://forkdelta.github.io. We welcome contributions! 🎉
Stars: ✭ 152 (+0%)
Mutual labels:  ethereum
Set Protocol Contracts
🎛 Set Protocol Smart Contracts
Stars: ✭ 151 (-0.66%)
Mutual labels:  ethereum
Awesome Token Sale
Curated list of token sale resources / ICO resources
Stars: ✭ 149 (-1.97%)
Mutual labels:  ethereum

React Native Geth

Ethereum

Description

RNGeth makes using Go-Ethereum ( Official Go implementation of the Ethereum protocol ) with React Native simple.

What is react-native-geth?

Is a React-Native module allow you to build dApps (Decentralized Applications) transforms your mobile device into a light client node on the Ethereum Network and enables you to easily access Ethereum’s entire ecosystem. Interacting with Smart Contracts, make payment,....

What is Blockchain?

A blockchain, originally block chain, is a continuously growing list of records, called blocks, which are linked and secured using cryptography. Each block typically contains a hash pointer as a link to a previous block, a timestamp and transaction data. By design, blockchains are inherently resistant to modification of the data. It is "an open, distributed ledger that can record transactions between two parties efficiently and in a verifiable and permanent way". For use as a distributed ledger, a blockchain is typically managed by a peer-to-peer network collectively adhering to a protocol for validating new blocks. Once recorded, the data in any given block cannot be altered retroactively without the alteration of all subsequent blocks, which requires collusion of the network majority.

What is Ethereum?

Ethereum is a decentralized platform that runs smart contracts, applications that run exactly as programmed without possibility of downtime, censorship, fraud or third party interference.

What is Go Ethereum?

Go-Ethereum is one of the three original implementations (along with C++ and Python) of the Ethereum protocol. It is written in Go

What is Smart Contract?

A smart contract is a computer protocol intended to digitally facilitate, verify, or enforce the negotiation or performance of a contract. Smart contracts allow the performance of credible transactions without third parties. These transactions are trackable and irreversible.

Supported platforms

  • Android
  • iOS

Initial Setup

$ npm i react-native-geth --save

$ react-native link react-native-geth
Install Pod dependencies on iOS
cd ios/
Pod init

Edit your Podfile

// Podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'YourReactNativeApp' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  pod 'Geth', '1.8.3'
end
pod install

JavaScript Usage

import Geth from 'react-native-geth';

// Ethereum Network Frontier
const Eth = async () => {
  const geth = new Geth()
  // start node
  const start = await geth.start()

  if (start) {
    console.log('Start :', start)
    // stop node
    const stop = await geth.stop()
    console.log('Stop :', stop)
  }
}

// Custom Ethereum Network
const PrivateEth = async () => {
  // Network ID
  const networkID = 1
  // Chain ID
  const chainID = 17
  // genesis.json
  const genesis = `{
    "config": {
      "chainId": ${chainID},
      "homesteadBlock": 0,
      "eip155Block": 0,
      "eip158Block": 0
    },
    "difficulty": "20",
    "gasLimit": "10000000",
    "alloc": {}
  }`

  const config = {
    "networkID": networkID, // --networkid / Network identifier (integer, 0=Olympic (disused), 1=Frontier, 2=Morden (disused), 3=Ropsten) (default: 1)
    "maxPeers": 0, // --maxpeers / Maximum number of network peers (network disabled if set to 0) (default: 25)
    "genesis": genesis, // genesis.json file
    "nodeDir": ".private-ethereum", // --datadir / Data directory for the databases and keystore
    "keyStoreDir": "keystore", // --keystore / Directory for the keystore (default = inside the datadir)
    "enodes": "enode://[email protected][::]:XXXX" // --bootnodes / Comma separated enode URLs for P2P discovery bootstrap
  }

  const geth = new Geth(config)
  // start node
  const start = await geth.start()

  if (start) {
    console.log('Start :', start)
    const stop = await geth.stop()
    console.log('Stop :', stop)
  }
}

Documentation :

Table of Contents

Geth

Geth object

Parameters

  • config Object
    • config.chainID number Network identifier (integer, 0=Olympic (disused), 1=Frontier, 2=Morden (disused), 3=Ropsten) (default: 1)
    • config.maxPeers number Maximum number of network peers (network disabled if set to 0) (default: 25)
    • config.genesis string genesis.json file
    • config.nodeDir string Data directory for the databases and keystore
    • config.keyStoreDir string Directory for the keystore (default = inside the datadir)
    • config.enodes string Comma separated enode URLs for P2P discovery bootstrap

start

Start creates a live P2P node and starts running it.

Returns Boolean return true if started.

stop

Terminates a running node along with all it's services.

Returns Boolean return true if stopped.

newAccount

Create a new account with the specified encryption passphrase.

Parameters

  • passphrase String Passphrase

Returns Object return new account object

setAccount

Sets the default account at the given index in the listAccounts.

Parameters

  • accID Number index in the listAccounts

Returns Boolean return true if sets.

getAddress

Retrieves the address associated with the current account.

Returns String return address..

balanceAccount

Returns the wei balance of the current account.

Returns String return balance.

balanceAt

Returns the wei balance of the specified account.

Parameters

  • address String Address of account being looked up.

Returns String Return balance.

syncProgress

Retrieves the current progress of the sync algorithm.

Returns Object Return object sync progress or null

subscribeNewHead

Subscribes to notifications about the current blockchain head

Returns Boolean Return true if subscribed

updateAccount

Changes the passphrase of current account.

Parameters

  • oldPassphrase String Passphrase
  • newPassphrase String New passphrase

Returns Boolean Return true if passphrase changed

deleteAccount

Deletes the key matched by current account if the passphrase is correct.

Parameters

Returns Boolean Return true if account deleted

exportKey

Exports as a JSON key of current account, encrypted with new passphrase.

Parameters

  • creationPassphrase String Old Passphrase
  • exportPassphrase String New passphrase

Returns String Return key

importKey

Stores the given encrypted JSON key into the key directory.

Parameters

  • key String Passphrase
  • oldPassphrase String Old passphrase
  • newPassphrase String New passphrase

Returns Object Return account object

listAccounts

Returns all key files present in the directory.

Returns Array Return array of accounts objects

createAndSendTransaction

Create and send transaction.

Parameters

  • passphrase String Passphrase
  • nonce Number Account nonce (use -1 to use last known nonce)
  • toAddress String Address destination
  • amount Number Amount
  • gasLimit Number Gas limit
  • gasPrice Number Gas price
  • data Number

Returns String Return transaction

suggestGasPrice

Retrieves the currently suggested gas price to allow a timely execution of a transaction.

Returns Double Return suggested gas price

getPendingNonce

Retrieves this account's pending nonce. This is the nonce you should use when creating a transaction.

Returns Double Return nonce

sendTransaction

Sends a transaction.

Parameters

  • transaction Object Transaction object
  • passphrase String Passphrase

Returns String Return transaction

sendSignedTransaction

Sends a signed transaction.

Parameters

  • transaction Object Signed Transaction object

Returns String Return transaction

signTransaction

Signs a transaction.

Parameters

  • transaction Object Transaction object
  • passphrase String Passphrase

Returns String Return transaction

getBalance

Gets balance of an address.

Parameters

  • address String Hex address string

Returns BN Wei balance

getPeersInfo

Gets all connected peers information in an array.

Parameters

Returns Array of PeerInfo

PeerInfo

JSON Object

{
    caps: "[eth/62 eth/63 les/1 les/2]",
    id: "3afdfd40713a8b188a94e4c7a9ddc61bc6ef176c3abbb13d1dd35eb367725b95329a7570039044dbffa49c50d4aa65f0a1f99ee68e46b8e2f09100d11d4fc85a",
    localAddress: "192.168.0.2:63235",
    name: "Geth/v1.8.3-stable-329ac18e/linux-amd64/go1.10"
    remoteAddress: "31.19.176.208:30303"
}

Press the "Watch" button to get updates. Do not forget the "Star" button 😀


React Native Geth is released under the MIT license

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].