API

From BiblePay Wiki
Revision as of 14:54, 24 April 2022 by Admin (talk | contribs)
Jump to: navigation, search


We are a blockchain with real world use cases.

We are offering an alternative to big tech, big media, and we are fighting for freedom. Just as God wants freedom for us, we want freedom for you. We do not believe in censoring free speech, but instead, the principles of the Constitution of the US. Additionally, when you use our services, you are paying for orphan sponsorships. What better relationship could there be?


Live Service #1:


BiblePay S3 File Hosting (S3aas)

This API allows you to store files, accessible by public URL (via CDN). You may store small files all the way up to very large files (1 byte to 1Gigabyte per file).

The storage is extremely cost effective, priced at : 1 bbp per 100 megabytes per month.

The files are available worldwide through our anti-ddos CDN which is located in all major cities and countries.

Bandwidth costs: Zero.

Use cases: Upload your mp4 videos, your audio tracks, your encrypted backup files, your web site files, your images/css/assets for web hosting, share files etc.

S3 Endpoint for Curl (Linux, Mac, others)

Simply post your file from the command or through code as below, along with your biblepay private key in the Header field:

Example:

curl -X POST 
    -H "key: YOUR_BIBLEPAY_PRIVATE_KEY" 
    -F "myfile.mp4" 
    https://unchained.biblepay.org/api/web/bbpingress


Response:

If successful, Biblepay will respond with an http-200 response, with JSON containing an empty error field, a result code with a value of 200, and the URL which you can use immediately.

If unsuccessful, BiblePay will respond with an http-200 response, with JSON containing an error field with a populated reason, and a result code below zero.


S3 Endpoint for C#

You can also post your file programatically in any language. For C#, please see this example below:

public async static void UploadBiblePayFile()
{
      string sURL = "https://unchained.biblepay.org/api/web/bbpingress";
      string sFilePath = "s:\\san\\rapture2\\9.mp4";
      HttpContent bytesContent = new ByteArrayContent(System.IO.File.ReadAllBytes(sFilePath));
      using (var httpClient = new System.Net.Http.HttpClient())
      {
        using (var request = new HttpRequestMessage(new HttpMethod("POST"), sURL))
        {
            httpClient.Timeout = new System.TimeSpan(0, 60, 00);
            httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Key", "your_bbp_private_key");
            var multipartContent = new MultipartFormDataContent();
            multipartContent.Add(bytesContent, "file", System.IO.Path.GetFileName(sFilePath));
            request.Content = multipartContent;
            var oInitialResponse = await httpClient.PostAsync(sURL, multipartContent);
            string sJsonResponse = await oInitialResponse.Content.ReadAsStringAsync();
        }
    }
}


Sample Response:

{"error":"","URL":"https://bbp.s3.filebase.com/BBSWt5B13GuM5xJQHYM468bLC5qxmRmQ7Y/9.mp4","result":200}



BIPFS - BiblePay Immutable Public File System (BIPFSaas)

This API allows you to store provably immutable files, accessible by public URL (via CDN). You may store small files all the way up to very large files (1 byte to 1Gigabyte per file).

The storage is extremely cost effective, priced at : 1 bbp per 100 megabytes per month.

The files are available worldwide through our anti-ddos CDN which is located in all major cities and countries.

Bandwidth costs: Zero.

Use cases: NFT metadata files, contract data, special social media posts, provable timestamped videos, or any file that needs immutability.

How it is immutable:

First, we hash the file with a standard sha256 hash. We require the sha256 hash to become the filename. The filename extension is preserved. Once the file is stored, we create an immutable biblepay transaction pointing to the file which contains the sha256 hash (this permanently preserves the timestamp and the record). The file contents can never be changed (because it can always be proven the hash matches) except in the case of non-payment. In the case of nonpayment, the contents of the file will be served as "UNPAID" and the blockchain record of the file will remain intact.

S3 Endpoint for Curl (Linux, Mac, others)

Simply post your file from the command or through code as below, along with your biblepay private key in the Header field:

Example:

curl -X POST 
    -H "key: YOUR_BIBLEPAY_PRIVATE_KEY" 
    -H "immutable: 1" 
    -F "file.mp4" 
    https://unchained.biblepay.org/api/web/bbpingress


Response:

If successful, Biblepay will respond with an http-200 response, with JSON containing an empty error field, a result code with a value of 200, and the URL which you can use immediately.

If unsuccessful, BiblePay will respond with an http-200 response, with JSON containing an error field with a populated reason, and a result code below zero.




FAQ


Q: Where are my files stored and what is the durability?

A: The network is comprised of three partners: BiblePay (for metadata), BiblePay Sanctuaries, IPFS, and CDN (for retrieval). The durability is set higher than normal so that the files will never be deleted unless you fail to pay the BBP hosting fee.


Q: What is a CDN?

A: A content data network copies your file to hundreds of global POPs (Points of Presence) so that the file can be downloaded faster to your user. This also provides resilience, in case the file is attempted to be taken down due to censorship, your file will still be available. Also if a fiber optic line is cut in a certain area, your file will still be available to the rest of the world. The CDN also provides anti-ddos, meaning that the CDN network is larger than any potential ddos threat. A good use case for a CDN is a news article. If you host it on biblepay, even if the article is attacked by thousands of malicious botnet actors, our CDN will keep supplying that news article to your readers. News orgs already use CDNs for their articles.


Q: How does billing work?

A: Once per month, we bill your private key for the sum in size of the bytes hosted for that key to the key itself so please ensure your key has enough to cover future hosting. We create an invoice that may be viewed in My Invoices. If your key does not have enough funds to cover the fees, after the grace period elapses (+14 days), then the files that cannot be paid for will be deleted. Other files in good standing will stay hosted.


Q: Why shouldn't I go directly to STORJ or Amazon?

A: For STORJ, you will find that you need to setup a lot of technical items such as your download gateway and you will need to deal with the command line to send and receive files while we offer a programmatic solution above. We also do all the technical work for you to make it easier for you. Additionally, you dont get a free CDN. With Amazon, you are dealing with big tech, who will definitely charge you for all public bandwidth consumption which could cost you more than BiblePay. For example if your file is abused (repeatedly downloaded millions of times you could end up with a very high S3 invoice). With BiblePay, we only charge for the storage. Finally, with BiblePay you are helping ORPHANS. It's easy to decide when you want to make the world a better place.


Q: What if I want my data private and not public, like a backup file?

A: Reach out to us on social.biblepay.org and ask for the feature and if the demand is there, we will add an encryption option for you so that your data at rest file in cloud is encrypted with your key.






DbAAS - Database As a Service


Database As a Service provides you with a personal instance of a MYSQL database that runs on our cluster. Our cluster runs across a set of our sanctuaries and is self healing giving you 99.9% uptime. When one of our nodes go down in our cluster, you will not notice. We also have a built in load balancer, meaning that if one of our back-end nodes go down, the cluster as a whole will not go down. You can reach our cluster with one primary DNS address, disclosed when you subscribe. (Our DNS members are also self healing).

To subscribe to DbAAS, simply log into social.biblepay.org, click BBP from the left menu, then click DbAAS. Fill in the form and create Submit.

There is a minimum amount of BBP required to be in escrow on the page.

FAQ:

Q: Are there any special requirements for my tables?

A: All tables must have a primary key. Otherwise you will receive an error when you insert data.

Q: What can I do with this?

A: You can run a website, a personal program or development environment, an instance of social.biblepay, a wordpress site, etc., against your mysql instance.