contract signing authority

11
Contract Signing Authority • Use Case – Allow a signing authority to sign electronic documents – Documents are not stored, but referenced with a hash value (SHA3-256) – Anyone can verify if a given document was signed, by whom and when – Signing authority implemented as Solidity Smart Contract which saves the document hash and signing date on the blockchain • Pre-requisites – Running Ethereum node (I used here Go-Ethereum or Geth) – Have an account with some positive ether balance – Access to a Solidity compiler (I used solidity-browser)

Upload: jp-de-vooght

Post on 06-Apr-2017

177 views

Category:

Technology


1 download

TRANSCRIPT

Contract Signing Authority

• Use Case– Allow a signing authority to sign electronic documents– Documents are not stored, but referenced with a hash value (SHA3-

256)– Anyone can verify if a given document was signed, by whom and

when– Signing authority implemented as Solidity Smart Contract which saves

the document hash and signing date on the blockchain

• Pre-requisites– Running Ethereum node (I used here Go-Ethereum or Geth)– Have an account with some positive ether balance– Access to a Solidity compiler (I used solidity-browser)

Technology Overview

geth --rpcgeth attach

Webapp

Smart Contractcontract Authority {

enum Type { Null, SingleSigner, MultiSigner }

enum Error { NoError, AccessDenied, InvalidHash, HashNotFound, HashAlreadySigned }

event Sign(bytes32 indexed hash, uint indexed error);

function sign(bytes32 hash) returns (Error error); function signed(bytes32 hash) constant returns (bool signed); function isSigner(address addr) constant returns (bool); function authType() constant returns (Type authType);}

Source: https://github.com/androlo/doc-auth

Compile Smart Contract

paste code

copy for geth deploy

compile

Source: https://github.com/chriseth/browser-solidity

Paste web3 JS Code Into Attached Console

Contract Committed (Geth)

Add Contract Address to Javascript

Sign Whitepaper (Gas Cost: 20 GWei)

Gas

Gas is the internal pricing for running a transaction or contract in Ethereum.In fact the term Gas is simply the Ether cost you have to pay to get your Ethereum message or transaction executed as soon as possible. With Ethereum there is a blocksize limit too – so you’re paying for premium space in the next block just like with Bitcoin.With Bitcoin miners prioritise transaction with the highest mining fees. The same is true of Ethereum where miners are free to ignore transactions whose gas price limit is too low.

The gas price per transaction or contract is set up to deal with the Turing Complete nature of Ethereum and its EVM (Ethereum Virtual Machine) Code – the idea being to limit infinite loops. So for example 10 Szabo, or 0.00001 Ether or 1 Gas can execute a line of code or some command. The more complex the commands you wish to execute, the more gas (and Ether) you have to pay. If there is not enough Ether in the account to perform the transaction or message then it is considered invalid.

The idea is to stop denial of service attacks from infinite loops, encourage efficiency in the code – and to make an attacker pay for the resources they use, from bandwith through to CPU calculations through to storage.

Transaction Recorded on Ethereum

Verify Whitepaper Signed