Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor() {
this.wallet = EthCrypto.createIdentity();
// initialize the nonce
this.nonce = 0;
}
constructor (wallet, genesis, network) {
// Blockchain identity
this.wallet = wallet
// P2P Node identity -- used for connecting to peers
this.p2pNodeId = EthCrypto.createIdentity()
this.pid = this.p2pNodeId.address
this.network = network
this.state = genesis
this.transactions = []
this.invalidNonceTxs = {}
this.nonce = 0
}
async function createAuthIdentity() {
const ephemeral = createIdentity()
const ephemeralLifespanMinutes = 7 * 24 * 60 // 1 week
let address
let signer
let hasConnectedWeb3 = false
if (ENABLE_WEB3) {
const result = await providerFuture
if (result.successful) {
const eth = Eth.fromCurrentProvider()!
const account = (await eth.getAccounts())[0]
address = account.toJSON()
signer = async (message: string) => {
let result
constructor() {
this.wallet = EthCrypto.createIdentity();
// initialize the nonce
// TODO
}
/* Signed transaction format
tx = {
contents: {
type: string, // either 'mint' or 'send'
amount: int, // some quantity of coins
from: string, // the address of the sender
to: string, // the address of the recipient
},
sig: string // the signature of the sender
}
*/
var accounts = {
'paypal': EthCrypto.createIdentity(),
'aparna': EthCrypto.createIdentity(),
'jing': EthCrypto.createIdentity()
}
var unsignedTxs = [
{
type: 'mint',
amount: 100,
from: accounts.paypal.address,
to: accounts.paypal.address,
nonce: 0
},
{
type: 'send',
amount: 65,
from: accounts.paypal.address,
to: accounts.aparna.address,
nonce: 1
constructor (wallet, genesis, network) {
// Blockchain identity
this.wallet = wallet
// P2P Node identity -- used for connecting to peers
this.p2pNodeId = EthCrypto.createIdentity()
this.pid = this.p2pNodeId.address
this.network = network
this.state = genesis
this.transactions = []
this.blockchain = [] //longest chain
this.allBlocks = [] //all blocks
this.invalidNonceTxs = {}
this.blockNumber = 0 //keep track of blocks added to blockchain despite getState()
const genesisBlock = {
nonce: 0,
number: 0,
coinbase: 0,
difficulty: 9000,
parentHash: 0,
timestamp: 0,
constructor() {
this.wallet = EthCrypto.createIdentity();
}
constructor() {
this.wallet = EthCrypto.createIdentity()
}
static generate_identity() {
return EthCrypto.createIdentity();
}