Weeknotes: New Basin library, Studio landing page with trends & table inspector, & more

Basin now supports a Go library for signing data, the Studio added new features on the landing page + network table inspection, we wrapped up the ETHDenver Proof of Data event, & upcoming hackathons.

Begin transmission…

New Basin release with Go library for signing

by Dan Buchholz

We recently released a new version (v0.0.11) of vaults CLI, which also comes with a new pkg/signing library. The CLI introduced a way to unify how hot vs. cold storage data was retrieved. Before, if data was retrieved from cold storage, it would be downloaded as a CAR file and require subsequent unpacking. Now, everything is consistent such that when you download an event CID, the data will be unpacked behind the scenes and provided to you in the originally uploaded file format.

In terms of the new signing package, this is particularly useful if you're programmatically using Basin's HTTP APIs. For reference, all APIs hit the https://basin.tableland.xyz base URL and allow for the following:

  1. Create a vault: POST /vaults/{vault_id} with an account param and (optional) cache param.

  2. List vaults: GET /vaults?account={address} to get all vaults owned by a 0x address

  3. Write an event: POST /vaults/{vault_id}/events where a filename header is required—and related to the new signing library, a signature param is required, which is the hex-encoded signature of the file.

  4. List events: GET /vaults/{vault_id}/eventswith optional parameters for filtering data by unix timestamps (limit, before, after, offset)

  5. Downloading events: GET /events/{event_id} where you provide the CID and can extract the data for further processing.

In the API described in #3 above, the signature parameter is required to ensure the data being written to a vault is written by an authorized user—i.e., the EVM address that owns the vault. The signing package makes this signature generation process easy by providing a few methods:

  • HexToECDSA: Loads a private key from the given string and creates an ECDSA private key.

  • FileToECDSA: Loads a private key from a file and creates an ECDSA private key.

  • NewSigner: Creates a new signer with the given private key, provided by LoadPrivateKey.

  • SignFile: Signs the given file with the signer and returns the signature as a bytes slice, which can be converted to a hex-encoded string and used in the URL POST request to write data to a vault.

  • SignBytes: Signs arbitrary bytes and returns a signature as a bytes slice.

Signing data in Go

Here's how you can use the signing package, and a quick demo can be found here. For the sake of demonstration, let's assume you've already created a vault and are trying to write data to it via the POST /vaults/{vault_id}/events HTTP API. First, in your project, install the package:

go get github.com/tablelandnetwork/basin-cli/pkg/[email protected]

The signing process requires you to provide the secp256k1 private key, which will be used to sign the file/data.

package main import ( // Various std lib imports... // `signing` package import "github.com/tablelandnetwork/basin-cli/pkg/signing" ) func main() { // Set up our private key, account/address, and signer pk := "your_private_key" privateKey, _ := signing.HexToECDSA(pk) account, _ := getPubKey(privateKey) signer := signing.NewSigner(privateKey) }

Let's say the data you want to push to Basin is a simple test.txt file with arbitrary data. We first want to open that file, and the signing.SignFile method will handle reading the file:

// Set up our file to sign/write to a vault filePath := "test.txt" file, err := os.Open(filePath) if err != nil { log.Fatalf("Error loading reading file: %v", err) } filename := file.Name() defer file.Close()

Thus, we can sign the file with the signer created from the signing library:

// Sign the file signatureBytes, err := signer.SignFile(filename) if err != nil { log.Fatalf("Error signing file: %v", err) } signature := hex.EncodeToString(signatureBytes) fmt.Printf("Signature: %v\\n", signature)

This signature value should result in a string 130 characters long; it is what can be used as the parameter when calling the API. For example, here’s how you could do this in Go:

// Set up our URL & request parameters vaultId := "your_vault.data" timestampInt := time.Now().Unix() timestamp := strconv.FormatInt(timestamp, 10) url := fmt.Sprintf("https://basin.tableland.xyz/vaults/%s/events?timestamp=%s&signature=%s", vaultId, timestamp, signature) // Read our file fileData, err := io.ReadAll(file) if err != nil { fmt.Printf("Error reading file: %v\\n", err) return err } // Set up our API POST request req, err := http.NewRequest("POST", url, bytes.NewReader(fileData)) if err != nil { fmt.Printf("Error creating request: %v\\n", err) return err } // Set up the request's `filename` header req.Header.Set("filename", filename) client := &http.Client{} resp, err := client.Do(req) if err != nil { fmt.Printf("Error sending request: %v\\n", err) return err } defer resp.Body.Close() // Get the API call's response when writing data to the vault _, err := io.ReadAll(resp.Body) if err != nil { return err }

For the full example, check out the demo: here.

New Studio landing page

by Aaron Sutula

We launched a new landing page for Studio at https://studio.tableland.xyz. There, you can see a list of featured Studio projects, the latest Studio projects, the latest Tableland tables, and the most active Tableland tables (where you can see detailed information about the table and view the table's data). We'll be adding more features around Tableland table pages soon!

To demonstrate this functionality, after connecting your wallet, you’ll now be brought to a screen that lists out your teams, which makes it easier to navigate to your projects:

Upon scrolling down, you’ll see those new additions for the featured projects, latest projects, and table trends:

Lastly, our new #sql-logs Discord channel will (soon) link to the Studio table inspection screen and let you view information about any new table or project on the network. As noted, you can take any table ever created on Tableland—even if it wasn’t created in the Studio but was with the Tableland SDK or smart contract—and view the data directly in the Studio UI!

An example of a table minted long before the Studio application was developed and outside of any Studio projects: here

Starting at the end with product design strategy

by Jim Kosem

Product design strategy is a funny thing. You can start in a lot of different places. You can start at the beginning, looking at where you’re at and then where you want to go. Or you can do it the other way around, where you want to go, and then work backward. Lately, I’ve been trying out the latter.

We’ve been looking at our two-year horizon and where we can take things with the direction we’re headed with not just Basin, but how it works with the whole Textile Network. So, I started thinking about how to talk about it and show it on the internet. This is a great way of framing things that we often do at Textile. How do you explain where you will be in two years? You write it down. You make it clear enough that someone could land on a web page and then understand. And then work backward. This allows you to work backwards to today’s reality and most importantly begin to put some shape to all the stuff in between.

Other updates this week

ETHDenver roundup

ETHDenver was amazing! We met sooo many people and builders in the space, and the overall sentiment around web3, in general, is at all-time highs. We hope to kick off a lot of exciting work with the new teams we met with, particularly, in the DePIN space.

Our co-sponsored Proof of Data Summit helped make those connections and shed light on many problems DePINs face today. Namely, decentralized, scalable, and developer-friendly data infrastructure is lacking in the space, and we’re striving to do all we can to make it easier for decentralized networks to store and retrieve data in a performant, web3-native way!

Data Economy, Decentralized Intelligence, & Backdrop Hackathons

We’re well underway into the Dorahacks / Filecoin Data Economy hackathon, which will round up at the end of the month. The LearnWeb3 hackathon will begin on March 20 and run until April 4, so keep an eye out if you’d like to participate. Finally, the Backdrop’s Build V3 program is also in-flight, and we look forward to supporting any builders admitted into that, too!

End transmission…

Want to dive deeper, ask questions, or just nerd out with us? Jump into our Telegram or Discord—including weekly research office hours or developer office hours. And if you’d like to discuss any of these topics in more detail, comment on the issue over on GitHub!

Are you enjoying Weeknotes? We’d love your feedback—if you fill out a quick survey, we’ll be sure to reach out directly with community initiatives in the future!: Fill out the form here

Textile Blog & Newsletter logo
Subscribe to Textile Blog & Newsletter and never miss a post.
  • Loading comments...