Download the PHP package arweave/arweave-sdk without Composer
On this page you can find all versions of the php package arweave/arweave-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download arweave/arweave-sdk
More information about arweave/arweave-sdk
Files in arweave/arweave-sdk
Package arweave-sdk
Short Description Arweave PHP SDK
License GPL-2.0
Homepage https://arweave.org
Informations about the package arweave-sdk
Arweave PHP SDK
This package allows us to interact with the Arweave network, we can use it to read and write transactions and data to the network.
Installation
We strongly recommend using composer for installation.
composer require arweave/arweave-sdk
Or add the following to your project composer.json
file.
Quick Examples
Sending data to the network
Getting data from the network
Usage
Instantiation
Start by creating a Arweave
object, this is the primary SDK class your application should use, it contains the public methods for creating, sending and getting transactions.
Provide any valid Arweave node hostname or IP address
Getting a Transaction
Once we have our Arweave
object we can now get transactions from the network using a valid transaction ID.
For example:
The above will return the following Transaction
object:
Getting data from a Transaction
There are two methods for getting data from a transaction, we can either:
This method returns the original and decoded data from a transaction. This is the simplest method and probably the one you'll need most often.
Alternatively, if we need the encoded data or need other transaction attributes we can do the following:
ArQL
Loading a Wallet
To load a wallet you need a Key file. Arweave uses JSON Web Keys (JWK) as the key file format, a JWK is simply a JSON representation of a public/private key pair and they look something like this:
We first need to decode our JWK file to a PHP array, then we can simply pass that array into a new Wallet
object.
You should treat your JWK as you would treat an API key or a password. You should never expose them or place them in any publicly accessible location and never commit them to any version control system, doing so will compromise your wallet and its contents.
This is just one suggested method of storing your JWK but there's no requirement that you store in as a JSON file, you could also store it in an environment variable, a database, a PHP file, or anywhere else. As long as it ends up as a PHP array it should work just fine.
Creating a Transaction
Transactions need to be signed for them to be accepted by the network, so this step requires a wallet.
All versions of arweave-sdk with dependencies
php Version ^7.0
ext-curl Version *
ext-mbstring Version *
ext-gmp Version *
web-token/jwt-framework Version ^1.3
web-token/jwt-core Version ^1.3