github.com/google/trillian-examples@v0.0.0-20240520080811-0d40d35cef0e/helloworld/README.md (about)

     1  # helloworld
     2  This is a basic example of how to use
     3  [Trillian](http://github.com/google/trillian) to implement the operations
     4  needed for a verifiable log.  This means providing instantiations for two
     5  different actors:
     6  - A **personality**, which acts a front-end for the (Trillian) log.  In CT,
     7    for example, the personality is CTFE.
     8  - A **client**, which interfaces with the personality; in Trillian, the client
     9    should never talk to the log directly.  In CT, for example, the client might
    10    be an individual browser or a monitor.
    11  
    12  This example intentionally avoids
    13  defining any interface between the client and personality, leaving only the
    14  gRPC interface between the personality and the (Trillian) log.  In a real
    15  deployment it would be necessary to define an interface between the client
    16  and the personality, for example a RESTful API or gRPC.
    17  
    18  In order to run the tests, it is necessary to first have a Trillian log
    19  running. Follow one of the two steps below:
    20  
    21  ## Manual
    22  
    23  Set up MySQL or MariaDB using [MySQL setup](http://github.com/google/trillian#mysql-setup).
    24  Then, in one terminal, run the following commands:
    25  
    26  ```bash
    27  go run github.com/google/trillian/cmd/trillian_log_server --rpc_endpoint="localhost:50054" --http_endpoint="localhost:50055" &
    28  go run github.com/google/trillian/cmd/trillian_log_signer --sequencer_interval="1s" --batch_size=500 --rpc_endpoint="localhost:50056" --http_endpoint="localhost:50057" --num_sequencers=1 --force_master &
    29  # Trillian services are now running
    30  
    31  export TREE_ID=$(go run github.com/google/trillian/cmd/createtree --admin_server=localhost:50054)
    32  ```
    33  
    34  ## Docker
    35  
    36  ```bash
    37  docker compose up -d
    38  # Wait a second for MySQL to start up between these commands
    39  curl https://raw.githubusercontent.com/google/trillian/master/storage/mysql/schema/storage.sql | docker exec -i helloworld-db-1 mysql -pzaphod -Dtest
    40  ```
    41  
    42  # Running the tests
    43  
    44  After setting up the trillian environment using the Manual or Docker instructions:
    45  
    46  Now, in another terminal run `go build` and then `go test --tree_id=${TREE_ID}`.  
    47  This runs three tests. 
    48  1. `TestAppend` ensures that checkpoints update properly on the
    49  personality side when new entries are appended to the log.
    50  2. `TestUpdate` ensures that these updated checkpoints can be accepted by the 
    51  client, after they are proved consistent with previous checkpoints.
    52  3. `TestIncl` ensures that the client can be convinced about whether or not 
    53  entries are in the log.