Bitcoin Forum
June 16, 2024, 06:56:40 PM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Smart Contract: WeatherForecastAtLocation  (Read 356 times)
AndreasKrueger (OP)
Member
**
Offline Offline

Activity: 95
Merit: 11


View Profile
July 19, 2016, 12:47:53 PM
 #1

Smart Contract: WeatherForecastAtLocation

Code:

Novel smart contract solution for Ethereum based platforms, here: SOIL.  
On-chain delivery of weather forecasts, for any mapped location on Earth.

User-paid request selects location - an oracle answers to that event.
Then 1 nowcast, and 4 forecasts can be read by anyone, for 4 days.


In the following posts, I am going to present more about this project, step-by-step.
Reposts from the SOIL thread, to keep everything about this big project in one place.

Is this your first interaction with a real, live, non-financial SMART CONTRACT ever?
Let us together learn what we can about the "world computer". Exciting times ...

  • post 1: Introduction
  • post 2
  • post 3
  • post 4

new http://btc.hopto.org BTCrates + nearby numbers
AndreasKrueger (OP)
Member
**
Offline Offline

Activity: 95
Merit: 11


View Profile
July 19, 2016, 12:52:23 PM
Last edit: July 20, 2016, 08:46:41 PM by AndreasKrueger
 #2


Text01: Introduction

TOC:
        Why Weather?
        Ecologically oriented "smart contracts" - why weather?
        How to make blockchains aware of the real world, and: a warning!
        Oracles
        Oracle contract: "WeatherForecastAtLocation"
        Nowcasting
        Money talks
        You're next
        Components


Read it in HTML, or PDF: view or download.

Please give feedback. Thanks.

new http://btc.hopto.org BTCrates + nearby numbers
AndreasKrueger (OP)
Member
**
Offline Offline

Activity: 95
Merit: 11


View Profile
July 20, 2016, 08:46:14 PM
 #3


Manual02: Prepare your system

  • Windows vs Linux, VPS
  • Install Soil
  • Clone/download repo
  • Correct folder
  • Add peers
  • What is the JavaScript console, with examples
  • Languages: Solidity + JavaScript/Python
  • Python via RPC, with examples & gsoil-starterscripts (BAT / sh)

https://github.com/drandreaskrueger/weathercontract_user/blob/master/manual/manual02-preparations.md

Please tell me if you run into any problems.

new http://btc.hopto.org BTCrates + nearby numbers
AndreasKrueger (OP)
Member
**
Offline Offline

Activity: 95
Merit: 11


View Profile
July 25, 2016, 10:36:10 PM
 #4


Manual03: HyperQuick-Start

Start gsoil & gsoil console. Load scripts:
Code:
gsoil
gsoil attach

loadScript('useful/addpeers.js')
loadScript("contract/contract.js")
loadScript("contract/tools.js")

TOP UP LOCATION --> wait your and oracle's TX --> ASK FORECAST

Code:
city =   "q=Nanjing,China"
getForecast_message(city)

PRICE
tx = topUpLocation(city, 3); txReceipt = waitForTxReceipt(tx)

admin.sleepBlocks(1); getForecast_message(city)

getForecast(city)
getForecast(city, timestamp_now_plus_hours(24))
getForecast(city, timestamp_now_plus_hours(24 * 3.5))

getForecast_message(city, timestamp_now_plus_hours(24 * 4.5))

Step-by-step explanations in the quickstart manual.


new http://btc.hopto.org BTCrates + nearby numbers
AndreasKrueger (OP)
Member
**
Offline Offline

Activity: 95
Merit: 11


View Profile
July 26, 2016, 05:16:25 PM
 #5

Summary

  • Contract ( v0.5.9 ) is deployed, at address 0x0c5c4bc449808eee712b1d0858e2b12e71410c8e
  • Oracle eventlogloop is listening to its events, and uploads weather data whenever a location is "topped up"
  • and it updates the forecasts every 24 hours, as long as there is a positive locationBalance
  • Contract ABI is published as contract.js for easy import into console.
  • Contract tools.js help you to interact with it, on the JavaScript console  gsoil attach.
  • and most importantly:

    YOU CAN TRY OUT THE QUICKSTART MANUAL NOW.


Perhaps this is even your first interaction with a real, live, working, innovative SMART CONTRACT ever?  Exciting times ...

I have fully tested the preparations and the quickstart manual on a fresh droplet, but please report any issue.


you can tweet this image:

new http://btc.hopto.org BTCrates + nearby numbers
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!