Skip to content

Instantly share code, notes, and snippets.

View nimbosa's full-sized avatar

nimbosa nimbosa

View GitHub Profile
@nimbosa
nimbosa / ZEC-ETH.md
Last active April 15, 2018 05:03 — forked from arielgabizon/gist:7e9906d3e06106cb5cfb7651a954c8b4
ZEC-ETH atomic cross-chain trading

I was reading about atomic cross-chain trading in the wiki https://en.bitcoin.it/wiki/Atomic_cross-chain_trading and think that perhaps the Zcash circuit could be used to easily get semi-private Zcash-ETH atomic cross-chain trading.

As in the wiki it would require the parties to communicate before and verify by themselves that certain things have appeared on the two chains. On the other hand, it doesn't require ETH chain to verify Zcash Proof of Work as I thought was needed. What the ETH client will need to do is verify a snark of the Zcash circuit (which was recently implemented for the C++ client as described in https://z.cash/blog/zcash-eth.html)

Semi-private means Alice will agree with Bob to exchange say 10 zec for 1 eth, and this 10 will only be known by both of them. Furthermore the address to which Bob's 10 zec note will be sent will be a z-addr known only by him and Alice.

So here's how it could work (simplified)

  1. Alice will send Bob the Eth address Addr where she wants to receive her 1 eth

Previously described at: ERC20 critical problems medium article.

Description.

ERC20 is the most common Ethereum token standard. It should be noted that it is also the first Ethereum token standard as well.

It is also important that the original ERC20 proposal is a definition of token interface. EIP20 does not define a reference implementation for this token standard. Here is the OpenZeppelin implementation of ERC20 token: https://github.com/OpenZeppelin/zeppelin-solidity/tree/master/contracts/token/ERC20

ERC20 token standard implementation assumes two ways of token transfer: 1.) transfer function; and 2.) approve + transferFrom pattern.

#!/usr/bin/env python
# with help and inspiration from
# * ASN1_generate_nconf(3) (specifically the SubjectPublicKeyInfo structure)
# * http://www.sysmic.org/dotclear/index.php?post/2010/03/24/Convert-keys-betweens-GnuPG%2C-OpenSsh-and-OpenSSL
# * http://blog.oddbit.com/2011/05/converting-openssh-public-keys.html
import sys
import base64
import struct
export BOXNAME=smartos01
export ISO=https://download.joyent.com/pub/iso/latest.iso
# Download iso
wget $ISO
# Create VM
VBoxManage createvm --name $BOXNAME --ostype OpenSolaris_64 --register
VBoxManage modifyvm $BOXNAME --memory 1024 --hwvirtex on --hwvirtexexcl off --nestedpaging on --largepages on --vtxvpid on --accelerate3d off --boot1 dvd --boot2 disk --acpi on