Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sponsored data APIs #21

Open
leithaus opened this issue Nov 2, 2020 · 3 comments
Open

Sponsored data APIs #21

leithaus opened this issue Nov 2, 2020 · 3 comments

Comments

@leithaus
Copy link

leithaus commented Nov 2, 2020

Description: Implement sponsored data API.

Motivation/Impact/Importance: allows on-chain data to be sponsored by advertisers and other sponsors.

Completion/Success Criteria: Provide a modified version of for-comprehension with an additional parameter for sponsorship tokens. When sufficient tokens are supplied the data brought back is free of sponsored impressions. When insufficient tokens are supplied sponsored impressions are delivered along with the data. Likewise, extend send to mark it as storing sponsored impressions.
Bonus points: 1. Extend the model to include sponsored deployments and not just sponsored data.

Link to specs and additional info :
https://drive.google.com/drive/folders/1yWb8-92OfzVtccsm9hNW1AR7HtUsyxzO
Current Interpreter code https://github.com/rchain/rchain/tree/dev/rholang/src/main/scala/coop/rchain/rholang
https://github.com/rchain/rchain/tree/dev/rholang (The read.me needs a review and may be old)

Mentors : @leithaus

Team :

Skills : Scala required, Rholang knowledge helps. Interest in implementing translators, interpreters, compilers etc.

Judgment criteria :

Rchain Priority :

@dckc
Copy link

dckc commented Nov 5, 2020

@dckc
Copy link

dckc commented Nov 5, 2020

@9rb offers to get @raviclalwani in touch with @leithaus

experimenting at the rholang level:

new result, publish, read, contentCh in {
  contract publish(@withAds, @withoutAds, @price /* @url?*/, return ) = {
    contentCh!({"with": withAds, "without": withoutAds, "price": price})
    |
    return!(Nil)
  }
  |
  contract read(/*@url?,*/ @tokens, return) = {
    for (@current <<- contentCh) {
      match current {
        {"with": with, "without": without, "price": price} => {
          if(tokens >= price) {
            return!(without)
          } else {
            return!(with)
          }
        }
      }
    }
  }
  |
  
  // testing... publisher:
  new ack in {
    publish!("interesting story... buy my product.",
    "interesting story",
    10, *ack)
  }
  |
  // reader...
  new x in {
    read!(11, *x) |
    for (@stuff <- x) {
      result!(stuff)
    }
  }
}

https://rchain.coop/hackathon#dev-apis esp https://developer.rchain.coop/rholang-playground (https://rgov1.netlify.app/ is like the playground but has auto-indentation support)

https://github.com/rchain/rchain/blob/dev/rholang/src/main/bnfc/rholang_mercury.cf
BNFC is a parser generator, i.e. compiler compiler

https://github.com/rchain/rchain/blob/dev/rholang/src/main/scala/coop/rchain/rholang/interpreter/Reduce.scala

@dckc
Copy link

dckc commented Nov 7, 2020

raw notes from chat with @leithaus ... why not just a contract...

directly typable

status quo:
consistency constraint: what you put in a name, you get back out (modulo concurrency...)
a: x!(q)
b: for (<-x) gets q only
all pay.

new idea:
to get it out pristine, you pay additionally
your data gets stored, but stuff "grows" on it... grows sponsored content

types... threads in java are not directly visible. likewise, if this were a contract, it wouldn't be evident to types. statically evident from syntax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants