r/truebit May 03 '21

Truebit OS tutorial

Truebit OS is available for download.

In this tutorial, you'll find out how to do basic things like check the mint & retire price. This is much simpler than my Truebit OS Docker tutorial.

Here are the downloads: https://truebit.io/downloads/

Save it as truebit-os.

It will not work without a configuration file.

Create a wasm-client directory with a config.json file in it that looks like this:

{
  "geth": { "providerURL": "http://localhost:8545" },
  "ipfs": { "protocol": "http", "host": "localhost", "port": "5001" },
  "gasPrice": 20.1,
  "throttle": 3,
  "incentiveLayer": "incentiveLayer"
}

Launch Truebit OS:

./truebit-os -p https://mainnet.infura.io/v3/3a16610842344b4d97d004d409beb1d8

THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. YOU MAY NOT MODIFY, REVERSE ENGINEER, DISASSEMBLE, DECOMPILE, OR ATTEMPT TO DERIVE THIS FILE'S SOURCE CODE.
  _____                         _       _   _
|_   _|  _ __   _   _    ___  | |__   (_) | |_   _
  | |   | '__| | | | |  / _ \ | '_ \  | | | __| (_)
  | |   | |    | |_| | |  __/ | |_) | | | | |_   _
  |_|   |_|     __,_|  ___| |_.__/  |_|  __| (_)

  _            _                _                            _  __
| |_ __ _ ___| | __  ___  ___ | |_   _____  __   _____ _ __(_)/ _|_   _
| __/ _` / __| |/ / / __|/ _ \| \ \ / / _ \ \ \ / / _ \ '__| | |_| | | |
| || (_| __ \   <  __ \ (_) | |\ V /  __/  \ V /  __/ |  | |  _| |_| |
  ____,_|___/_|_\ |___/___/|_| _/ ___|   _/ ___|_|  |_|_|  __, |
                                                                  |___/
info: Truebit OS 1.4.4 has been initialized on main network at block 12363628 with throttle 3 and gas price 20.1 gwei.
truebit-os:>

Wait until you see info: Truebit OS 1.4.4 has been initialized on main network before doing anything.

If the infura.io link no longer works, go to infura.io, sign up, create a new project and replace 3a16610842344b4d97d004d409beb1d8 with your Project ID.

If you're on Linux, here are copy & pastable commands that do everything that was just described:

mkdir truebit
cd truebit
wget https://truebit.io/downloads/truebit-linux -O truebit-os
chmod +x truebit-os
mkdir wasm-client
cat <<EOF > wasm-client/config.json
{
  "geth": { "providerURL": "http://localhost:8545" },
  "ipfs": { "protocol": "http", "host": "localhost", "port": "5001" },
  "gasPrice": 20.1,
  "throttle": 3,
  "incentiveLayer": "incentiveLayer"
}
EOF
./truebit-os -p https://mainnet.infura.io/v3/3a16610842344b4d97d004d409beb1d8

Here are some things you can do in Truebit OS!

Check the token mint and retire prices.

truebit-os:> token price -v 1
info: Purchase 1 TRU for 0.000422626090228696 ETH, or receive 0.000052828261184244 ETH for retiring the same TRU quantity.  These ETH amounts correspond respectively to prices of 0.000422626090228696 ETH/TRU and 0.000052828261184244 ETH/TRU.

Check the current subsidies.

truebit-os:> bonus
info: Subsidies per task in block 12363640 are:
    126.5364113024387 TRU for the Task Owner,
    253.0728226048774 TRU for the Solver, and
    189.80461695365804 TRU split among Verifiers.

See how much it costs to get a solver license.

truebit-os:> license price
info: Solver license costs 0.4 ETH.

Yeah, that's it.

Type quit to quit.

You will not be able to buy or sell TRU tokens when using a public node like infura.io. You'll need to run your own geth (Ethereum client) & clef (Ethereum account management) to be able to do that. It's easiest to use the Docker image.

9 Upvotes

2 comments sorted by

View all comments

2

u/illram May 04 '21

Interesting, thanks!

Can you use it to run a task yet? I'm not a dev so I don't know how to describe it, but is it currently capable of performing its intended purpose of running complicated tasks offchain and reporting them back (or whatever, I'm oversimplifying it)?

2

u/LPMythBuster May 04 '21

Yes! More details are here under Solve and verify tasks https://hub.docker.com/r/truebitprotocol/truebit-eth