mirror of
https://github.com/logos-storage/logos-storage-docs.git
synced 2026-05-02 23:23:23 +00:00
Update local-marketplace.md
Spanish translation
This commit is contained in:
parent
feea9dc470
commit
038ab38f97
@ -1,56 +1,53 @@
|
|||||||
---
|
---
|
||||||
outline: [2, 3]
|
outline: [2, 3]
|
||||||
---
|
---
|
||||||
# Running a Local Codex Network with Marketplace Support
|
# Ejecutando una Red Codex Local con Soporte de Marketplace
|
||||||
|
|
||||||
This tutorial will teach you how to run a small Codex network with the
|
Este tutorial te enseñará cómo ejecutar una pequeña red Codex con el
|
||||||
_storage marketplace_ enabled; i.e., the functionality in Codex which
|
_storage marketplace_ habilitado; es decir, la funcionalidad en Codex que
|
||||||
allows participants to offer and buy storage in a market, ensuring that
|
permite a los participantes ofrecer y comprar almacenamiento en un mercado, asegurando que
|
||||||
storage providers honor their part of the deal by means of cryptographic proofs.
|
los proveedores de almacenamiento cumplan con su parte del acuerdo mediante pruebas criptográficas.
|
||||||
|
|
||||||
In this tutorial, you will:
|
En este tutorial, aprenderás a:
|
||||||
|
|
||||||
1. [Set Up a Geth PoA network](#_1-set-up-a-geth-poa-network);
|
1. [En este tutorial, aprenderás a:](#_1-set-up-a-geth-poa-network);
|
||||||
2. [Set up The Marketplace](#_2-set-up-the-marketplace);
|
2. [Configurar El Marketplace](#_2-set-up-the-marketplace);
|
||||||
3. [Run Codex](#_3-run-codex);
|
3. [Ejecutar Codex](#_3-run-codex);
|
||||||
4. [Buy and Sell Storage in the Marketplace](#_4-buy-and-sell-storage-on-the-marketplace).
|
4. [Comprar y Vender Almacenamiento en el Marketplace](#_4-buy-and-sell-storage-on-the-marketplace).
|
||||||
|
|
||||||
## Prerequisites
|
## Prerrequisitos
|
||||||
|
|
||||||
To complete this tutorial, you will need:
|
Para completar este tutorial, necesitarás:
|
||||||
|
|
||||||
* the [geth](https://github.com/ethereum/go-ethereum) Ethereum client;
|
* el cliente Ethereum [geth](https://github.com/ethereum/go-ethereum);
|
||||||
You need version `1.13.x` of geth as newer versions no longer support
|
Necesitas la versión `1.13.x` de geth ya que las versiones más nuevas ya no son compatibles con la Prueba de Autoridad (PoA). Este tutorial se probó utilizando la versión `1.13.15` de geth.
|
||||||
Proof of Authority (PoA). This tutorial was tested using geth version `1.13.15`.
|
* un binario Codex, que, [puedes compilar desde el código fuente](https://github.com/codex-storage/nim-codex?tab=readme-ov-file#build-and-run).
|
||||||
* a Codex binary, which [you can compile from source](https://github.com/codex-storage/nim-codex?tab=readme-ov-file#build-and-run).
|
|
||||||
|
|
||||||
We will also be using [bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell))
|
También estaremos usando la sintaxis de [bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell))
|
||||||
syntax throughout. If you use a different shell, you may need to adapt
|
en todo el documento. Si utilizas una shell diferente, es posible que debas adaptar
|
||||||
things to your platform.
|
algunas cosas a tu plataforma.
|
||||||
|
|
||||||
To get started, create a new folder where we will keep the tutorial-related
|
Para comenzar, crea una nueva carpeta donde guardaremos los archivos relacionados con el tutorial
|
||||||
files so that we can keep them separate from the codex repository.
|
para que podamos mantenerlos separados del repositorio Codex.
|
||||||
We assume the name of the folder to be `marketplace-tutorial`.
|
Asumimos que el nombre de la carpeta es `marketplace-tutorial`.
|
||||||
|
|
||||||
## 1. Set Up a Geth PoA Network
|
## 1. Configurar una Red Geth PoA
|
||||||
|
|
||||||
For this tutorial, we will use a simple
|
Para este tutorial, utilizaremos una simple red
|
||||||
[Proof-of-Authority](https://github.com/ethereum/EIPs/issues/225) network
|
[Prueba de Autoridad](https://github.com/ethereum/EIPs/issues/225) con geth. El primer paso es crear una cuenta de firmante: una cuenta que
|
||||||
with geth. The first step is creating a _signer account_: an account which
|
será utilizada por geth para firmar los bloques en la red.
|
||||||
will be used by geth to sign the blocks in the network.
|
Cualquier bloque firmado por un firmante se acepta como válido.
|
||||||
Any block signed by a signer is accepted as valid.
|
### 1.1. Crear una Cuenta de Firmante
|
||||||
|
|
||||||
### 1.1. Create a Signer Account
|
Para crear una cuenta de firmante, desde el directorio `marketplace-tutorial` ejecuta:
|
||||||
|
|
||||||
To create a signer account, from the `marketplace-tutorial` directory run:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
geth account new --datadir geth-data
|
geth account new --datadir geth-data
|
||||||
```
|
```
|
||||||
|
|
||||||
The account generator will ask you to input a password, which you can
|
El generador de cuentas te pedirá que ingreses una contraseña, que puedes
|
||||||
leave blank. It will then print some information,
|
dejar en blanco. Luego imprimirá cierta información,
|
||||||
including the account's public address:
|
incluida la dirección pública de la cuenta:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
INFO [09-29|16:49:24.244] Maximum peer count ETH=50 total=50
|
INFO [09-29|16:49:24.244] Maximum peer count ETH=50 total=50
|
||||||
@ -69,37 +66,37 @@ Path of the secret key file: geth-data/keystore/UTC--2024-09-29T14-49-31.6552720
|
|||||||
- You must REMEMBER your password! Without the password, it's impossible to decrypt the key!
|
- You must REMEMBER your password! Without the password, it's impossible to decrypt the key!
|
||||||
```
|
```
|
||||||
|
|
||||||
In this example, the public address of the signer account is
|
En este ejemplo, la dirección pública de la cuenta de firmante es
|
||||||
`0x33A904Ad57D0E2CB8ffe347D3C0E83C2e875E7dB`.
|
`0x33A904Ad57D0E2CB8ffe347D3C0E83C2e875E7dB`.
|
||||||
Yours will print a different address. Save it for later usage.
|
Tu consola imprimirá una dirección diferente. Guárdala para usarla más adelante.
|
||||||
|
|
||||||
Next set an environment variable for later usage:
|
A continuación, configura una variable de entorno para usarla más adelante:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export GETH_SIGNER_ADDR="0x0000000000000000000000000000000000000000"
|
export GETH_SIGNER_ADDR="0x0000000000000000000000000000000000000000"
|
||||||
echo ${GETH_SIGNER_ADDR} > geth_signer_address.txt
|
echo ${GETH_SIGNER_ADDR} > geth_signer_address.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
> Here make sure you replace `0x0000000000000000000000000000000000000000`
|
> Aquí, asegúrate de reemplazar `0x0000000000000000000000000000000000000000`
|
||||||
> with your public address of the signer account
|
> con tu dirección pública de la cuenta de firmante
|
||||||
> (`0x33A904Ad57D0E2CB8ffe347D3C0E83C2e875E7dB` in our example).
|
> (`0x33A904Ad57D0E2CB8ffe347D3C0E83C2e875E7dB` en nuestro ejemplo).
|
||||||
|
|
||||||
### 1.2. Configure The Network and Create the Genesis Block
|
### 1.2. Configurar la Red y Crear el Bloque Génesis
|
||||||
|
|
||||||
The next step is telling geth what kind of network you want to run.
|
El siguiente paso es decirle a geth qué tipo de red quieres ejecutar.
|
||||||
We will be running a [pre-merge](https://ethereum.org/en/roadmap/merge/)
|
Estaremos ejecutando una red [pre-merge](https://ethereum.org/en/roadmap/merge/)
|
||||||
network with Proof-of-Authority consensus.
|
con consenso de Prueba de Autoridad.
|
||||||
To get that working, create a `network.json` file.
|
Para que eso funcione, crea un archivo `network.json` .
|
||||||
|
|
||||||
If you set the `GETH_SIGNER_ADDR` variable above you can run the following
|
Si configuraste la variable `GETH_SIGNER_ADDR` anteriormente, puedes ejecutar el siguiente
|
||||||
command to create the `network.json` file:
|
comando para crear el archivo `network.json` .
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
echo "{\"config\": { \"chainId\": 12345, \"homesteadBlock\": 0, \"eip150Block\": 0, \"eip155Block\": 0, \"eip158Block\": 0, \"byzantiumBlock\": 0, \"constantinopleBlock\": 0, \"petersburgBlock\": 0, \"istanbulBlock\": 0, \"berlinBlock\": 0, \"londonBlock\": 0, \"arrowGlacierBlock\": 0, \"grayGlacierBlock\": 0, \"clique\": { \"period\": 1, \"epoch\": 30000 } }, \"difficulty\": \"1\", \"gasLimit\": \"8000000\", \"extradata\": \"0x0000000000000000000000000000000000000000000000000000000000000000${GETH_SIGNER_ADDR:2}0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\", \"alloc\": { \"${GETH_SIGNER_ADDR}\": { \"balance\": \"10000000000000000000000\"}}}" > network.json
|
echo "{\"config\": { \"chainId\": 12345, \"homesteadBlock\": 0, \"eip150Block\": 0, \"eip155Block\": 0, \"eip158Block\": 0, \"byzantiumBlock\": 0, \"constantinopleBlock\": 0, \"petersburgBlock\": 0, \"istanbulBlock\": 0, \"berlinBlock\": 0, \"londonBlock\": 0, \"arrowGlacierBlock\": 0, \"grayGlacierBlock\": 0, \"clique\": { \"period\": 1, \"epoch\": 30000 } }, \"difficulty\": \"1\", \"gasLimit\": \"8000000\", \"extradata\": \"0x0000000000000000000000000000000000000000000000000000000000000000${GETH_SIGNER_ADDR:2}0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\", \"alloc\": { \"${GETH_SIGNER_ADDR}\": { \"balance\": \"10000000000000000000000\"}}}" > network.json
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also manually create the file remembering update it with your
|
También puedes crear el archivo manualmente recordando actualizarlo con tu
|
||||||
signer public address:
|
dirección pública de firmante:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -133,49 +130,48 @@ signer public address:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that the signer account address is embedded in two different places:
|
Ten en cuenta que la dirección de la cuenta de firmante está incrustada en dos lugares diferentes:
|
||||||
* inside of the `"extradata"` string, surrounded by zeroes and stripped of
|
* dentro de la cadena `"extradata"` , rodeada de ceros y sin su prefijo `0x` ;
|
||||||
its `0x` prefix;
|
* como una clave de entrada en la sesión `alloc` .
|
||||||
* as an entry key in the `alloc` session.
|
Asegúrate de reemplazar esa ID con la ID de cuenta que anotaste en
|
||||||
Make sure to replace that ID with the account ID that you wrote down in
|
[Paso 1.1](#_1-1-create-a-signer-account).
|
||||||
[Step 1.1](#_1-1-create-a-signer-account).
|
|
||||||
|
|
||||||
Once `network.json` is created, you can initialize the network with:
|
Una vez que se crea `network.json` , puedes inicializar la red con:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
geth init --datadir geth-data network.json
|
geth init --datadir geth-data network.json
|
||||||
```
|
```
|
||||||
|
|
||||||
The output of the above command you may include some warnings, like:
|
El resultado del comando anterior puede incluir algunas advertencias, como:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
WARN [08-21|14:48:12.305] Unknown config environment variable envvar=GETH_SIGNER_ADDR
|
WARN [08-21|14:48:12.305] Unknown config environment variable envvar=GETH_SIGNER_ADDR
|
||||||
```
|
```
|
||||||
|
|
||||||
or even errors when running the command for the first time:
|
o incluso errores al ejecutar el comando por primera vez:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ERROR[08-21|14:48:12.399] Head block is not reachable
|
ERROR[08-21|14:48:12.399] Head block is not reachable
|
||||||
```
|
```
|
||||||
|
|
||||||
The important part is that at the end you should see something similar to:
|
Lo importante es que al final debes ver algo similar a:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
INFO [08-21|14:48:12.639] Successfully wrote genesis state database=lightchaindata hash=768bf1..42d06a
|
INFO [08-21|14:48:12.639] Successfully wrote genesis state database=lightchaindata hash=768bf1..42d06a
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.3. Start your PoA Node
|
### 1.3. Iniciar tu Nodo PoA
|
||||||
|
|
||||||
We are now ready to start our $1$-node, private blockchain.
|
Ahora estamos listos para iniciar nuestra blockchain privada de $1$ nodo.
|
||||||
To launch the signer node, open a separate terminal in the same working
|
Para lanzar el nodo firmante, abre una terminal separada en el mismo directorio de trabajo
|
||||||
directory and make sure you have the `GETH_SIGNER_ADDR` set.
|
y asegúrate de tener `GETH_SIGNER_ADDR` configurado.
|
||||||
For convenience use the `geth_signer_address.txt`:
|
Para mayor comodidad, utiliza el `geth_signer_address.txt`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export GETH_SIGNER_ADDR=$(cat geth_signer_address.txt)
|
export GETH_SIGNER_ADDR=$(cat geth_signer_address.txt)
|
||||||
```
|
```
|
||||||
|
|
||||||
Having the `GETH_SIGNER_ADDR` variable set, run:
|
Teniendo la variable `GETH_SIGNER_ADDR` configurada, ejecuta:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
geth\
|
geth\
|
||||||
@ -190,14 +186,14 @@ geth\
|
|||||||
--allow-insecure-unlock
|
--allow-insecure-unlock
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that, once again, the signer account created in
|
Ten en cuenta que, una vez más, la cuenta de firmante creada en
|
||||||
[Step 1.1](#_1-1-create-a-signer-account) appears both in
|
[Paso 1.1](#_1-1-create-a-signer-account) aparece tanto en
|
||||||
`--unlock` and `--allow-insecure-unlock`.
|
`--unlock` como en `--allow-insecure-unlock`.
|
||||||
|
|
||||||
Geth will prompt you to insert the account's password as it starts up.
|
Geth te pedirá que insertes la contraseña de la cuenta a medida que se inicia.
|
||||||
Once you do that, it should be able to start up and begin "mining" blocks.
|
Una vez que lo hagas, debería poder iniciarse y comenzar a "minar" bloques.
|
||||||
|
|
||||||
Also here, you may encounter errors like:
|
También aquí, puedes encontrar errores como:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ERROR[08-21|15:00:27.625] Bootstrap node filtered by netrestrict id=c845e51a5e470e44 ip=18.138.108.67
|
ERROR[08-21|15:00:27.625] Bootstrap node filtered by netrestrict id=c845e51a5e470e44 ip=18.138.108.67
|
||||||
@ -206,41 +202,40 @@ ERROR[08-21|15:00:27.625] Bootstrap node filtered by netrestrict id=ef2d7ab886
|
|||||||
ERROR[08-21|15:00:27.625] Bootstrap node filtered by netrestrict id=6b36f791352f15eb ip=157.90.35.166
|
ERROR[08-21|15:00:27.625] Bootstrap node filtered by netrestrict id=6b36f791352f15eb ip=157.90.35.166
|
||||||
```
|
```
|
||||||
|
|
||||||
You can safely ignore them.
|
Puedes ignorarlos con seguridad.
|
||||||
|
|
||||||
If the command above fails with:
|
Si el comando anterior falla con:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
Fatal: Failed to register the Ethereum service: only PoS networks are supported, please transition old ones with Geth v1.13.x
|
Fatal: Failed to register the Ethereum service: only PoS networks are supported, please transition old ones with Geth v1.13.x
|
||||||
```
|
```
|
||||||
|
|
||||||
make sure, you are running the correct Geth version
|
asegúrate de estar ejecutando la versión correcta de Geth
|
||||||
(see Section [Prerequisites](#prerequisites))
|
(consulta la Secció [Prerrequisitos](#prerequisites))
|
||||||
|
|
||||||
## 2. Set Up The Marketplace
|
## 2. Configurar El Marketplace
|
||||||
|
|
||||||
You will need to open new terminal for this section and geth needs to be
|
Necesitarás abrir una nueva terminal para esta sección y geth debe estar
|
||||||
running already. Setting up the Codex marketplace entails:
|
ejecutándose ya. La configuración del marketplace de Codex implica:
|
||||||
|
|
||||||
1. Deploying the Codex Marketplace contracts to our private blockchain
|
1. Implementar los Contratos del Marketplace de Codex en nuestra blockchain privada
|
||||||
2. Setup Ethereum accounts we will use to buy and sell storage in
|
2. Configurar cuentas de Ethereum que utilizaremos para comprar y vender almacenamiento en el marketplace de Codex
|
||||||
the Codex marketplace
|
3. Aprovisionar esas cuentas con los saldos de tokens requeridos
|
||||||
3. Provisioning those accounts with the required token balances
|
|
||||||
|
|
||||||
### 2.1. Deploy the Codex Marketplace Contracts
|
2.1. Implementar los Contratos del Marketplace de Codex
|
||||||
|
Asegúrate de salir del directorio `marketplace-tutorial` y clonar
|
||||||
Make sure you leave the `marketplace-tutorial` directory, and clone
|
el `codex-storage/nim-codex.git`:
|
||||||
the `codex-storage/nim-codex.git`:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/codex-storage/nim-codex.git
|
git clone https://github.com/codex-storage/nim-codex.git
|
||||||
```
|
```
|
||||||
|
|
||||||
> If you just want to clone the repo to run the tutorial, you can
|
> Si solo quieres clonar el repositorio para ejecutar el tutorial, puedes
|
||||||
> skip the history and just download the head of the master branch by using
|
omitir el historial y simplemente descargar el head de la rama principal utilizando
|
||||||
|
el
|
||||||
> `--depth 1` option: `git clone --depth 1 https://github.com/codex-storage/nim-codex.git`
|
> `--depth 1` option: `git clone --depth 1 https://github.com/codex-storage/nim-codex.git`
|
||||||
|
|
||||||
Thus, our directory structure for the purpose of this tutorial looks like this:
|
Por lo tanto, nuestra estructura de directorios para el propósito de este tutorial se ve así:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
|
|
||||||
@ -248,49 +243,49 @@ Thus, our directory structure for the purpose of this tutorial looks like this:
|
|||||||
└-- marketplace-tutorial
|
└-- marketplace-tutorial
|
||||||
```
|
```
|
||||||
|
|
||||||
> You could clone the `codex-storage/nim-codex.git` to some other location.
|
> Podrías clonar el `codex-storage/nim-codex.git` a alguna otra ubicación.
|
||||||
> Just to keeps things nicely separated it is best to make sure that
|
> olo para mantener las cosas bien separadas, lo mejor es asegurarse de que
|
||||||
> `nim-codex` is not under `marketplace-tutorial` directory.
|
> `nim-codex` o esté bajo el directorio `marketplace-tutorial` .
|
||||||
|
|
||||||
Now, from the `nim-codex` folder run:
|
Ahora, desde la carpeta `nim-codex` ejecuta:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make update && make
|
make update && make
|
||||||
```
|
```
|
||||||
|
|
||||||
> This may take a moment as it will also build the `nim` compiler. Be patient.
|
> Esto puede tomar un momento ya que también construirá el compilador `nim` Ten paciencia.
|
||||||
|
|
||||||
Now, in order to start a local Ethereum network run:
|
Ahora, para iniciar una red Ethereum local ejecuta:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd vendor/codex-contracts-eth
|
cd vendor/codex-contracts-eth
|
||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
> While writing the document we used `node` version `v20.17.0` and
|
> Mientras escribíamos el documento, utilizamos la version `v20.17.0` de `node` y
|
||||||
> `npm` version `10.8.2`.
|
> la version `10.8.2` de `npm` .
|
||||||
|
|
||||||
Before continuing you now must **wait until $256$ blocks are mined**
|
Antes de continuar, ahora debes **esperar hasta que se minen $256$ bloques**
|
||||||
**in your PoAnetwork**, or deploy will fail. This should take about
|
**en tu red PoA**, o la implementación fallará. Esto debería tomar alrededor de
|
||||||
$4$ minutes and $30$ seconds. You can check which block height you are
|
$4$ minutos y $30$ segundos. Puedes verificar en qué altura de bloque te encuentras
|
||||||
currently at by running the following command
|
actualmente ejecutando el siguiente comando
|
||||||
**from the `marketplace-tutorial` folder**:
|
**desde la carpeta `marketplace-tutorial` **:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
geth attach --exec web3.eth.blockNumber ./geth-data/geth.ipc
|
geth attach --exec web3.eth.blockNumber ./geth-data/geth.ipc
|
||||||
```
|
```
|
||||||
|
|
||||||
once that gets past $256$, you are ready to go.
|
una vez que pase de $256$, estarás listo para continuar.
|
||||||
|
|
||||||
To deploy contracts, from the `codex-contracts-eth` directory run:
|
Para implementar contratos, desde el directorio `codex-contracts-eth` ejecuta:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export DISTTEST_NETWORK_URL=http://localhost:8545
|
export DISTTEST_NETWORK_URL=http://localhost:8545
|
||||||
npx hardhat --network codexdisttestnetwork deploy
|
npx hardhat --network codexdisttestnetwork deploy
|
||||||
```
|
```
|
||||||
|
|
||||||
If the command completes successfully, you will see the output similar
|
Si el comando se completa correctamente, verás un resultado similar
|
||||||
to this one:
|
a este:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
Deployed Marketplace with Groth16 Verifier at:
|
Deployed Marketplace with Groth16 Verifier at:
|
||||||
@ -300,139 +295,134 @@ Deployed Marketplace with Groth16 Verifier at:
|
|||||||
|
|
||||||
You are now ready to prepare the accounts.
|
You are now ready to prepare the accounts.
|
||||||
|
|
||||||
### 2.2. Generate the Required Accounts
|
### 2.2. Generar las Cuentas Requeridas
|
||||||
|
|
||||||
We will run $2$ Codex nodes: a **storage provider**, which will sell storage
|
Ejecutaremos $2$ nodos Codex: un **proveedor de almacenamiento**,que venderá almacenamiento
|
||||||
on the network, and a **client**, which will buy and use such storage;
|
en la red, y un **cliente**, que comprará y usará dicho almacenamiento;
|
||||||
we therefore need two valid Ethereum accounts. We could create random
|
por lo tanto, necesitamos dos cuentas de Ethereum válidas. Podríamos crear cuentas aleatorias
|
||||||
accounts by using one of the many tools available to that end but, since
|
utilizando una de las muchas herramientas disponibles para tal fin pero, dado que
|
||||||
this is a tutorial running on a local private network, we will simply
|
este es un tutorial que se ejecuta en una red privada local, simplemente
|
||||||
provide you with two pre-made accounts along with their private keys,
|
te proporcionaremos dos cuentas pre-hechas junto con sus claves privadas,
|
||||||
which you can copy and paste instead:
|
que puedes copiar y pegar en su lugar:
|
||||||
|
|
||||||
First make sure you're back in the `marketplace-tutorial` folder and
|
Primero, asegúrate de estar de vuelta en la carpeta `marketplace-tutorial` folder y
|
||||||
not the `codex-contracts-eth` subfolder. Then set these variables:
|
no en la subcarpeta `codex-contracts-eth` . Luego, configura estas variables:
|
||||||
|
|
||||||
**Storage:**
|
**Almacenamiento:**
|
||||||
```bash
|
```bash
|
||||||
export ETH_STORAGE_ADDR=0x45BC5ca0fbdD9F920Edd12B90908448C30F32a37
|
export ETH_STORAGE_ADDR=0x45BC5ca0fbdD9F920Edd12B90908448C30F32a37
|
||||||
export ETH_STORAGE_PK=0x06c7ac11d4ee1d0ccb53811b71802fa92d40a5a174afad9f2cb44f93498322c3
|
export ETH_STORAGE_PK=0x06c7ac11d4ee1d0ccb53811b71802fa92d40a5a174afad9f2cb44f93498322c3
|
||||||
echo $ETH_STORAGE_PK > storage.pkey && chmod 0600 storage.pkey
|
echo $ETH_STORAGE_PK > storage.pkey && chmod 0600 storage.pkey
|
||||||
```
|
```
|
||||||
|
|
||||||
**Client:**
|
**Cliente:**
|
||||||
```bash
|
```bash
|
||||||
export ETH_CLIENT_ADDR=0x9F0C62Fe60b22301751d6cDe1175526b9280b965
|
export ETH_CLIENT_ADDR=0x9F0C62Fe60b22301751d6cDe1175526b9280b965
|
||||||
export ETH_CLIENT_PK=0x5538ec03c956cb9d0bee02a25b600b0225f1347da4071d0fd70c521fdc63c2fc
|
export ETH_CLIENT_PK=0x5538ec03c956cb9d0bee02a25b600b0225f1347da4071d0fd70c521fdc63c2fc
|
||||||
echo $ETH_CLIENT_PK > client.pkey && chmod 0600 client.pkey
|
echo $ETH_CLIENT_PK > client.pkey && chmod 0600 client.pkey
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2.3. Provision Accounts with Tokens
|
### 2.3. Aprovisionar Cuentas con Tokens
|
||||||
|
|
||||||
We now need to transfer some ETH to each of the accounts, as well as provide
|
Ahora necesitamos transferir algo de ETH a cada una de las cuentas, así como proporcionarles
|
||||||
them with some Codex tokens for the storage node to use as collateral and
|
algunos tokens Codex para que el nodo de almacenamiento los use como colateral y
|
||||||
for the client node to buy actual storage.
|
para que el nodo cliente compre almacenamiento real.
|
||||||
|
|
||||||
Although the process is not particularly complicated, I suggest you use
|
Aunque el proceso no es particularmente complicado, te sugiero que uses
|
||||||
[the script we prepared](https://github.com/gmega/local-codex-bare/blob/main/scripts/mint-tokens.js)
|
[el script que preparamos](https://github.com/gmega/local-codex-bare/blob/main/scripts/mint-tokens.js)
|
||||||
for that. This script, essentially:
|
para eso. Este script, esencialmente:
|
||||||
|
|
||||||
1. reads the Marketplace contract address and its ABI from the deployment data;
|
1. Lee la dirección del contrato del Marketplace y su ABI de los datos de implementación;
|
||||||
2. transfers $1$ ETH from the signer account to a target account if the target
|
2. Transfiere $1$ ETH de la cuenta del firmante a una cuenta de destino si la cuenta de destino no tiene saldo de ETH;
|
||||||
account has no ETH balance;
|
3. Acuña $n$ tokens Codex y los agrega al saldo de la cuenta de destino.
|
||||||
3. mints $n$ Codex tokens and adds it into the target account's balance.
|
|
||||||
|
|
||||||
To use the script, just download it into a local file named `mint-tokens.js`,
|
Para usar el script, simplemente descárgalo en un archivo local llamado `mint-tokens.js`,
|
||||||
for instance using `curl` (make sure you are in
|
por ejemplo, usando `curl` (asegúrate de estar en
|
||||||
the `marketplace-tutorial` directory):
|
el directorio `marketplace-tutorial` ):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# download script
|
# descargar script
|
||||||
curl https://raw.githubusercontent.com/gmega/codex-local-bare/main/scripts/mint-tokens.js -o mint-tokens.js
|
curl https://raw.githubusercontent.com/gmega/codex-local-bare/main/scripts/mint-tokens.js -o mint-tokens.js
|
||||||
```
|
```
|
||||||
|
|
||||||
Then run:
|
Luego ejecuta:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# set the contract file location (we assume you are in the marketplace-tutorial directory)
|
# establecer la ubicación del archivo de contrato (asumimos que estás en el directorio marketplace-tutorial)
|
||||||
export CONTRACT_DEPLOY_FULL="../nim-codex/vendor/codex-contracts-eth/deployments/codexdisttestnetwork"
|
export CONTRACT_DEPLOY_FULL="../nim-codex/vendor/codex-contracts-eth/deployments/codexdisttestnetwork"
|
||||||
export GETH_SIGNER_ADDR=$(cat geth_signer_address.txt)
|
export GETH_SIGNER_ADDR=$(cat geth_signer_address.txt)
|
||||||
# Installs Web3-js
|
# Instala Web3-js
|
||||||
npm install web3
|
npm install web3
|
||||||
# Provides tokens to the storage account.
|
# Proporciona tokens a la cuenta de almacenamiento.
|
||||||
node ./mint-tokens.js $CONTRACT_DEPLOY_FULL/TestToken.json $GETH_SIGNER_ADDR 0x45BC5ca0fbdD9F920Edd12B90908448C30F32a37 10000000000
|
node ./mint-tokens.js $CONTRACT_DEPLOY_FULL/TestToken.json $GETH_SIGNER_ADDR 0x45BC5ca0fbdD9F920Edd12B90908448C30F32a37 10000000000
|
||||||
# Provides tokens to the client account.
|
# Proporciona tokens a la cuenta del cliente.
|
||||||
node ./mint-tokens.js $CONTRACT_DEPLOY_FULL/TestToken.json $GETH_SIGNER_ADDR 0x9F0C62Fe60b22301751d6cDe1175526b9280b965 10000000000
|
node ./mint-tokens.js $CONTRACT_DEPLOY_FULL/TestToken.json $GETH_SIGNER_ADDR 0x9F0C62Fe60b22301751d6cDe1175526b9280b965 10000000000
|
||||||
```
|
```
|
||||||
|
|
||||||
If you get a message like
|
Si te sale un mensaje como
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
Usage: mint-tokens.js <token-hardhat-deploy-json> <signer-account> <receiver-account> <token-ammount>
|
Usage: mint-tokens.js <token-hardhat-deploy-json> <signer-account> <receiver-account> <token-ammount>
|
||||||
```
|
```
|
||||||
|
|
||||||
then you need to ensure you provided all the required arguments.
|
entonces necesitas asegurarte que proveiste todos los argumentos requeridos.
|
||||||
In particular you need to ensure that the `GETH_SIGNER_ADDR` env variable
|
En particular necesitas asegurar, que la variable de entorno `GETH_SIGNER_ADDR` contenga la dirección del firmante (usamos
|
||||||
holds the signer address (we used
|
`export GETH_SIGNER_ADDR=$(cat geth_signer_address.txt)` arriba, para
|
||||||
`export GETH_SIGNER_ADDR=$(cat geth_signer_address.txt)` above to
|
asegurar que este establecida)
|
||||||
make sure it is set).
|
|
||||||
|
|
||||||
## 3. Run Codex
|
## 3. Ejecutar Codex
|
||||||
|
|
||||||
With accounts and geth in place, we can now start the Codex nodes.
|
Con las cuentas y geth configurados, ahora podemos iniciar los nodos Codex.
|
||||||
|
|
||||||
### 3.1. Storage Node
|
### 3.1.Storage Node
|
||||||
|
|
||||||
The storage node will be the one storing data and submitting the proofs of
|
El nodo de almacenamiento será el que almacene los datos y envíe las pruebas de
|
||||||
storage to the chain. To do that, it needs access to:
|
almacenamiento a la cadena. Para hacer eso necesita access a:
|
||||||
|
|
||||||
1. the address of the Marketplace contract that has been deployed to
|
1. La dirección de contrata del Marketplace que fue "deployed" a el nodo geth local en [Paso 2.1](#_2-1-deploy-the-codex-marketplace-contracts);
|
||||||
the local geth node in [Step 2.1](#_2-1-deploy-the-codex-marketplace-contracts);
|
2. A los "sample ceremony files" los cuales estan dentro de Codex contracts repo
|
||||||
2. the sample ceremony files which are shipped in the Codex contracts repo
|
|
||||||
(`nim-codex/vendor/codex-contracts-eth`).
|
(`nim-codex/vendor/codex-contracts-eth`).
|
||||||
|
|
||||||
**Address of the Marketplace Contract.** The contract address can be found
|
**Dirección del Contrato Marketplace.** La dirección del contracto se puede encontrar
|
||||||
inside of the file `nim-codex/vendor/codex-contracts-eth/deployments/codexdisttestnetwork/Marketplace.json`.
|
dentro el archivo `nim-codex/vendor/codex-contracts-eth/deployments/codexdisttestnetwork/Marketplace.json`.
|
||||||
We captured that location above in `CONTRACT_DEPLOY_FULL` variable, thus, from
|
Capturamos esta ubicación en la variable `CONTRACT_DEPLOY_FULL` arriba, por lo tanto, desde la carpeta `marketplace-tutorial` ejecuta:
|
||||||
the `marketplace-tutorial` folder just run:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
grep '"address":' ${CONTRACT_DEPLOY_FULL}/Marketplace.json
|
grep '"address":' ${CONTRACT_DEPLOY_FULL}/Marketplace.json
|
||||||
```
|
```
|
||||||
|
|
||||||
which should print something like:
|
esto imprimirá algo como:
|
||||||
```bash
|
```bash
|
||||||
"address": "0xCf0df6C52B02201F78E8490B6D6fFf5A82fC7BCd",
|
"address": "0xCf0df6C52B02201F78E8490B6D6fFf5A82fC7BCd",
|
||||||
```
|
```
|
||||||
|
|
||||||
> This address should match the address we got earlier when deploying
|
> Esta dirección debería de coincidir con la que obtuvimos antes cuando "deployeamos"
|
||||||
> the Marketplace contract above.
|
> el contracto Marketplace arriba.
|
||||||
|
|
||||||
Then run the following with the correct market place address:
|
Después ejecuta lo siguiente con la dirección correcta del mercado:
|
||||||
```bash
|
```bash
|
||||||
export MARKETPLACE_ADDRESS="0x0000000000000000000000000000000000000000"
|
export MARKETPLACE_ADDRESS="0x0000000000000000000000000000000000000000"
|
||||||
echo ${MARKETPLACE_ADDRESS} > marketplace_address.txt
|
echo ${MARKETPLACE_ADDRESS} > marketplace_address.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
where you replace `0x0000000000000000000000000000000000000000` with
|
donde reemplazariamos `0x0000000000000000000000000000000000000000` con
|
||||||
the Marketplace contract above in
|
el contrato Marketplace de arriba en
|
||||||
[Step 2.1](#_2-1-deploy-the-codex-marketplace-contracts).
|
[Paso 2.1](#_2-1-deploy-the-codex-marketplace-contracts).
|
||||||
|
|
||||||
**Prover ceremony files.** The ceremony files are under the
|
**Archivos de ceremonia del "prover".** The "ceremony files" están bajo el
|
||||||
|
subdirectorio
|
||||||
`nim-codex/vendor/codex-contracts-eth/verifier/networks/codexdisttestnetwork`
|
`nim-codex/vendor/codex-contracts-eth/verifier/networks/codexdisttestnetwork`
|
||||||
subdirectory. There are three of them: `proof_main.r1cs`, `proof_main.zkey`,
|
Son tres: `proof_main.r1cs`, `proof_main.zkey`,
|
||||||
and `prooof_main.wasm`. We will need all of them to start the Codex storage node.
|
y `prooof_main.wasm`. Los necesitaremos todos para iniciar el nodo de almacenamiento Codex.
|
||||||
|
|
||||||
**Starting the storage node.** Let:
|
**Iniciando el nodo de almacenamiento.** Sea:
|
||||||
|
|
||||||
* `PROVER_ASSETS` contain the directory where the prover ceremony files are
|
* `PROVER_ASSETS` conteniendo la dirección donde los archivos de ceremonia del "prover" están ubicados. **Esta debe de ser una ruta absoluta**;
|
||||||
located. **This must be an absolute path**;
|
* `CODEX_BINARY` conteniendo la ubicación de tu binario Codex;
|
||||||
* `CODEX_BINARY` contain the location of your Codex binary;
|
* `MARKETPLACE_ADDRESS` conteniendo la dirección de el contrato Marketplace (ya hemos configurado esto arriba).
|
||||||
* `MARKETPLACE_ADDRESS` contain the address of the Marketplace contract
|
|
||||||
(we have already set it above).
|
|
||||||
|
|
||||||
Set these paths into environment variables (make sure you are in
|
Configura estas rutas en variables de entorno (asegúrate que esta en
|
||||||
the `marketplace-tutorial` directory):
|
el directorio `marketplace-tutorial` ):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export CONTRACT_DEPLOY_FULL=$(realpath "../nim-codex/vendor/codex-contracts-eth/deployments/codexdisttestnetwork")
|
export CONTRACT_DEPLOY_FULL=$(realpath "../nim-codex/vendor/codex-contracts-eth/deployments/codexdisttestnetwork")
|
||||||
@ -440,10 +430,10 @@ export PROVER_ASSETS=$(realpath "../nim-codex/vendor/codex-contracts-eth/verifie
|
|||||||
export CODEX_BINARY=$(realpath "../nim-codex/build/codex")
|
export CODEX_BINARY=$(realpath "../nim-codex/build/codex")
|
||||||
export MARKETPLACE_ADDRESS=$(cat marketplace_address.txt)
|
export MARKETPLACE_ADDRESS=$(cat marketplace_address.txt)
|
||||||
```
|
```
|
||||||
> you may notice, that we have already set the `CONTRACT_DEPLOY_FULL` variable
|
> puedes notar, que ya establecimos la variable `CONTRACT_DEPLOY_FULL` variable
|
||||||
> above. Here, we make sure it is an absolute path.
|
> arriba. Ahora, nos aseguramos que es una dirección absoluta
|
||||||
|
|
||||||
To launch the storage node, run:
|
Para lanzar el nodo de almacenamiento , ejecuta :
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
${CODEX_BINARY}\
|
${CODEX_BINARY}\
|
||||||
@ -463,35 +453,34 @@ ${CODEX_BINARY}\
|
|||||||
--circom-zkey=${PROVER_ASSETS}/proof_main.zkey
|
--circom-zkey=${PROVER_ASSETS}/proof_main.zkey
|
||||||
```
|
```
|
||||||
|
|
||||||
**Starting the client node.**
|
**Iniciando el nodo cliente.**
|
||||||
|
|
||||||
The client node is started similarly except that:
|
El nodo client se inicializa similar, excepto que:
|
||||||
|
|
||||||
* we need to pass the SPR of the storage node so it can form a network with it;
|
necesitamos pasar la SPR del nodo de almacenamiento, par que pueda formar uan red con el;
|
||||||
* since it does not run any proofs, it does not require any ceremony files.
|
desde que no ejecuta ningún "proofs", no requiere archivos de "ceremonia".
|
||||||
|
Obtenemos el "Signed Peer Record (SPR)" del nodo de almacenamiento, para poder "bootstrap"
|
||||||
We get the Signed Peer Record (SPR) of the storage node so we can bootstrap
|
el nodo cliente con el. Para obtener la SPR, ejecuta la llamada siguiente:
|
||||||
the client node with it. To get the SPR, issue the following call:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -H 'Accept: text/plain' 'http://localhost:8000/api/codex/v1/spr' --write-out '\n'
|
curl -H 'Accept: text/plain' 'http://localhost:8000/api/codex/v1/spr' --write-out '\n'
|
||||||
```
|
```
|
||||||
|
|
||||||
You should get the SPR back starting with `spr:`.
|
Deberías recibir el SPR de vuelta, empezando con `spr:`.
|
||||||
|
|
||||||
Before you proceed, open new terminal, and enter `marketplace-tutorial` directory.
|
Antes de proceder, abre una nueva terminal, y entra en en directorio `marketplace-tutorial` .
|
||||||
|
|
||||||
Next set these paths into environment variables:
|
Lo siguiente es establecer estas rutas en variables de entorno:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# set the SPR for the storage node
|
# establece el SPR para el nodo de almacenamiento
|
||||||
export STORAGE_NODE_SPR=$(curl -H 'Accept: text/plain' 'http://localhost:8000/api/codex/v1/spr')
|
export STORAGE_NODE_SPR=$(curl -H 'Accept: text/plain' 'http://localhost:8000/api/codex/v1/spr')
|
||||||
# basic vars
|
# variables basicas
|
||||||
export CONTRACT_DEPLOY_FULL=$(realpath "../nim-codex/vendor/codex-contracts-eth/deployments/codexdisttestnetwork")
|
export CONTRACT_DEPLOY_FULL=$(realpath "../nim-codex/vendor/codex-contracts-eth/deployments/codexdisttestnetwork")
|
||||||
export CODEX_BINARY=$(realpath "../nim-codex/build/codex")
|
export CODEX_BINARY=$(realpath "../nim-codex/build/codex")
|
||||||
export MARKETPLACE_ADDRESS=$(cat marketplace_address.txt)
|
export MARKETPLACE_ADDRESS=$(cat marketplace_address.txt)
|
||||||
```
|
```
|
||||||
and then run:
|
y después ejecuta:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
${CODEX_BINARY}\
|
${CODEX_BINARY}\
|
||||||
@ -506,18 +495,18 @@ ${CODEX_BINARY}\
|
|||||||
--marketplace-address=${MARKETPLACE_ADDRESS}
|
--marketplace-address=${MARKETPLACE_ADDRESS}
|
||||||
```
|
```
|
||||||
|
|
||||||
## 4. Buy and Sell Storage on the Marketplace
|
## 4. Comprar y Vender Almacenamiento en el Marketplace
|
||||||
|
|
||||||
Any storage negotiation has two sides: a buyer and a seller.
|
Cualquier negociación de almacenamiento tiene dos lados:: un comprador y un vendedor.
|
||||||
Therefore, before we can actually request storage, we must first offer
|
Por lo tanto, antes de que podamos realmente solicitar almacenamiento, primero debemos ofrecer
|
||||||
some of it for sale.
|
algo de el a la venta.
|
||||||
|
|
||||||
### 4.1 Sell Storage
|
### 4.1 Vender Almacenamiento
|
||||||
|
|
||||||
The following request will cause the storage node to put out $50\text{MB}$
|
LA siguiente solicitud hara, que el nodo de almacenamiento ponga a la venta $50\text{MB}$
|
||||||
of storage for sale for $1$ hour, at a price of $1$ Codex token
|
de almacenamiento por $1$ hora , a un precio de $1$ token Codex
|
||||||
per slot per second, while expressing that it's willing to take at most
|
por "slot" por segundo, al tiempo que expresa que está dispuesto a asumir como máximo
|
||||||
a $1000$ Codex token penalty for not fulfilling its part of the contract.[^1]
|
una penalización de $1000$ tokens Codex, por no cumplir con su parte del contrato.[^1]
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl 'http://localhost:8000/api/codex/v1/sales/availability' \
|
curl 'http://localhost:8000/api/codex/v1/sales/availability' \
|
||||||
@ -530,53 +519,53 @@ curl 'http://localhost:8000/api/codex/v1/sales/availability' \
|
|||||||
}'
|
}'
|
||||||
```
|
```
|
||||||
|
|
||||||
This should return a JSON response containing an `id` (e.g. `"id": "0xb55b3bc7aac2563d5bf08ce8a177a38b5a40254bfa7ee8f9c52debbb176d44b0"`)
|
Esto debería devolver una respuesta JSON conteniendo un `id` (p.ej. `"id": "0xb55b3bc7aac2563d5bf08ce8a177a38b5a40254bfa7ee8f9c52debbb176d44b0"`)
|
||||||
which identifies this storage offer.
|
que identifica la oferta de almacenamiento.
|
||||||
|
|
||||||
> To make JSON responses more readable, you can try
|
> Para que las respuestas JSON sean más legibles, puedes intentar
|
||||||
> [jq](https://jqlang.github.io/jq/) JSON formatting utility
|
> [jq](https://jqlang.github.io/jq/) la utilidad de formato JSON,
|
||||||
> by just adding `| jq` after the command.
|
> simplemente agregando `| jq` después del comando.
|
||||||
> On macOS you can install with `brew install jq`.
|
> En macOS puedes instalarlo con `brew install jq`.
|
||||||
|
|
||||||
To check the current storage offers for this node, you can issue:
|
Para revisar las ofertas de almacenamiento actuales para ste nodo, puedes ejecutar:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl 'http://localhost:8000/api/codex/v1/sales/availability'
|
curl 'http://localhost:8000/api/codex/v1/sales/availability'
|
||||||
```
|
```
|
||||||
|
|
||||||
or with `jq`:
|
o con `jq`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl 'http://localhost:8000/api/codex/v1/sales/availability' | jq
|
curl 'http://localhost:8000/api/codex/v1/sales/availability' | jq
|
||||||
```
|
```
|
||||||
|
|
||||||
This should print a list of offers, with the one you just created figuring
|
Esto debería de imprimir una lista de ofertas, con la que acabas de crear figurando
|
||||||
among them (for our tutorial, there will be only one offer returned
|
entre ellas (para nuestro tutorial, solo se devolverá una oferta
|
||||||
at this time).
|
en este momento).
|
||||||
|
|
||||||
### 4.2. Buy Storage
|
### 4.2. Comprar Almacenamiento
|
||||||
|
|
||||||
Before we can buy storage, we must have some actual data to request
|
Antes de que podamos comprar almacenamiento, necesitamos mas data para solicitar
|
||||||
storage for. Start by uploading a small file to your client node.
|
almacenamiento. Empieza subiendo un archivo pequeño a tu nodo cliente.
|
||||||
On Linux (or macOS) you could, for instance, use `dd` to generate a $1M$ file:
|
En Linux (o macOS) podrías, por ejemplo, usar `dd` para generar un archivo $1M$:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
dd if=/dev/urandom of=./data.bin bs=1M count=1
|
dd if=/dev/urandom of=./data.bin bs=1M count=1
|
||||||
```
|
```
|
||||||
|
|
||||||
Assuming your file is named `data.bin`, you can upload it with:
|
Asumiendo que tu archivo se llama `data.bin`, puedes subirlo con:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl --request POST http://localhost:8001/api/codex/v1/data --header 'Content-Type: application/octet-stream' --write-out '\n' -T ./data.bin
|
curl --request POST http://localhost:8001/api/codex/v1/data --header 'Content-Type: application/octet-stream' --write-out '\n' -T ./data.bin
|
||||||
```
|
```
|
||||||
|
|
||||||
Once the upload completes, you should see a _Content Identifier_,
|
Una vez que se complete la carga, deberías ver un _Content Identifier_,
|
||||||
or _CID_ (e.g. `zDvZRwzm2mK7tvDzKScRLapqGdgNTLyyEBvx1TQY37J2CdWdS6Sj`)
|
o _CID_ (p.ej. `zDvZRwzm2mK7tvDzKScRLapqGdgNTLyyEBvx1TQY37J2CdWdS6Sj`)
|
||||||
for the uploaded file printed to the terminal.
|
para el archivo cargado impreso en la terminal.
|
||||||
Use that CID in the purchase request:
|
Usa ese CID en la solicitud de compra:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# make sure to replace the CID before with the CID you got in the previous step
|
# asegúrate de reemplazar el CID anterior con el CID que obtuviste en el paso anterior
|
||||||
export CID=zDvZRwzm2mK7tvDzKScRLapqGdgNTLyyEBvx1TQY37J2CdWdS6Sj
|
export CID=zDvZRwzm2mK7tvDzKScRLapqGdgNTLyyEBvx1TQY37J2CdWdS6Sj
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -595,39 +584,36 @@ curl "http://localhost:8001/api/codex/v1/storage/request/${CID}" \
|
|||||||
--write-out '\n'
|
--write-out '\n'
|
||||||
```
|
```
|
||||||
|
|
||||||
The parameters under `--data` say that:
|
Los parámetros en `--data` dicen:
|
||||||
|
|
||||||
1. we want to purchase storage for our file for $5$ minutes (`"duration": "600"`);
|
1. queremos comprar almacenamiento para nuestro archivo durante $5$ minutos (`"duration": "600"`);
|
||||||
2. we are willing to pay up to $1$ token per slot per second (`"reward": "1"`)
|
2. estamos dispuestos pagar a hasta $1$ token por slot por segundo (`"reward": "1"`)
|
||||||
3. our file will be split into three pieces (`"nodes": 3`).
|
3. nuestro archivo se dividirá en tres pedazos (`"nodes": 3`).
|
||||||
Because we set `"tolerance": 1` we only need two (`nodes - tolerance`)
|
Porque establecimos `"tolerance": 1` solo necesitamos dos (`nodes - tolerance`)
|
||||||
pieces to rebuild the file; i.e., we can tolerate that at most one node
|
pedazos para reconstruir el archivo; i.e., podemos tolerar que a lo mucho 1 nodo deje de almacenar nuestros datos; ya sea debido a falla u otras razones;
|
||||||
stops storing our data; either due to failure or other reasons;
|
4. exigimos `1000` tokens en garantía de los proveedores de almacensmiento por slot. Desde que hay $3$ slots de estos, habrá `3000` en garantía total
|
||||||
4. we demand `1000` tokens in collateral from storage providers for each piece.
|
comprometido por los proveedores de almacenamiento una vez que se inicie nuestra solicitud.
|
||||||
Since there are $3$ such pieces, there will be `3000` in total collateral
|
5. finalmente, el `expiry` pone un límite de tiempo para llenar todos los "slots" por los proveedores de almacenamiento. Si los slots no se llenan antes del intervalo `expire` interval,
|
||||||
committed by the storage provider(s) once our request is started.
|
la solicitud expirará, y fallara.
|
||||||
5. finally, the `expiry` puts a time limit for filling all the slots by
|
|
||||||
the storage provider(s). If slot are not filled by the `expire` interval,
|
|
||||||
the request will timeout and fail.
|
|
||||||
|
|
||||||
### 4.3. Track your Storage Requests
|
### 4.3. Rastrear Tus Solicitudes de Almacenamiento
|
||||||
|
|
||||||
POSTing a storage request will make it available in the storage market,
|
"POSTeando" una solicitud de almacenamiento la pondrá a disposicion en el mercado de almacenamiento,
|
||||||
and a storage node will eventually pick it up.
|
y un nodo de almacenamiento eventualmente la recogerá.
|
||||||
|
|
||||||
You can poll the status of your request by means of:
|
Puedes mandar a llamar el estado de tu solicitud por medios de::
|
||||||
```bash
|
```bash
|
||||||
export STORAGE_PURCHASE_ID="1d0ec5261e3364f8b9d1cf70324d70af21a9b5dccba380b24eb68b4762249185"
|
export STORAGE_PURCHASE_ID="1d0ec5261e3364f8b9d1cf70324d70af21a9b5dccba380b24eb68b4762249185"
|
||||||
curl "http://localhost:8001/api/codex/v1/storage/purchases/${STORAGE_PURCHASE_ID}"
|
curl "http://localhost:8001/api/codex/v1/storage/purchases/${STORAGE_PURCHASE_ID}"
|
||||||
```
|
```
|
||||||
|
|
||||||
For instance:
|
Por ejemplo:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
> curl 'http://localhost:8001/api/codex/v1/storage/purchases/6c698cd0ad71c41982f83097d6fa75beb582924e08a658357a1cd4d7a2a6766d'
|
> curl 'http://localhost:8001/api/codex/v1/storage/purchases/6c698cd0ad71c41982f83097d6fa75beb582924e08a658357a1cd4d7a2a6766d'
|
||||||
```
|
```
|
||||||
|
|
||||||
This returns a result like:
|
Esto devuelve un resultado como:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -655,15 +641,15 @@ This returns a result like:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Shows that a request has been submitted but has not yet been filled.
|
Muestra que a una solicitud se le ha dado "submitted" pero aun no ha sido completada.
|
||||||
Your request will be successful once `"state"` shows `"started"`.
|
Tu solicitud tendrá éxito una vez que `"state"` muestre `"started"`.
|
||||||
Anything other than that means the request has not been completely
|
Cualquier otra cosa fuera de eso significa que una solicitud no ha sido completamente
|
||||||
processed yet, and an `"error"` state other than `null` means it failed.
|
procesada aun, y un estado `"error"` a parte de `null` significa que ha fallado.
|
||||||
|
|
||||||
Well, it was quite a journey, wasn't it? You can congratulate yourself for
|
Bueno, este ha sido un camino largo verdad? Puedes felicitarte a ti mismo por
|
||||||
successfully finishing the codex marketplace tutorial!
|
haber terminado exitosamenet el tutorial de Codex marketplace !
|
||||||
|
|
||||||
[^1]: Codex files get partitioned into pieces called "slots" and distributed
|
[^1]: Los archivos Codex se han dividido en pedazos llamados "slots" y distribuidos
|
||||||
to various storage providers. The collateral refers to one such slot,
|
a varios proveedores de almacenamiento. "The colateral refiers to one such slot"
|
||||||
and will be slowly eaten away as the storage provider fails to deliver
|
y lo consumiran lentamente a medida que el proveedor de almacenamiento falle en el
|
||||||
timely proofs, but the actual logic is [more involved than that](https://github.com/codex-storage/codex-contracts-eth/blob/6c9f797f408608958714024b9055fcc330e3842f/contracts/Marketplace.sol#L209).
|
entrega oportuna de "proofs" , pero la lógica actual es [más compleja que eso](https://github.com/codex-storage/codex-contracts-eth/blob/6c9f797f408608958714024b9055fcc330e3842f/contracts/Marketplace.sol#L209).
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user