> For the complete documentation index, see [llms.txt](https://docs.orbs.network/v2-contract-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.orbs.network/v2-contract-sdk/orbs-contracts/events.md).

# Events

Orbs contract events give you the ability to log information into the blockchain that is stored as part of the receipt block.

Here is a simple contract that emits an event. We will go over it in details:

```go
package main

import (
    "github.com/orbs-network/orbs-contract-sdk/go/sdk/v1"
    "github.com/orbs-network/orbs-contract-sdk/go/sdk/v1/events"
    "github.com/orbs-network/orbs-contract-sdk/go/sdk/v1/state"
)

var PUBLIC = sdk.Export(giveBirth)
var SYSTEM = sdk.Export(_init)
var EVENTS = sdk.Export(BabyBorn)

func BabyBorn(name string, weight uint32) {}

func _init() {
    state.WriteUint64([]byte("some_data"), 1)
}

func giveBirth(name string) {
    events.EmitEvent(BabyBorn, name, uint32(3))
}
```

Using the Events API require you first to import it:

```go
import (
    "github.com/orbs-network/orbs-contract-sdk/go/sdk/v1/events"
)
```

Next, we export the event:

```go
var EVENTS = sdk.Export(BabyBorn)
```

Then we declare it as an empty function. Note that the empty bracers are required (`{}`):

```go
func BabyBorn(name string, weight uint32) {}
```

When the function `giveBirth(name string)` is called, we want the event to be emitted, so we call the `events.EmitEvent` function:

```go
events.EmitEvent(BabyBorn, name, uint32(3))
```

The arguments are a pointer to the event function (which is also exported) and the event arguments.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.orbs.network/v2-contract-sdk/orbs-contracts/events.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
