+
Skip to content

urbit/jamboard

Repository files navigation

Urbit Jamboard

An EVM smart contract for posting global +jamed data.

Entries submitted to the contract contain:

  $:  author=@p
      agent=@tas
      action=@tas
      data=*         :: jammed data
  ==

The accounts submitting entries must own the ship in the author field.

You should only submit +jamed data. The maximum allowed size of +jamed data is 1kb.

To do so from javascript, make use of the nockjs repo to build nouns and jam them.

example:

const noun = nockjs.Atom.fromCord('babay im goin on chain!')
const jammed = nockjs.jam(noun).bytes()

const tx = await contract.submitEntry(
  aura.patp2dec('~migrev-dolseg'),       // author
  toBytes16('hawk'),                     // agent
  toBytes16('some-action-name'),         // action
  new Uint8Array(jammed)                 // data
);
const reciept = await tx.wait();

see scripts/write.js for more.


Reading from mars

the jamboard.hoon thread can be used in any desk which contains

  • lib/ethereum.hoon
  • lib/ethio.hoon
  • lib/strandio.hoon

its input argument is:

+$  input
    $:  rpc-url=@t
        author-filter=(unit @p)
        agent-filter=(unit @tas)
        action-filter=(unit @tas)
        start-block=(unit @ud)  :: otherwise, earliest
        end-block=(unit @ud)    :: otherwise, latest
    ==

and its output is:

+$  output  (list entry)
+$  entry
  $:  block-number=@ud
      when=@da
      author=@p
      agent=@tas
      action=@tas
      data=*
  ==

Local setup

  1. open a terminal to the root of this repo
  2. npm install
  3. create a .env file with this RPC URL
    • RPC_URL=http://127.0.0.1:8545
      
  4. npx hardhat compile
  5. npx hardhat node
    • starts local chain
    • copy one of the fake account private keys to the .env file
    • RPC_URL=http://127.0.0.1:8545
      PRIVATE_KEY=0x...
      
  6. open a new terminal to the root of this repo
  7. deploy the contract
    • node scripts/deploy.js
    • copy the contract address to .env
    • RPC_URL=http://127.0.0.1:8545
      PRIVATE_KEY=0x...
      CONTRACT_ADDRESS=0x...
      
  8. submit some fake data
    • node scripts/write.js --author="~migrev" --agent="hawk" --action="post-url" --data="some string here"
  9. use the reader thread to read from the contract
    • -jamboard 'http://localhost:8545' ~ ~ ~ ~ ~

About

on-chain bulletin board for jammed data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载