Skip to content

๐Ÿ‘› AnyLedger Embedded Ethereum wallet library for Particle Photon

License

Notifications You must be signed in to change notification settings

Anylsite/embedded-ethereum-wallet

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โš ๏ธ This repository has been retired and is no longer maintained โš ๏ธ

Code for anyledger wallet now resides in https://github.com/AnyLedger/anyledger-wallet

AnyLedger Embedded Ethereum wallet library for Particle Photon

You can find example usage of the library inside examples

Usage

Add the embedded-ethereum-wallet library to your project and follow this simple example:

` // First, we need to create public key from the private one vector<uint8_t> publicKey = CryptoHelper::generateAddress(PRIVATE_KEY);

// Then, we will create public address using public key vector checksumAddress = CryptoHelper::generateChecksumAddress(publicKey);

// Let's convert the address into HEX format string checksumAddressHex(checksumAddress.begin(), checksumAddress.end());

Serial.printlnf("Public address: %s", checksumAddressHex.c_str());

// Now we can start building up the transaction itself Transaction transaction; transaction.setPrivateKey((uint8_t*)PRIVATE_KEY);

// Make sure that nonce number is not smaller than the total number of transactions for the address // Total transaction is available through JSON-RPC method eth_getTransactionCount uint32_t nonce = 42; uint32_t chainId = CHAIN_ID; uint32_t gasPrice = GAS_PRICE; uint32_t gasLimit = GAS_LIMIT;

string to = CONTRACT_ADDRESS; string value = ""; string data = "0xc604091c0000000000000000000000000000000000000000000000000000000000000011";

// The last step is passing all the necessary values for transaction signing process String rawTransaction = transaction.getRaw(nonce, gasPrice, gasLimit, &to, &value, &data, chainId);

// Raw transaction is ready to be sent to JSON-RPC method call eth_sendRawTransaction Serial.printlnf("Signed raw transaction: %s", rawTransaction); `

See the examples folder for more details.

Contributing

To get started, clone the library from GitHub to your local machine.

License

Licensed under the GNU GENERAL PUBLIC LICENSE

Releases

No releases published

Packages

No packages published

Languages

  • C 59.1%
  • C++ 40.9%