-
when user invokes the asset via the API then all the work it does should be atomic and either succeed in it's entirety of fail with the appropriate message. This includes if the asset invokes other assets.
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
#!/bin/bash | |
# Chrome Repo | |
sudo apt-get install fonts-liberation xdg-utils libxss1 libappindicator1 libindicator7 | |
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb | |
sudo dpkg -i google-chrome*.deb | |
sudo apt-get update | |
# Download |
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
require "crsfml" | |
require "entitas" | |
# ---- domain ---- | |
module Domain | |
struct Dimension | |
property rows : Int32 | |
property cols : Int32 | |
def initialize(@rows, @cols); end |
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
def start_workers(difficulty, block) | |
@workers = MinerWorker.create(@num_processes) | |
@workers.each do |w| | |
spawn do | |
loop do | |
break unless w.can_run | |
nonce_found_message = w.receive.try &.to_s || "error" | |
debug "received nonce #{nonce_found_message} from worker" |
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
class Job | |
def self.create(number_of_jobs : Int32) : Array(Job) | |
jobs = [] of Job | |
inbound = Channel(String).new | |
outbound = Channel(String).new | |
number_of_jobs.times do |_| | |
job = Job.new(inbound, outbound) | |
job.run | |
jobs << job |
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
def self.verify2(hex_public_key : String, message : String, r : String, s : String) | |
pkey = LibECCrypto.EVP_PKEY_new() | |
# Create a EC key structure, setting the group type from NID | |
eccgrp_id = LibECCrypto.OBJ_txt2nid("secp256k1") | |
raise "Error could not set EC group" unless eccgrp_id != 0 | |
myecc = LibECCrypto.EC_KEY_new_by_curve_name(eccgrp_id) | |
raise "Error could not create curve" if myecc.null? | |
# convert binary public key to point |
A smart asset is an entity which models a digital or real world item and is embedded into the blockchain. If we take the example of a game asset such as a sword we can model its attributes and behaviour in code which when invoked will execute the code and apply the logic.
Smart assets are defined in code and expose a set of external API's that can be invoked by the caller. Both the data that is created by the smart asset and the companion code is stored immutably in the blockchain within versioned transactions. When the code for the smart asset needs to mutate any of the associated data it creates transactions with the updated data and the latest version number. The fast transaction system is essential to make this possible.
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
# http://fm4dd.com/openssl/eckeycreate.htm | |
# https://stackoverflow.com/questions/34404427/how-do-i-check-if-an-evp-pkey-contains-a-private-key | |
# https://davidederosa.com/basic-blockchain-programming/elliptic-curve-keys/ | |
lib LibSSL | |
fun EC_KEY_generate_key(key : LibC::Int*) : LibC::Int | |
fun EC_KEY_new_by_curve_name(i : LibC::Int) : LibC::Int* | |
fun OBJ_txt2nid(s : LibC::Char*) : LibC::Int | |
fun EVP_PKEY_new : LibC::Int* | |
fun EVP_PKEY_assign(pkey : LibC::Int*, type : LibC::Int, key : Void*) : LibC::Int |
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
/* ------------------------------------------------------------ * | |
* file: eckeycreate.c * | |
* purpose: Example code for creating elliptic curve * | |
* cryptography (ECC) key pairs * | |
* author: 01/26/2015 Frank4DD * | |
* * | |
* gcc -o eckeycreate eckeycreate.c -lssl -lcrypto * | |
* ------------------------------------------------------------ */ | |
#include <openssl/bio.h> |
NewerOlder