This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE accounts( | |
id serial PRIMARY KEY, | |
name VARCHAR(256) NOT NULL, | |
balance NUMERIC(20, 2) NOT NULL DEFAULT '0' | |
); | |
CREATE TABLE entries( | |
id serial PRIMARY KEY, | |
description VARCHAR(1024) NOT NULL, | |
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[macro_use] | |
extern crate lazy_static; | |
use async_std::task; | |
use rand::{ | |
distributions::{Distribution, Standard}, | |
Rng, | |
}; | |
use std::{ | |
future::Future, | |
pin::Pin, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"inputs": [], | |
"name": "emitEvent", | |
"outputs": [], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"anonymous": false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ libsecp256k1 git:(master) rm -rf deps/ _build/ | |
➜ libsecp256k1 git:(master) mix deps.get && mix compile | |
* Getting libsecp256k1_source (https://github.com/bitcoin-core/secp256k1.git) | |
remote: Enumerating objects: 16, done. | |
remote: Counting objects: 100% (16/16), done. | |
remote: Compressing objects: 100% (14/14), done. | |
remote: Total 4958 (delta 4), reused 9 (delta 2), pack-reused 4942 | |
Receiving objects: 100% (4958/4958), 2.06 MiB | 3.08 MiB/s, done. | |
Resolving deltas: 100% (3462/3462), done. | |
Resolving Hex dependencies... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use crate::error; | |
use ellipticoin::{export, get_memory, sender, set_memory}; | |
use wasm_rpc::Value; | |
use wasm_rpc::error::Error; | |
enum Namespace { | |
Balances, | |
} | |
#[export] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import time | |
# All monetary values are in Ellipticoin Base Units (one onethousandth of an Ellipticoin) | |
YEARS_PER_ERA = 2 | |
NUMBER_OF_ERAS = 7 | |
SECONDS_PER_BLOCK = 5 | |
SECONDS_IN_A_YEAR = datetime.timedelta(days=365).total_seconds() | |
BLOCKS_PER_ERA = int(YEARS_PER_ERA * SECONDS_IN_A_YEAR)/ SECONDS_PER_BLOCK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import datetime, time | |
import time | |
BLOCKS_PER_SECOND = 5 | |
# This was chosen because it's an exponent of 2 | |
# And it works out to about a year (1.3 years) if blocks are produced every 5 seconds as planned. | |
BLOCKS_PER_ERA = 2**23 | |
# This was chosen because it puts the final issuance sometime in 2031 | |
# If Ellipticoin hasn't caught on by then assume we've failed :/ | |
NUMBER_OF_ERAS = 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hashfactor is proof of work algorithm inspired by [hashcash](http://www.hashcash.org/). | |
# Hashfactor is simpler to implement than hashcash but the result is not a | |
# hash with leading zeros. This tradeoff is worth-while if you have access to | |
# a computer to validate proof of work values but you'd like implementation to | |
# be simpler. | |
from random import randint | |
import binascii | |
import hashlib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2019-02-25T14:33:44Z |INFO| Database has been loaded. db_path: testdb_1 | |
2019-02-25T14:33:44Z |INFO| Successfully seeded the genesis of this node. file: genesis.json num_accounts: 1 | |
2019-02-25T14:33:44Z |INFO| Registered transaction processor service. module: cloud.wasm | |
2019-02-25T14:33:44Z |INFO| Registered transaction processor service. module: contract.wasm | |
2019-02-25T14:33:44Z |INFO| Registered transaction processor service. module: money.wasm | |
2019-02-25T14:33:44Z |INFO| Registered transaction processor service. module: stake.wasm | |
2019-02-25T14:33:44Z |INFO| Keypair loaded. private_key: 6d6fe0c2bc913c0e3e497a0328841cf4979f932e01d2030ad21e649fca8d47fe71e6c9b83a7ef02bae6764991eefe53360a0a09be53887b2d3900d02c00a3858 public_key: 71e6c9b83a7ef02bae6764991eefe53360a0a09be53887b2d3900d02c00a3858 | |
2019-02-25T14:33:44Z |INFO| Listening for peers. address=tcp://127.0.0.1:3000 | |
2019-02-25T14:33:44Z |INFO| Local HTTP API is being served. host: localhost port: 9000 | |
Enter a message: 2019-02-25T14:33:56Z |INFO| Connected t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('crypto'); | |
const { StringDecoder } = require("string_decoder"); | |
const fs = require("fs"); | |
const util = require('util'); | |
const writeFile = util.promisify(fs.writeFile); | |
const readFile = util.promisify(fs.readFile); | |
const fileExists = util.promisify(fs.exists); | |
const _ = require("lodash"); | |
const TRANSACTION_ID = new Uint8Array(256); | |
const ALICE = new Uint8Array(256).fill(1); |
NewerOlder