GithubHelp home page GithubHelp logo

requaos / xeth-wallet-for-nfc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from omodaka9375/xeth-wallet-for-nfc

0.0 1.0 0.0 1.89 MB

Example of simple Ethereum API server with endpoints, and a client NFC app.

License: MIT License

JavaScript 100.00%

xeth-wallet-for-nfc's Introduction

xETH wallet for NFC

Screenshot

Example of simple Ethereum API server with endpoints, and a client NFC app.

  • /createWallet create an ethereum wallet
  • /getBalance checking wallet balance
  • /transaction making a transaction

Getting started with the server-side:

# Go to https://infura.io/ and get your ETH API key.
# It looks like this: 
# https://rinkeby.infura.io/v3/3fe7c90a4ec34aae900a7900d3fb48dc
# You can use mine for test, but it's free so please create your own at https://infura.io/
# Put your key in 'src/config.json' under 'ethereumNetwork'
# Install dependencies
npm install
# Start developing
npm run dev
# Start production server
npm start

Config

{
  "port": 8080, // port to launch app to
  "bodyLimit": "1kb", // max size of request json object
  "ethereumNetwork": "" // Infura API key
}

Endpoints

/createWallet

GET localhost:8080/createWallet
# response
{
  "address": CREATED_WALLET,
  "privateKey": PRIVATE_KEY
}

/getBalance/SOME_ETH_ADDRESS

GET localhost:8080/getBalance/SOME_ETH_ADDRESS
# response
{
  "ethAddress": SOME_ETH_ADDRESS,
  "balance": BALANCE
}

/transaction

POST to localhost:8080/transaction
BODY
{
	"privateKey": YOUR_PRIVATE_KEY,
	"amount": AMOUNT,
	"destination": DESTINATION_WALLET
}
# response
{
  "txHash": TRANSACTION_HASH
}

Getting started with the client:

As a client we are using NFC Tools Pro to program and write the wallet "app" on the NFC chip.

The "app" has 25 tasks and total 828 bytes.

# Download 'xETH_profile.json' and save it on your phone somewhere.

# This file is the main app file needed.
# Open NFC Tasks app and go to Settings/User variables and create next important five variables and fill in with your details:

- ADDRESS # put your public address on ETH here
- PRIVATEKEY # put private key here (soon support encrypted with password)
- BALANCEURL # put balance endpoint here, eg.: https://<your-host>/getBalance/<your-eth-public-address>
- TRANSACTURL # put transaction endpoint here, eg.: https://<your-host>/transaction
- CREATEURL # put your create endpoin here, eg.: https://<your-host>/createWallet

# Now create next empty variables:

- AMOUNT # temp store for sending amount
- BALANCE # temp store for showing balance
- CHOICE # temp store for menu choice acions
- DESTINATION # temp store address that we want to send ETH
- TXHASH # temp store for showing 
- WALLET # temp store created address info 

Installing the app and writing it to the NFC chip:

  • Turn on NFC on your phone
  • Open NFC Tools PRO
  • Go to TASKS/More options
  • Tap 'Import task profiles' and select the downloaded xETH_profile.json file
  • Go back to Task screen and you should see all commands listed
  • Put your chip near your phone and tap 'Write/828 Bytes'
  • Tip: If ou want to test the app without NFC chip, you can go to 'TASKS/More options', a the bottom of the list you have 'Execute your tasks profile' and select the imported profile. It will execute the app and it can be tested if it functions as specified, before writing to a chip.

Video demo

xETH demo

Security tips

  • Whitelisting your nfc chip
  • Using password encrypted private key (soon)
  • Using SSL to communicate to app

We configured app to work on Rinkeby test net, so it’s safe to play with.

If you want to use it on Mainnet, just get that Infura API mainet end-point, and copy it to your 'src/config.json' file.

License

MIT

Contributions

Thanks to @wingleung for simple api code https://github.com/wingleung/ethereum-wallet-api-example

xeth-wallet-for-nfc's People

Contributors

omodaka9375 avatar dependabot[bot] avatar wingleung avatar

Watchers

James Cloos 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.