Artworld Ethereum with Truffle & Meteor

Is Art

I’ve started moving my Ethereum projects to Truffle (Pudding) and Meteor, getting ready to deploy them to the live network.

https://gitlab.com/robmyers/artworld-ethereum

Ethereum: Truffle + Meteor

Meteor is the recommended development framework for Ethereum dApps. Truffle is Consensys’ development  system for Ethereum dApps. We cannot currently add a Meteor build phase to Truffle, but we can integrate them easily enough with a script.

Install Meteor, Truffle and testrpc:

curl https://install.meteor.com/ | sh
sudo npm install -g truffle
sudo npm install -g ethereumjs-testrpc

Then create a file called truffle-meteor-build, in ~/bin or somewhere else easily accessible and paste the following into it:

#!/bin/bash

# By Rob Myers <[email protected]>
# CC0 2016
# To the extent possible under law, the person who associated CC0 with this
# work has waived all copyright and related or neighboring rights to this work.

# We copy the .meteor/ dir from app/ into the specified environment's build/ dir
# then call meteor-build-client in there, building into a meteor/ directory
# next to build/ .

if [ "${1}" = "-h" ] || [ "${1}" = "--help" ]
then
    echo "Usage: truffle-meteor-build [environment]"
    echo "       Copies the .meteor directory from app into the truffle build,"
    echo "       then calls meteor-build-client."
    echo "ARGS:  [environment] - The truffle environment to use (default developmpment)."
    echo "       Make sure you have npm install -g meteor-build-client"
    echo "       and meteor init in the truffle app/ directory."
fi

environment="${1:-development}"
base_dir="$(pwd)"

if [ ! -f "${base_dir}/truffle.json" ]
then
    echo "Please call from within the top level of a Truffle project."
    exit 1
fi

app_dir="${base_dir}/app"
dot_metoer_dir="${app_dir}/.meteor"
environment_dir="${base_dir}/environments/${environment}"
truffle_build_dir="${environment_dir}/build"
meteor_build_dir="${environment_dir}/meteor"

if [ ! -d "${environment_dir}" ]
then
    echo "Cannot find directory for environment ${environment}."
    exit 1
fi

pushd "${base_dir}" > /dev/null
echo "Truffle: building ${environment} in ${truffle_build_dir}"
truffle build "${environment}"
cp -r "${app_dir}/.meteor" "${truffle_build_dir}"
pushd "${truffle_build_dir}" > /dev/null
echo "Meteor: building client in ${meteor_build_dir}"
meteor-build-client "${meteor_build_dir}" -p ''
popd > /dev/null
popd > /dev/null

And make it executable:

chmod +x truffle-meteor build

In one shell window start testrpc:

testrpc

In another shell window create the Truffle/Meteor project:

mkdir truffle-meteor
truffle init
cd truffle-meteor
cd app
rm -rf *
meteor create .
meteor add ethereum:elements

This will create files called app.html, app.js, and app.css . You can rename them to whatever you like. Open truffle-meteor/truffle.json in a text editor and make sure the filenames match those in app/, that the Javascript file has the requisite post-processing commands to add Truffle and the Contract code and that there are no post-process commands for the HTML files.

The results should look similar to this:

{
  "build": {
    "is-art.html": {
      "files": [
        "is-art.html"
      ],
      "post-process": []
    },
    "is-art.js": {
      "files": [
      "is-art.js"
      ],
      "post-process": [
        "bootstrap",
        "frontend-dependencies"
      ]
    },
    "app.css": [
      "is-art.css"
    ],
    "images/": "images/"
  },
  "deploy": [
    "IsArt"
  ],
  "rpc": {
    "host": "localhost",
    "port": 8545
  }
}

Edit the contract, HTML, CSS and JavaScript as needed.

Deploy the contract:

truffle deploy

Then build the meteor project:

truffle-meteor-build

You can now open the Meteor client in a web browser:

chromium environments/development/meteor/index.html

As you continue to develop the project you can reload the Meteor client in the web browser to see your changes. Make sure you keep testrpc running – if you stop and restart it you’ll need to deploy the contracts again.

Artwork Of The Century

Shareable Readymades Sheet

Great at the London Art fair – Rob Myers ‘Artwork of the Century’ shareable ready-mades with ‘Certificate of Inauthenticity’

(Image and quote – Bruno Martelli.)

Artworks And Curation On The Blockchain

Artworks and curation can both take place on or be represented on the blockchain.

Artworks can be stored directly as data on the Bitcoin blockchain or represented by various proxy schemes.

Curation of digital artworks for exhibition online or in the gallery can be organized and effected on the Bitcoin blockchain using these representations.

For both artworks and exhibitions this has the advantages of permanence, transparency, and of engagement with new technological means of organization.

Storing Artworks On The Blockchain

Storing data on the blockchain has technological and social limits.

Technologically, storing more than a few kilobytes of data on the blockchain will be a slow process as many transactions will have to be sent over the course of several blocks to avoid the Bicoin blockchain’s current one megabyte per block limit and to ensure that the transactions are stored in the correct order.

Socially, adding non-Bitcoin-transaction data to the blockchain leads to “blockchain bloat”. This is where the Bitcoin blockchain, already over 40 gigabytes in size, grows more quickly than necessary to maintain the security of the Bitcoin currency.

See here for examples of various techniques: Hidden surprises in the Bitcoin blockchain and how they are stored

Unspendable Addresses

The original way of storing data on the Bitcoin blockchain was to send small amounts of Bitcoin to addresses that do not represent valid public keys but instead represent 20 byes of arbitrary data. This wastes the sent Bitcoin as there is no valid key that can be used to re-send it. The resulting transaction stores the data in the Bitcoin blockchain.

To send more than 32 bytes of data, the data must be encoded 32 bytes at a time and sent as multiple transactions.

OP_RETURN

The Bitcoin script opcode OP_RETURN can be used to return 40 bytes of data from a Bitcoin transaction. This does not require that any Bitcoin be wasted, and does not require the Bitcoin software to keep track of the transaction in case its value is ever spent in future (it is still stored on the Blockchain).

To send more than 40 bytes of data, the data must be encoded 40 bytes at a time and sent as multiple transactions.

Representing Artworks On The Blockchain

Storing identifiers for artworks on the blockchain provides a more efficient but in some cases less robust means of referring to objects via the Blockchain.

ascribe.io

ascribe.io places records of ownership (and Creative Commons Licensing) of digital artworks on the Bitcoin blockchain. The artworks media files are stored by ascribe.io . Its SPOOL protocol can be used by third parties to identify and transfer ownership of artworks. Other services and technologies are available.

SPOOL supports a “Loan” operator for exhibition rights.

URL

The URL of the artwork can be represented by one or more unspendable addresses or OP_RETURN transactions.

Work Hash

The cryptographic hash (e.g. sha256) of the artwork’s digital media file, or of a written description or other means of identifying the work, can be placed on the blockchain as an unspendable address or OP_RETURN transaction.

Signature By Valid Address

The public key of a valid Bitcoin address (preferably a vanity address) can be used to create the cryptographic hash of an artwork’s digital media file or other identifier. This hash can then be communicated via a transaction or by off-blockchain means.

Authority Control

If the artist registers their works via traditional means, the full text or hash of the artwork’s authority control identifier can be placed on the blockchain.

Referring To Artworks On The Blockchain

When The Artwork Is Stored On The Blockchain

When the artwork is stored in unspendable addresses or in OP_RETURN values, either the first transaction in the series or the sending address (where that address is used only to send the transactions representing the artwork) can be used to refer to the artwork.

When The Artwork Is Represented On The Blockchain

When the artwork is represented on the blockchain by an invalid Bitcoin address (for example one storing a URL or one representing the hash of the artwork’s digital media file), this address can be used to refer to it.

When the artwork is represented by a valid Bitcoin address, this address or transactions (containing values) signed by it can be used to refer to the artwork.

Crypto Tokens And Coloured Coins

Systems such as Counterparty and Coloured Coins add the ability to use Bitcoin’s blockchain to store or represent tokens for assets other than the Bitcoin currency.

These tokens can be used to represent artworks, shares in artworks, involvement in a show or other grouping, and just about anything else.

Sending someone a token is functionally equivalent to signing their key in web-of-trust based cryptographic systems, although it does not have the same social significance.

To refer to an artwork with a token, send the token to the artwork’s address. Where the artwork’s address is not a valid Bitcoin address, this will make the token unrecoverable. Where the artwork’s address is a valid Bitcoin address that the artist controls, they will be able to transfer the token to a third party if they wish.

Curation

Calls For Submissions

Calls for submissions can be broadcast on the blockchain either as Counterparty broadcasts or as urls, messages, or GitHub commit hashes placed on the blockchain using a system like Cryptograffiti.

Acceptance And Rejection

Acceptance of the work can be represented via the transfer of Counterparty or Coloured Coin tokens.

Broadcasts via Counterparty or Cryptograffiti from the artwork’s or (more likely) artist’s valid Bitcoin address can .

Loan And Exhibition

ascribe.io’s SPOOL protocol supports Loan operations.

Broadcasts via Counterparty or Cryptograffiti from the artwork’s or (more likely) artist’s valid Bitcoin address can contain and confirm loan information.

Loan of artworks can be represented via the transfer of Counterparty or Coloured Coin tokens.

In particular, Token Controlled Access can be used to restrict or enhance access to works using Counterparty or other tokens.

A similar, non token approach would be for net based artworks to use a Bitcoin address whitelist allowing exhibition machines (in the gallery) or proxies (for online shows) to display them if they can cryptographically sign their requests using the valid Bitcoin key used to accept and pay for the loan.

Exhibition Fees

Exhibitor fees can be paid in Bitcoin to a valid Bitcoin address, either that of the artwork or, more likely, the address that created the storage or representation of the artwork on the blockchain

Show Duration

The duration of the show can be expressed in terms of ranges of Bitcoin block numbers or UNIX timestamps.

Webliography

ascribe.io

Coloured Coins

Counterparty

Counterparty broadcasts

Cryptograffiti

Hidden surprises in the Bitcoin blockchain and how they are stored

OP_RETURN

SPOOL

Token Controlled Access

Unspendable Addresses

Neterarti – Net Art Social Networking Freedom

neterarti-screnshot-marc

(Image via Marc Garrett)

https://neterarti.furtherfield.org/

Neterarti is Furtherfield‘s new social network for net artists based on the GNU social Free Software social network system. If you’re familiar with Twitter it’s very similar, and it’s easy to access via the web or desktop and mobile apps.

Sign up and start netting and arting!

Play Art Data Money at London Art Fair

Bunnybots – Cryptoart for art angels” at London Art Fair.

Play and remix here –

http://playyourplace.co.uk/playnew.html?id=203

Furtherfield mention my work and Primavera di Filippi as influences. 🙂

Shareable Readymades At London Art Fair

SR-Urinal-01

Furtherfield are taking the Shareable Readymades to London Art Fair this week, they’re for sale for Bitcoin and GBP.

Who’d like a solid gold urinal?

Minara 0.4.0

minara-cairo-gtk-test

I’ve been making the regular (accidentally) six-yearly update to Minara, my vector graphics program.

The new version switches from GLUT to Gtk for the windowing system, from GLU to Cairo for the renderer, and from C to pure Scheme for the core application. It’s all written in The GNU project’s Guile Scheme system.

Minara is Lisp all the way down: the application, tools, and graphics files are all written in Scheme. It’s designed as an environment for 2D generative vector art hacking.

Blog Edit Disclosure

I’ve run a script on the database of this blog that corrected some spellings, changed all <br /> tags to have just one space in, fixed some urls and changed references to http(s)://www.robmyers.wpengine.com to https://robmyers.wpengine.com/

I’m going to edit some posts manually through the blog web interface now to restore their formatting, this will show up in their edit history.