You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nprimo 4fa5c876a7 docs: run prettify and move h1 to h2 1 year ago
..
README.md docs: run prettify and move h1 to h2 1 year ago

README.md

Basic Wallet

- Do you always look at it encoded ? - Well you have to, the image translators work for the construct program, but there is way too much information to decode the Matrix

Instructions

  • Create a function generateAddress() that generates a cryptographic key pair on any elliptic curve and stores locally the private key in a wallet.pem file and returns the hash of the public key (spki/der) prepended with '01'

  • Create a function createTransaction(amount, recipient) that takes as arguments an integer and a string. It returns a string with the following format:

sender + recipient + hexAmount + signature

  • sender is the hash of the public key (spki/der) of the current user prepended with '01'
  • recipient is the recipient taken as parameter
  • amount is the amount taken as parameter in hexadecimal form
  • signature is a digital signature of the first three fields, using the private key stored in wallet.pem

Usage

let address = generateAddress()
console.log(address)
// 01ae9596973b45d10e6a65c7fdcc593f63283bd405539c77e83938750d29729fac
let transaction = createTransaction(
  200,
  '01ffa17f4e0bbb2f049f5d1f9d4ab9fad967e6b0ed9a8fc94563d0b4e47b62e169',
)
console.log(transaction)
// 01ae9596973b45d10e6a65c7fdcc593f63283bd405539c77e83938750d29729fac01ffa17f4e0bbb2f049f5d1f9d4ab9fad967e6b0ed9a8fc94563d0b4e47b62e1692003045022017cdeb0e982e0705044caeb73db8d86992282f466c8b124cff0bfef64ae8be72022100ec4c6025d83a726bb483ebd05e53da37de28eaeb5db85068e355974c3caffaa4

Notions