Wiznet makers

iveth38

Published October 28, 2022 © Mozilla Public License 2.0 (MPL -2.0)

0 Projects

0 Resellers

1 Contests

Cryptoconcurrency wallet

The goal of the Crypto-Beacon is to provide a multi-purpose device that handles various task associated with cryptocurrency and blockchain.

COMPONENTS Hardware components

Raspberry Pi - Raspberry Pi Pico

x 1

Raspberry pi

Software Apps and online services

Raspberry Pi - Raspberry Pi OS

x 1

Raspbian


PROJECT DESCRIPTION

CryptoDreams - Hardware Wallet

Hardware components

Wanboard Pico Pi IMX6UL

Nextion NX3224K024

Jumper wires 

Software apps

google Android of Things

google Firebase

Nextion GUI

The Cryptoconcurrency wallet is a proof-of-concept prototype showcasing Android Things running on the very nice PICO-PI-IMX6UL. It uses a combination of built in java code as well as Firebase functions and real time databases to provide a custom cryptocurrency hardware wallet.

Dashboard Screen UI

Using the supplied code and google services the wallet can receive transactions using an API. We can simulate a device-to-device transfer by using Postman and crafting an API call to our Firebase function. The function stores the transaction and the amount into a Real-Time database. The CryptoWallet has a call-back that checks if there is a new item added to the database. When it detects the new transaction record, it displays the result on the screen for the user to acknowledge.

This is what the Firebase function looks like:

const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.addTransaction = functions.https.onRequest((req, res) => {
    const transaction = req.query.transaction;
    admin.database().ref('/new-transaction').push({ transaction: transaction }).then(snapshot => {
 var message = `${transaction} received`
        res.status(201).send( transaction );
    });
}); 
mDatabaseRef = FirebaseDatabase.getInstance().getReference().child("new-transaction"); 
mDatabaseRef.addChildEventListener(new ChildEventListener() { 
 @Override 
 public void onChildAdded(DataSnapshot dataSnapshot, String s) { 
        Log.d(TAG,"something added: " + s); 
 Log.d(TAG,"as a string: " + dataSnapshot.getValue().toString()); 
 String str = dataSnapshot.getValue().toString(); 
 //JSONObject jsonObj = new JSONObject(); 
       // jsonObj.getJSONArray() 
 try { 
            String result = str.substring(str.indexOf("=") + 1, str.indexOf("}")); 
//Change the UI 
 sendCommand("page 2"); 
 sendCommand("t1.txt=\"" +  result + "\""); 
 } catch (IOException e) { 
            Log.e(TAG, "Error", e); 
 } 
   } 
@Override 
 public void onChildChanged(DataSnapshot dataSnapshot, String s) { 
        Log.d(TAG,"something changed"); 
 } 
@Override 
 public void onChildRemoved(DataSnapshot dataSnapshot) { 
        Log.d(TAG,"something removed"); 
 } 
@Override 
 public void onChildMoved(DataSnapshot dataSnapshot, String s) { 
        Log.d(TAG,"something moved"); 
 } 
@Override 
 public void onCancelled(DatabaseError databaseError) { 
        Log.d(TAG,"something broke"); 
 } 
}); 
Postman to simulate a transaction

Some Java Code (processCommand function)

The User Interface was designed in Photoshop and then programmed onto the Nextion HMI display using the Nextion GUI Editor.

Different Screens From the UI

Supplied code showcases the ability of the wallet to respond to various touch events. During the application initialization, various callbacks are registered to the serial interface of the screen. This allows us to capture the events and parse the incoming data. Depending on the data received, a different function is called. You can lock the screen, initiate a balance refresh, and check on current market prices for various crypto currencies.

This project is built from the UART Loopback example in the Android Things example project. It provides a great starting point for interfacing with serial devices.

Areas to Expand On

The project is just the beginning. I plan to fully develop this to support many currencies and markets. A few items that need to be worked on include true cryptographic security, a web based portal or companion app that allows you to manage the device remotely. The functions need to be polished for cleanup and archival reasons. All-In-All, I feel that the Android Things platform running on the PICO-PI would make a great overall stack for something like a crypto hardware wallet.

code javascrip index.js

const functions = require('firebase-functions');
const admin = require('firebase-admin');

admin.initializeApp(functions.config().firebase);
exports.addTransaction = functions.https.onRequest((req, res) => {
    const transaction = req.query.transaction;
    admin.database().ref('/new-transaction').push({ transaction: transaction }).then(snapshot => {
        var message = `${transaction} received`
        res.status(201).send( transaction );
    });
});
// // Create and Deploy Your First Cloud Functions
// // https://firebase.google.com/docs/functions/write-firebase-functions
//
// exports.helloWorld = functions.https.onRequest((request, response) => {
//  response.send("Hello from Firebase!");
// });

 

Documents
  • PICO-PI-IMX6UL

    Wanboard

  • Wandboard PICO-PI-IMX6UL

    The Wandboard i.MX6 is a low power complete computer with high performance multimedia capabilities based around the NXP i.MX6 Cortex-A9 processor.

  • Code programming

    The Wandboard i.MX6 is a low power complete computer with high performance multimedia capabilities based around the NXP i.MX6 Cortex-A9 processor.

  • Code programming

    The Wandboard i.MX6 is a low power complete computer with high performance multimedia capabilities based around the NXP i.MX6 Cortex-A9 processor.

Credits
iveth38

0 Projects

0 Resellers

1 Contests

Comments Write