L2 Quickstart: Running a full Livepeer stack on Arbitrum One Rinkeby testnet

Here are some commands for running livepeer on localhost, connecting to Arbitrum One Rinkeby testnet (L2). They are optimised for linux, but can be adapted for mac and windows.

For beginners, this will set up a minimum viable stack of Livepeer’s video instructure software on a single host, and demonstrate a) a livestreaming server, b) live video transcoding, and c) probabilistic micropayments.

For experienced users of Livepeer, this is a good opportunity to learn a little bit about the role of -broadcaster in Livepeer network, which can be useful in onboarding new Broadcasters in the future :slight_smile:

If you found this useful, or have any issues, please leave a comment below.

Assumptions

  • ffmpeg is installed on your localhost, if not then:

    • sudo apt install ffmpeg
  • latest version of livepeer (0.5.27) is installed and unzipped in /home/ubuntu, if not then:

    • wget https://github.com/livepeer/go-livepeer/releases/download/v0.5.27/livepeer-linux-amd64.tar.gz
    • tar -xzf livepeer-linux-amd64.tar.gz
    • cd livepeer-linux-amd64
    • ./livepeer -version

Run an Orchestrator/Transcoder

In a Terminal window, run:

./livepeer -orchestrator -transcoder \
        -network arbitrum-one-rinkeby \
        -ethUrl https://rinkeby.arbitrum.io/rpc \
        -pricePerUnit 100000 \
        -serviceAddr 127.0.0.1:8935 \
        -ethPassword password \
        -v 99

Note: you will need to enter the password twice as password when you first run this process.

Configure the O/T

  • In a new Terminal window, run ./livepeer_cli

  • Make a note of the Orchestrator Account from the NODE STATS.

  • In a browser, request testnet ETH from:

  • In livepeer_cli

    • run command 16. Get test LPT
    • run command 12. Invoke multi-step "become an orchestrator" and follow the prompts. Bond all 10 LPT.
  • This will trigger four transactions to be signed and published. Wait for the final transaction (setServiceURI) to be confirmed before continuing.

  • Restart the O process. The Orchestrator is now ready to start doing work.

  • NOTE: You will have to wait until the new “round” starts before the O can redeem winning tickets. The number of the current round is found in the 1. Get node status option in livepeer_cli. Each round of livepeer protocol on Arbitrum One Rinkeby network is 300 blocks (approx 1 hour).

  • While you wait for a new round to start, you can set up a Broadcaster.

Run a Broadcaster

In a new Terminal window, run:

./livepeer -broadcaster \
        -network arbitrum-one-rinkeby \
        -ethUrl https://rinkeby.arbitrum.io/rpc \
        -httpAddr :8936 \
        -cliAddr :7936 \
        -rtmpAddr :1936 \
        -orchAddr 127.0.0.1:8935 \
        -ethPassword password \
        -transcodingOptions P240p30fps16x9,P144p30fps16x9 \
        -pixelsPerUnit 1 \
        -maxTicketEV 1000000000000000 \
        -v 99
  • wait until the process reports CLI server listening before continuing.

Configure the B

  • In a new Terminal window, run ./livepeer_cli -http 7936

    • note the -http 7936. Without this, it will connect to the O/T, not the B
  • Run command 11. Invoke "deposit broadcasting funds" (ETH)

    • as a reference, this guide works with a deposit of 0.06 ETH and reserve of 0.02 ETH
  • Restart the Broadcaster process. Wait until the process reports LPMS Server listening before continuing.

Start streaming

  • In a new Terminal window, run the following command:
ffmpeg -re -f lavfi \
           -i testsrc=size=640x360:rate=30,format=yuv420p \
           -f lavfi \
           -i sine \
           -c:v libx264 \
           -b:v 1000k \
           -x264-params keyint=60 \
           -c:a aac \
           -f flv rtmp://127.0.0.1:1936/test_source
  • This will publish a 640x360 (360p) test stream into the Broadcaster at 30fps.

  • Observe the B starting to receive and serve a new livestream.

  • Observe the O/T starting to transcode multiple renditions of the stream (into 426x240 (240p) and 256x144 (144p).

  • Also observe the O/T receiving Probabilistic Micropayment tickets, and occasionally redeeming a winning ticket by calling an onchain transaction (see below for more information).

Validate output streams

  • In a new Terminal window, run:
curl http://localhost:8936/stream/test_source.m3u8

This should return the following, showing all available renditions of the livestream:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=4000000,RESOLUTION=640x360
test_source/source.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=600000,RESOLUTION=426x240
test_source/P240p30fps16x9.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=400000,RESOLUTION=256x144
test_source/P144p30fps16x9.m3u8
  • To playback the smallest rendition (144p), run the following:
ffplay http://localhost:8936/stream/test_source/P144p30fps16x9.m3u8

This will play the 144p rendition, and should like this:

Probabilistic Micropayments

When the Orchestrator receives a winning ticket, it will call the redeemWinningTicket function onchain. This will claim the ticket’s faceValue, and add it to the Pending Fees. Pending Fees can be verified in livepeer_cli under “Delegator Stats”.

In order to withdraw these Pending Fees, a user can call 9. Invoke "withdraw fees" (ETH). This will withdraw fees to the user’s wallet.

All transactions called by the node can be observed on Arbiscan Testnet explorer or Arbitrum Rinkeby explorer.

Cleaning Up

If you have finished using the Orchestrator, you can tidy up by calling 6. Invoke "unbond" in livepeer_cli.

1 Like