Skip to content

Commit 1a2aff8

Browse files
committed
Initial commit
0 parents  commit 1a2aff8

24 files changed

+1196
-0
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.vscode/arduino.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"board": "esp8266:esp8266:huzzah",
3+
"configuration": "xtal=80,vt=flash,exception=disabled,eesz=4M,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200",
4+
"port": "COM3"
5+
}

.vscode/c_cpp_properties.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Win32",
5+
"includePath": [
6+
"C:\\\\Users\\\\51nodes\\\\AppData\\\\Local\\\\Arduino15\\\\packages\\\\esp8266\\\\tools\\\\**",
7+
"C:\\\\Users\\\\51nodes\\\\AppData\\\\Local\\\\Arduino15\\\\packages\\\\esp8266\\\\hardware\\\\esp8266\\\\2.5.0\\\\**"
8+
],
9+
"forcedInclude": [],
10+
"intelliSenseMode": "msvc-x64"
11+
}
12+
],
13+
"version": 4
14+
}
8 Bytes
Binary file not shown.
8 Bytes
Binary file not shown.
704 KB
Binary file not shown.
8 Bytes
Binary file not shown.
8 Bytes
Binary file not shown.
8 Bytes
Binary file not shown.
8 Bytes
Binary file not shown.

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Sarthak Kelapure
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Signer
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <Signer.h>
2+
3+
Signer test;
4+
void setup() {
5+
Serial.begin(115200);
6+
delay(2000);
7+
8+
BYTE signIt[] = "Hello";
9+
Serial.print("Signed text: ");
10+
Serial.println(test.signText(signIt));
11+
Serial.println();
12+
13+
test.generateKeys();
14+
15+
Serial.println("PRIVATE KEY GENERATED");
16+
Serial.println(test.getPrivKey());
17+
Serial.println();
18+
19+
Serial.println("PUBLIC KEY GENERATED");
20+
Serial.println(test.getPubKey());
21+
Serial.println();
22+
}
23+
24+
void loop() {
25+
delay(5000);
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#include "Signer.h"
2+
char* PRIV_KEY = "18313e538521dc5462200ebf48fdf9baea011a4d63bdb64f7be3d53736e31293";
3+
static char* CHAIN_ID = "0x03";
4+
static char* GAS_PRICE = "0x3b9aca00";
5+
static char* GAS_LIMIT = "0x186a0";
6+
const char NONCE[] = "0x126836492642972692628956258926529562795627562756275637";
7+
static const char* RECEIVING_ADDRESS = "0x0cf98523C9A14e4c7Fc053ec24723D2009a1999b";
8+
9+
Signer test;
10+
11+
void setup() {
12+
// put your setup code here, to run once:
13+
Serial.begin(115200);
14+
setTransactionDetail();
15+
}
16+
17+
void loop() {
18+
int sensValue = random(50, 100);
19+
//TODO:Get nonce from Etherscan
20+
test.setNonce(NONCE);
21+
test.setTransactionData(String(sensValue,HEX));
22+
String output = test.generateTransaction();
23+
Serial.print("Sensor Value now: ");
24+
Serial.println(sensValue);
25+
Serial.println("SIGNED TX");
26+
Serial.println(output);
27+
delay(10000);
28+
}
29+
void setTransactionDetail()
30+
{
31+
test.setPrivKey(PRIV_KEY);
32+
test.setGasPrice(GAS_PRICE);
33+
test.setGasLimit(GAS_LIMIT);
34+
test.setReceiveAddr(RECEIVING_ADDRESS);
35+
test.setChainId(CHAIN_ID);
36+
}

keywords.txt

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
########################################################
2+
# Class
3+
###################################################################
4+
5+
Signer KEYWORD1
6+
7+
###################################################################
8+
# Methods and Functions
9+
###################################################################
10+
11+
generateTransaction KEYWORD2
12+
setTransactionData KEYWORD2
13+
setNonce KEYWORD2
14+
setReceiveAddr KEYWORD2
15+
setValue KEYWORD2
16+
setPrivKey KEYWORD2
17+
setChainId KEYWORD2
18+
setGasLimit KEYWORD2
19+
setGasPrice KEYWORD2
20+
signText KEYWORD2
21+
getPrivKey KEYWORD2
22+
getPubKey KEYWORD2
23+
generateKeys KEYWORD2
24+
25+
26+
###################################################################
27+
# Constants
28+
###################################################################
29+
30+
PRIVATE_KEY KEYWORD3
31+
PUBLIC_KEY KEYWORD3

library.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "Signer",
3+
"keywords": "blockchain, ethereum, smartcontract, iot",
4+
"description": "This is an Arduino (or ESP8266) library to sign data, generate keys and sign transactions for ethereum.",
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/kungfupizza/Signer"
8+
},
9+
"authors":
10+
{
11+
"name": "Sarthak Kelapure",
12+
"email": "sarthak.kelapure@gmail.com"
13+
},
14+
"version": "0.0.2",
15+
"examples": "examples/*/*.ino",
16+
"frameworks": "arduino",
17+
"platforms": [
18+
"espressif"
19+
]
20+
}

library.properties

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name=Signer
2+
version=0.0.2
3+
author=Sarthak
4+
maintainer=Sarthak
5+
email=sarthak.kelapure@gmail.com
6+
sentence=Signing for text and transactions. Generating Keys
7+
paragraph=Made for 51nodes.io
8+
category=Other
9+
architectures=esp8266

0 commit comments

Comments
 (0)